summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/BasicIndicator.java
diff options
context:
space:
mode:
authorNipun Kwatra <nkwatra@google.com>2010-09-14 21:14:25 -0700
committerNipun Kwatra <nkwatra@google.com>2010-09-15 15:51:46 -0700
commitf6a9ed7f6b08d0694795adc6ea6fce999e8cab87 (patch)
treeaa9e103d1efd32be117cbf16d6d821712fd6c619 /src/com/android/camera/ui/BasicIndicator.java
parentb5ec9823f642decda6467e55dc1fd806d000bb75 (diff)
downloadLegacyCamera-f6a9ed7f6b08d0694795adc6ea6fce999e8cab87.zip
LegacyCamera-f6a9ed7f6b08d0694795adc6ea6fce999e8cab87.tar.gz
LegacyCamera-f6a9ed7f6b08d0694795adc6ea6fce999e8cab87.tar.bz2
Adding ui for setting frame capture interval.
Currently adding a bunch of discrete options for the user to choose from. - Modified BasicIndicator class to allow ListPreference as well as IconListPreference. - Modified addIndicator() in HeadUpDisplay to take ListPreference instead of IconListPreference. - Modified GpsIndicator::getIcon() to return BitmapTexture instead of ResourceTexture as its base class BasicIndicator does the same now. - Fixed default value of time lapse quality. Change-Id: I9f01d8c77e9a803219c4661e10731fabbecf65a9
Diffstat (limited to 'src/com/android/camera/ui/BasicIndicator.java')
-rw-r--r--src/com/android/camera/ui/BasicIndicator.java50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/com/android/camera/ui/BasicIndicator.java b/src/com/android/camera/ui/BasicIndicator.java
index 7630a8e..9f076b8 100644
--- a/src/com/android/camera/ui/BasicIndicator.java
+++ b/src/com/android/camera/ui/BasicIndicator.java
@@ -19,31 +19,47 @@ package com.android.camera.ui;
import android.content.Context;
import com.android.camera.IconListPreference;
+import com.android.camera.ListPreference;
import com.android.camera.R;
import com.android.camera.Util;
import com.android.camera.ui.GLListView.OnItemSelectedListener;
class BasicIndicator extends AbstractIndicator {
+ private static final float FONT_SIZE = 18;
+ private static final int FONT_COLOR = 0xA8FFFFFF;
private static final int COLOR_OPTION_ITEM_HIGHLIGHT = 0xFF181818;
private final ResourceTexture mIcon[];
- private final IconListPreference mPreference;
+ private final ListPreference mPreference;
protected int mIndex;
private GLListView mPopupContent;
private PreferenceAdapter mModel;
private String mOverride;
+ private int mTitleIndex;
+ private StringTexture mTitle;
+ private final float mFontSize;
+ private boolean mIsIconListMode;
- public BasicIndicator(Context context, IconListPreference preference) {
+ public BasicIndicator(Context context, ListPreference preference) {
super(context);
mPreference = preference;
- mIcon = new ResourceTexture[preference.getLargeIconIds().length];
mIndex = preference.findIndexOfValue(preference.getValue());
+ if (preference instanceof IconListPreference) {
+ mIsIconListMode = true;
+ mIcon = new ResourceTexture[((IconListPreference) preference).getLargeIconIds().length];
+ mFontSize = 0;
+ } else {
+ mIsIconListMode = false;
+ mIcon = null;
+ mFontSize = GLRootView.dpToPixel(context, FONT_SIZE);
+ mTitleIndex = -1;
+ }
}
// Set the override and/or reload the value from preferences.
private void updateContent(String override, boolean reloadValue) {
if (!reloadValue && Util.equals(mOverride, override)) return;
- IconListPreference pref = mPreference;
+ ListPreference pref = mPreference;
mOverride = override;
int index = pref.findIndexOfValue(
override == null ? pref.getValue() : override);
@@ -55,7 +71,7 @@ class BasicIndicator extends AbstractIndicator {
@Override
public void overrideSettings(String key, String settings) {
- IconListPreference pref = mPreference;
+ ListPreference pref = mPreference;
if (!pref.getKey().equals(key)) return;
updateContent(settings, false);
}
@@ -104,13 +120,23 @@ class BasicIndicator extends AbstractIndicator {
}
@Override
- protected ResourceTexture getIcon() {
- int index = mIndex;
- if (mIcon[index] == null) {
- Context context = getGLRootView().getContext();
- mIcon[index] = new ResourceTexture(
- context, mPreference.getLargeIconIds()[index]);
+ protected BitmapTexture getIcon() {
+ if (mIsIconListMode) {
+ int index = mIndex;
+ if (mIcon[index] == null) {
+ Context context = getGLRootView().getContext();
+ mIcon[index] = new ResourceTexture(
+ context, ((IconListPreference) mPreference).getLargeIconIds()[index]);
+ }
+ return mIcon[index];
+ } else {
+ if (mTitleIndex != mIndex) {
+ mTitleIndex = mIndex;
+ if (mTitle != null) mTitle.deleteFromGL();
+ String value = mPreference.getEntry();
+ mTitle = StringTexture.newInstance(value, mFontSize, FONT_COLOR);
+ }
+ return mTitle;
}
- return mIcon[index];
}
}