summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Frisson <christian.frisson@gmail.com>2016-10-15 22:07:17 +0200
committerArne Coucheron <arco68@gmail.com>2018-01-27 00:41:41 +0100
commit27371b3fbcb25d8be26e6a84b12871d0ed20f6ea (patch)
tree14bb466f02e21e012584fa1bd05dc89cd174cc3e
parentba57c48121628a3bb8ebf160d8ba3233e1de19ef (diff)
downloadandroid_packages_apps_Snap-27371b3fbcb25d8be26e6a84b12871d0ed20f6ea.zip
android_packages_apps_Snap-27371b3fbcb25d8be26e6a84b12871d0ed20f6ea.tar.gz
android_packages_apps_Snap-27371b3fbcb25d8be26e6a84b12871d0ed20f6ea.tar.bz2
Snap: Allow switching beyond just 2 cameras
Some devices have dual rear cameras, which means that they will have more than just 2 camera ID's (0 and 1). For example, the LG G5 has 0, 1 and 2. Allow Snap to run cycle through more than just 0 and 1 Change-Id: I50d8b6c02c97961990b1fbf69b9cf706c422381c
-rw-r--r--src/com/android/camera/MenuController.java1
-rw-r--r--src/com/android/camera/PhotoMenu.java4
-rw-r--r--src/com/android/camera/VideoMenu.java6
3 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/camera/MenuController.java b/src/com/android/camera/MenuController.java
index 97240cb..63815f9 100644
--- a/src/com/android/camera/MenuController.java
+++ b/src/com/android/camera/MenuController.java
@@ -104,6 +104,7 @@ public class MenuController {
return;
}
}
+ index = index % ((IconListPreference) pref).getLargeIconIds().length;
((ImageView) switcher).setImageResource(pref.getLargeIconIds()[index]);
}
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index 8afd595..80aaa9a 100644
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -859,6 +859,7 @@ public class PhotoMenu extends MenuController
int index = pref.findIndexOfValue(pref.getValue());
if (!pref.getUseSingleIcon() && iconIds != null) {
// Each entry has a corresponding icon.
+ index = index % iconIds.length;
resid = iconIds[index];
} else {
// The preference only has a single icon to represent it.
@@ -885,8 +886,9 @@ public class PhotoMenu extends MenuController
CharSequence[] values = pref.getEntryValues();
index = (index + 1) % values.length;
pref.setValueIndex(index);
+ int iconListLength = ((IconListPreference) pref).getLargeIconIds().length;
((ImageView) v).setImageResource(
- ((IconListPreference) pref).getLargeIconIds()[index]);
+ ((IconListPreference) pref).getLargeIconIds()[index % iconListLength]);
if (prefKey.equals(CameraSettings.KEY_CAMERA_ID))
mListener.onCameraPickerClicked(index);
reloadPreference(pref);
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index 5838bf6..418dbbe 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -489,6 +489,7 @@ public class VideoMenu extends MenuController
return;
}
// Each entry has a corresponding icon.
+ index = index % iconIds.length;
resid = iconIds[index];
} else {
// The preference only has a single icon to represent it.
@@ -508,8 +509,9 @@ public class VideoMenu extends MenuController
CharSequence[] values = pref.getEntryValues();
index = (index + 1) % values.length;
pref.setValueIndex(index);
+ int iconListLength = ((IconListPreference) pref).getLargeIconIds().length;
((ImageView) v).setImageResource(
- ((IconListPreference) pref).getLargeIconIds()[index]);
+ ((IconListPreference) pref).getLargeIconIds()[index % iconListLength]);
if (prefKey.equals(CameraSettings.KEY_CAMERA_ID))
mListener.onCameraPickerClicked(index);
reloadPreference(pref);
@@ -746,7 +748,7 @@ public class VideoMenu extends MenuController
mPrevSavedVideoCDS = cds;
}
- if ((tnr != null) && !tnr.equals("off")) {
+ if ((tnr != null) && !tnr.equals("off")) {
mListMenu.setPreferenceEnabled(
CameraSettings.KEY_VIDEO_CDS_MODE,false);
mListMenu.overrideSettings(