Add more menu options/icons
Bug: 8640131
Added location and scene mode to secondary menu
Updated HDR icons
Change-Id: I5bed39a2ec037aecf67702d88f738befe61846d4
diff --git a/src/com/android/camera/PieController.java b/src/com/android/camera/PieController.java
index 5ccab5e..565a20e 100644
--- a/src/com/android/camera/PieController.java
+++ b/src/com/android/camera/PieController.java
@@ -133,6 +133,50 @@
return item;
}
+ public PieItem makeSwitchItem(final String prefKey, int position, int count,
+ boolean addListener) {
+ final IconListPreference pref =
+ (IconListPreference) mPreferenceGroup.findPreference(prefKey);
+ if (pref == null) return null;
+ int[] iconIds = pref.getLargeIconIds();
+ int resid = -1;
+ int index = pref.findIndexOfValue(pref.getValue());
+ if (!pref.getUseSingleIcon() && iconIds != null) {
+ // Each entry has a corresponding icon.
+ resid = iconIds[index];
+ } else {
+ // The preference only has a single icon to represent it.
+ resid = pref.getSingleIcon();
+ }
+ PieItem item = makeItem(resid);
+ item.setPosition(position, count);
+ item.setLabel(pref.getLabels()[index]);
+ item.setImageResource(mActivity, resid);
+ mPreferences.add(pref);
+ mPreferenceMap.put(pref, item);
+ if (addListener) {
+ final PieItem fitem = item;
+ item.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(PieItem item) {
+ IconListPreference pref = (IconListPreference) mPreferenceGroup
+ .findPreference(prefKey);
+ int index = pref.findIndexOfValue(pref.getValue());
+ CharSequence[] values = pref.getEntryValues();
+ index = (index + 1) % values.length;
+ pref.setValueIndex(index);
+ fitem.setLabel(pref.getLabels()[index]);
+ fitem.setImageResource(mActivity,
+ ((IconListPreference) pref).getLargeIconIds()[index]);
+ reloadPreference(pref);
+ onSettingChanged(pref);
+ }
+ });
+ }
+ return item;
+ }
+
+
public PieItem makeDialItem(ListPreference pref, int iconId, float center, float sweep) {
PieItem item = makeItem(iconId);
return item;
@@ -143,6 +187,17 @@
mRenderer.addItem(item);
}
+ public void updateItem(PieItem item, String prefKey) {
+ IconListPreference pref = (IconListPreference) mPreferenceGroup
+ .findPreference(prefKey);
+ if (pref != null) {
+ int index = pref.findIndexOfValue(pref.getValue());
+ item.setLabel(pref.getLabels()[index]);
+ item.setImageResource(mActivity,
+ ((IconListPreference) pref).getLargeIconIds()[index]);
+ }
+ }
+
public void setPreferenceGroup(PreferenceGroup group) {
mPreferenceGroup = group;
}