summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2011-08-26 23:23:53 +0800
committerChung-yih Wang <cywang@google.com>2011-09-06 12:37:43 +0800
commita8b55a9628fa7c073d4f9c97c9a198275194f76a (patch)
tree0e8d8273b71a813833af74c7f4da9043a4839127 /src/com/android/camera
parentfc404e9a87e2f7e1fa9bc0ede998ed9cf75a047d (diff)
downloadLegacyCamera-a8b55a9628fa7c073d4f9c97c9a198275194f76a.zip
LegacyCamera-a8b55a9628fa7c073d4f9c97c9a198275194f76a.tar.gz
LegacyCamera-a8b55a9628fa7c073d4f9c97c9a198275194f76a.tar.bz2
Refactor the overflow menu for new UI.
bug:5039364 +Use Switch widget for the 'Store location' preference. Change-Id: I031cef58ab60d62d04431d7bfe742da672899deb
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--src/com/android/camera/ui/InLineSettingItem.java92
-rw-r--r--src/com/android/camera/ui/InLineSettingKnob.java123
-rw-r--r--src/com/android/camera/ui/InLineSettingPicker.java173
-rw-r--r--src/com/android/camera/ui/InLineSettingRestore.java40
-rw-r--r--src/com/android/camera/ui/InLineSettingSwitch.java58
-rw-r--r--src/com/android/camera/ui/OtherSettingsPopup.java105
6 files changed, 357 insertions, 234 deletions
diff --git a/src/com/android/camera/ui/InLineSettingItem.java b/src/com/android/camera/ui/InLineSettingItem.java
new file mode 100644
index 0000000..a9b8574
--- /dev/null
+++ b/src/com/android/camera/ui/InLineSettingItem.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.ui;
+
+import com.android.camera.R;
+import com.android.camera.ListPreference;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+/**
+ * A one-line camera setting could be one of three types: knob, switch or restore
+ * preference button. The setting includes a title for showing the preference
+ * title which is initialized in the SimpleAdapter. A knob also includes
+ * (ex: Picture size), a previous button, the current value (ex: 5MP),
+ * and a next button. A switch, i.e. the preference RecordLocationPreference,
+ * has only two values on and off which will be controlled in a switch button.
+ * Other setting popup window includes several InLineSettingItem items with
+ * different types if possible.
+ */
+public abstract class InLineSettingItem extends LinearLayout {
+ protected Context mContext;
+ private Listener mListener;
+ protected ListPreference mPreference;
+ protected int mIndex;
+ // Scene mode can override the original preference value.
+ protected String mOverrideValue;
+
+ static public interface Listener {
+ public void onSettingChanged();
+ }
+
+ public InLineSettingItem(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ }
+
+ protected void setTitle(ListPreference preference) {
+ ((TextView) findViewById(R.id.title)).setText(preference.getTitle());
+ }
+
+ public void initialize(ListPreference preference) {
+ setTitle(preference);
+ if (preference == null) return;
+ mPreference = preference;
+ reloadPreference();
+ }
+
+ protected abstract void updateView();
+
+ protected boolean changeIndex(int index) {
+ mIndex = index;
+ mPreference.setValueIndex(mIndex);
+ if (mListener != null) {
+ mListener.onSettingChanged();
+ }
+ updateView();
+ return true;
+ }
+
+ // The value of the preference may have changed. Update the UI.
+ public void reloadPreference() {
+ mIndex = mPreference.findIndexOfValue(mPreference.getValue());
+ updateView();
+ }
+
+ public void setSettingChangedListener(Listener listener) {
+ mListener = listener;
+ }
+
+ public void overrideSettings(String value) {
+ mOverrideValue = value;
+ updateView();
+ }
+}
diff --git a/src/com/android/camera/ui/InLineSettingKnob.java b/src/com/android/camera/ui/InLineSettingKnob.java
new file mode 100644
index 0000000..9bb771c
--- /dev/null
+++ b/src/com/android/camera/ui/InLineSettingKnob.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.ui;
+
+import com.android.camera.R;
+
+import android.content.Context;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnTouchListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+/* A knob setting control. */
+public class InLineSettingKnob extends InLineSettingItem {
+ private final String TAG = "InLineSettingKnob";
+ private boolean mNext, mPrevious;
+ private Button mPrevButton, mNextButton;
+ private Handler mHandler;
+ // The view that shows the current selected setting. Ex: 5MP
+ private TextView mEntry;
+
+ private final Runnable mRunnable = new Runnable() {
+ public void run() {
+ if (mNext) {
+ if (changeIndex(mIndex - 1)) {
+ mHandler.postDelayed(this, 100);
+ }
+ } else if (mPrevious) {
+ if (changeIndex(mIndex + 1)) {
+ mHandler.postDelayed(this, 100);
+ }
+ }
+ }
+ };
+
+ public InLineSettingKnob(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mHandler = new Handler();
+ }
+
+ OnTouchListener mNextTouchListener = new OnTouchListener() {
+ public boolean onTouch(View v, MotionEvent event) {
+ if (mOverrideValue != null) return true;
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ if (!mNext && changeIndex(mIndex - 1)) {
+ mNext = true;
+ // Give bigger delay so users can change only one step.
+ mHandler.postDelayed(mRunnable, 300);
+ }
+ } else if (event.getAction() == MotionEvent.ACTION_UP
+ || event.getAction() == MotionEvent.ACTION_CANCEL) {
+ mNext = false;
+ }
+ return false;
+ }
+ };
+
+ OnTouchListener mPreviousTouchListener = new OnTouchListener() {
+ public boolean onTouch(View v, MotionEvent event) {
+ if (mOverrideValue != null) return true;
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ if (!mPrevious && changeIndex(mIndex + 1)) {
+ mPrevious = true;
+ // Give bigger delay so users can change only one step.
+ mHandler.postDelayed(mRunnable, 300);
+ }
+ } else if (event.getAction() == MotionEvent.ACTION_UP
+ || event.getAction() == MotionEvent.ACTION_CANCEL) {
+ mPrevious = false;
+ }
+ return false;
+ }
+ };
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mNextButton = (Button) findViewById(R.id.increment);
+ mNextButton.setOnTouchListener(mNextTouchListener);
+ mPrevButton = (Button) findViewById(R.id.decrement);
+ mPrevButton.setOnTouchListener(mPreviousTouchListener);
+ mEntry = (TextView) findViewById(R.id.current_setting);
+ }
+
+ protected void updateView() {
+ if (mOverrideValue == null) {
+ mEntry.setText(mPreference.getEntry());
+ mNextButton.setVisibility(mIndex == 0 ? View.INVISIBLE : View.VISIBLE);
+ mPrevButton.setVisibility(mIndex == mPreference.getEntryValues().length - 1
+ ? View.INVISIBLE : View.VISIBLE);
+ } else {
+ int index = mPreference.findIndexOfValue(mOverrideValue);
+ if (index != -1) {
+ mEntry.setText(mPreference.getEntries()[index]);
+ } else {
+ // Avoid the crash if camera driver has bugs.
+ Log.e(TAG, "Fail to find override value=" + mOverrideValue);
+ mPreference.print();
+ }
+ mNextButton.setVisibility(View.INVISIBLE);
+ mPrevButton.setVisibility(View.INVISIBLE);
+ }
+ }
+
+}
diff --git a/src/com/android/camera/ui/InLineSettingPicker.java b/src/com/android/camera/ui/InLineSettingPicker.java
deleted file mode 100644
index 846686c..0000000
--- a/src/com/android/camera/ui/InLineSettingPicker.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.camera.ui;
-
-import android.content.Context;
-import android.os.Handler;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnTouchListener;
-import android.widget.Button;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.android.camera.R;
-import com.android.camera.ListPreference;
-
-
-/* A one-line camera setting that includes a title (ex: Picture size), a
- previous button, the current value (ex: 5MP), and a next button. Other
- setting popup window includes several InLineSettingPicker. */
-public class InLineSettingPicker extends RelativeLayout {
- private final String TAG = "InLineSettingPicker";
- // The view that shows the name of the setting. Ex: Picture size
- private TextView mTitle;
- // The view that shows the current selected setting. Ex: 5MP
- private TextView mEntry;
- private Button mPrevButton, mNextButton;
- private ListPreference mPreference;
- private boolean mNext, mPrevious;
- private int mIndex;
- private String mKey;
- private Listener mListener;
- // Scene mode can override the original preference value.
- private String mOverrideValue;
-
- static public interface Listener {
- public void onSettingChanged();
- }
-
- private Handler mHandler;
- private final Runnable mRunnable = new Runnable() {
- public void run() {
- if (mNext) {
- if (changeIndex(mIndex - 1)) {
- mHandler.postDelayed(this, 100);
- }
- } else if (mPrevious) {
- if (changeIndex(mIndex + 1)) {
- mHandler.postDelayed(this, 100);
- }
- }
- }
- };
-
- public InLineSettingPicker(Context context, AttributeSet attrs) {
- super(context, attrs);
- mHandler = new Handler();
- }
-
- @Override
- public void onFinishInflate() {
- super.onFinishInflate();
- OnTouchListener nextTouchListener = new OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) {
- if (mOverrideValue != null) return true;
-
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- if (!mNext && changeIndex(mIndex - 1)) {
- mNext = true;
- // Give bigger delay so users can change only one step.
- mHandler.postDelayed(mRunnable, 300);
- }
- } else if (event.getAction() == MotionEvent.ACTION_UP
- || event.getAction() == MotionEvent.ACTION_CANCEL) {
- mNext = false;
- }
- return false;
- }
- };
-
- OnTouchListener previousTouchListener = new OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) {
- if (mOverrideValue != null) return true;
-
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- if (!mPrevious && changeIndex(mIndex + 1)) {
- mPrevious = true;
- // Give bigger delay so users can change only one step.
- mHandler.postDelayed(mRunnable, 300);
- }
- } else if (event.getAction() == MotionEvent.ACTION_UP
- || event.getAction() == MotionEvent.ACTION_CANCEL) {
- mPrevious = false;
- }
- return false;
- }
- };
-
- mNextButton = (Button) findViewById(R.id.increment);
- mNextButton.setOnTouchListener(nextTouchListener);
- mPrevButton = (Button) findViewById(R.id.decrement);
- mPrevButton.setOnTouchListener(previousTouchListener);
- mEntry = (TextView) findViewById(R.id.current_setting);
- mTitle = (TextView) findViewById(R.id.title);
- }
-
- public void initialize(ListPreference preference) {
- mPreference = preference;
- reloadPreference();
- }
-
- // The value of the preference may have changed. Update the UI.
- public void reloadPreference() {
- mIndex = mPreference.findIndexOfValue(mPreference.getValue());
- updateView();
- }
-
- private boolean changeIndex(int index) {
- if (index >= mPreference.getEntryValues().length || index < 0) return false;
- mIndex = index;
- mPreference.setValueIndex(mIndex);
- if (mListener != null) {
- mListener.onSettingChanged();
- }
- updateView();
- return true;
- }
-
- private void updateView() {
- if (mOverrideValue == null) {
- mEntry.setText(mPreference.getEntry());
- mNextButton.setVisibility(mIndex == 0 ? View.INVISIBLE : View.VISIBLE);
- mPrevButton.setVisibility(mIndex == mPreference.getEntryValues().length - 1
- ? View.INVISIBLE : View.VISIBLE);
- } else {
- int index = mPreference.findIndexOfValue(mOverrideValue);
- if (index != -1) {
- mEntry.setText(mPreference.getEntries()[index]);
- } else {
- // Avoid the crash if camera driver has bugs.
- Log.e(TAG, "Fail to find override value=" + mOverrideValue);
- mPreference.print();
- }
- mNextButton.setVisibility(View.INVISIBLE);
- mPrevButton.setVisibility(View.INVISIBLE);
- }
- }
-
- public void setSettingChangedListener(Listener listener) {
- mListener = listener;
- }
-
- public void overrideSettings(String value) {
- mOverrideValue = value;
- updateView();
- }
-}
diff --git a/src/com/android/camera/ui/InLineSettingRestore.java b/src/com/android/camera/ui/InLineSettingRestore.java
new file mode 100644
index 0000000..daba811
--- /dev/null
+++ b/src/com/android/camera/ui/InLineSettingRestore.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.ui;
+
+import com.android.camera.R;
+import com.android.camera.ListPreference;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.TextView;
+
+/* A restore setting is simply showing the restore title. */
+public class InLineSettingRestore extends InLineSettingItem {
+
+ public InLineSettingRestore(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void setTitle(ListPreference preference) {
+ ((TextView) findViewById(R.id.title)).setText(
+ mContext.getString(R.string.pref_restore_detail));
+ }
+
+ protected void updateView() { }
+}
diff --git a/src/com/android/camera/ui/InLineSettingSwitch.java b/src/com/android/camera/ui/InLineSettingSwitch.java
new file mode 100644
index 0000000..8663a05
--- /dev/null
+++ b/src/com/android/camera/ui/InLineSettingSwitch.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.ui;
+
+import com.android.camera.R;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.Switch;
+
+/* A switch setting control which turns on/off the setting. */
+public class InLineSettingSwitch extends InLineSettingItem {
+ private Switch mSwitch;
+
+ OnCheckedChangeListener mCheckedChangeListener = new OnCheckedChangeListener() {
+ public void onCheckedChanged(CompoundButton buttonView, boolean desiredState) {
+ changeIndex(desiredState ? 1 : 0);
+ }
+ };
+
+ public InLineSettingSwitch(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mSwitch = (Switch) findViewById(R.id.setting_switch);
+ mSwitch.setOnCheckedChangeListener(mCheckedChangeListener);
+ }
+
+ protected void updateView() {
+ if (mOverrideValue == null) {
+ mSwitch.setChecked(mIndex == 1);
+ } else {
+ int index = mPreference.findIndexOfValue(mOverrideValue);
+ mSwitch.setChecked(index == 1);
+ }
+ }
+}
diff --git a/src/com/android/camera/ui/OtherSettingsPopup.java b/src/com/android/camera/ui/OtherSettingsPopup.java
index 7e4bedb..1357012 100644
--- a/src/com/android/camera/ui/OtherSettingsPopup.java
+++ b/src/com/android/camera/ui/OtherSettingsPopup.java
@@ -16,77 +16,72 @@
package com.android.camera.ui;
+import com.android.camera.CameraSettings;
import com.android.camera.ListPreference;
import com.android.camera.PreferenceGroup;
import com.android.camera.R;
+import com.android.camera.RecordLocationPreference;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
+import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
-import android.widget.SimpleAdapter;
-import android.widget.TextView;
+import android.widget.ArrayAdapter;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/* A popup window that contains several camera settings. */
public class OtherSettingsPopup extends AbstractSettingPopup
- implements InLineSettingPicker.Listener,
+ implements InLineSettingItem.Listener,
AdapterView.OnItemClickListener {
private static final String TAG = "OtherSettingsPopup";
- private static final String ITEM_KEY = "key";
- private static final String ITEM_TITLE = "text";
- private static final String ITEM_VALUE = "value";
- private static final String ITEM_RESTORE = "reset";
private Context mContext;
private Listener mListener;
- private ArrayList<HashMap<String, Object>> mListItem =
- new ArrayList<HashMap<String, Object>>();
+ private ArrayList<ListPreference> mListItem = new ArrayList<ListPreference>();
static public interface Listener {
public void onSettingChanged();
public void onRestorePreferencesClicked();
}
- private class OtherSettingsAdapter extends SimpleAdapter {
+ private class OtherSettingsAdapter extends ArrayAdapter {
+ LayoutInflater mInflater;
- OtherSettingsAdapter(Context context,
- List<? extends Map<String, ?>> data,
- int resource, String[] from, int[] to) {
- super(context, data, resource, from, to);
+ OtherSettingsAdapter() {
+ super(mContext, 0, mListItem);
+ mInflater = LayoutInflater.from(mContext);
+ }
+
+ private int getSettingLayoutId(ListPreference pref) {
+ // If the preference is null, it will be the only item , i.e.
+ // 'Restore setting' in the popup window.
+ if (pref == null) return R.layout.in_line_setting_restore;
+
+ // Currently, the RecordLocationPreference is the only setting
+ // which applies the on/off switch.
+ if (CameraSettings.KEY_RECORD_LOCATION.equals(pref.getKey())) {
+ return R.layout.in_line_setting_switch;
+ }
+ return R.layout.in_line_setting_knob;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView != null) return convertView;
- InLineSettingPicker view = (InLineSettingPicker)
- super.getView(position, convertView, parent);
- TextView restoreSettings =
- (TextView) view.findViewById(R.id.restore);
- View settingItem = view.findViewById(R.id.setting_item);
-
- // We apply the same View(InLineSettingPicker) as the listview's
- // components. To show the restore setting line, we control the
- // visibilities of components in InLineSettingPicker.
- boolean isRestoreItem = (position == mListItem.size() - 1);
- settingItem.setVisibility(
- isRestoreItem ? View.GONE : View.VISIBLE);
- restoreSettings.setVisibility(
- isRestoreItem ? View.VISIBLE : View.GONE);
-
- if (!isRestoreItem) {
- HashMap map = (HashMap) mListItem.get(position);
- ListPreference pref = (ListPreference) map.get(ITEM_KEY);
- view.initialize(pref);
- view.setSettingChangedListener(OtherSettingsPopup.this);
- }
+ ListPreference pref = mListItem.get(position);
+
+ int viewLayoutId = getSettingLayoutId(pref);
+ InLineSettingItem view = (InLineSettingItem)
+ mInflater.inflate(viewLayoutId, parent, false);
+
+ view.initialize(pref); // no init for restore one
+ view.setSettingChangedListener(OtherSettingsPopup.this);
return view;
}
}
@@ -103,26 +98,14 @@ public class OtherSettingsPopup extends AbstractSettingPopup
public void initialize(PreferenceGroup group, String[] keys) {
// Prepare the setting items.
for (int i = 0; i < keys.length; ++i) {
- HashMap<String, Object> map = new HashMap<String, Object>();
ListPreference pref = group.findPreference(keys[i]);
- if (pref != null) {
- map.put(ITEM_KEY, pref);
- map.put(ITEM_TITLE, pref.getTitle());
- map.put(ITEM_VALUE, pref.getEntry());
- mListItem.add(map);
- }
+ if (pref != null) mListItem.add(pref);
}
// Prepare the restore setting line.
- HashMap<String, Object> map = new HashMap<String, Object>();
- map.put(ITEM_RESTORE, mContext.getString(R.string.pref_restore_detail));
- mListItem.add(map);
-
- SimpleAdapter mListItemAdapter = new OtherSettingsAdapter(mContext,
- mListItem,
- R.layout.in_line_setting_picker,
- new String[] {ITEM_TITLE, ITEM_VALUE, ITEM_RESTORE},
- new int[] {R.id.title, R.id.current_setting, R.id.restore});
+ mListItem.add(null);
+
+ ArrayAdapter mListItemAdapter = new OtherSettingsAdapter();
((ListView) mSettingList).setAdapter(mListItemAdapter);
((ListView) mSettingList).setOnItemClickListener(this);
((ListView) mSettingList).setSelector(android.R.color.transparent);
@@ -142,11 +125,11 @@ public class OtherSettingsPopup extends AbstractSettingPopup
String key = keyvalues[i];
String value = keyvalues[i + 1];
for (int j = 0; j < count; j++) {
- ListPreference pref = (ListPreference) mListItem.get(j).get(ITEM_KEY);
+ ListPreference pref = (ListPreference) mListItem.get(j);
if (pref != null && key.equals(pref.getKey())) {
- InLineSettingPicker picker =
- (InLineSettingPicker) mSettingList.getChildAt(j);
- picker.overrideSettings(value);
+ InLineSettingItem settingItem =
+ (InLineSettingItem) mSettingList.getChildAt(j);
+ settingItem.overrideSettings(value);
}
}
}
@@ -164,11 +147,11 @@ public class OtherSettingsPopup extends AbstractSettingPopup
public void reloadPreference() {
int count = mSettingList.getChildCount();
for (int i = 0; i < count; i++) {
- ListPreference pref = (ListPreference) mListItem.get(i).get(ITEM_KEY);
+ ListPreference pref = (ListPreference) mListItem.get(i);
if (pref != null) {
- InLineSettingPicker picker =
- (InLineSettingPicker) mSettingList.getChildAt(i);
- picker.reloadPreference();
+ InLineSettingItem settingItem =
+ (InLineSettingItem) mSettingList.getChildAt(i);
+ settingItem.reloadPreference();
}
}
}