diff options
Diffstat (limited to 'src/com/android/camera/ui/IndicatorControl.java')
-rw-r--r-- | src/com/android/camera/ui/IndicatorControl.java | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/src/com/android/camera/ui/IndicatorControl.java b/src/com/android/camera/ui/IndicatorControl.java index 814dc6d..66dcf55 100644 --- a/src/com/android/camera/ui/IndicatorControl.java +++ b/src/com/android/camera/ui/IndicatorControl.java @@ -32,8 +32,7 @@ import android.widget.RelativeLayout; import java.util.ArrayList; /** - * A view that contains camera setting indicators. The indicators are spreaded - * differently based on the screen resolution. + * A view that contains camera setting indicators. */ public abstract class IndicatorControl extends RelativeLayout implements IndicatorButton.Listener, OtherSettingsPopup.Listener { @@ -83,42 +82,39 @@ public abstract class IndicatorControl extends RelativeLayout implements public void initialize(Context context, PreferenceGroup group, String[] keys, String[] otherSettingKeys) { - // Reset the variables and states. - dismissSettingPopup(); - removeIndicators(); - // Initialize all variables and icons. mPreferenceGroup = group; - // Add other settings indicator. - if (otherSettingKeys != null) { - addOtherSettingIndicator(context, R.drawable.ic_settings_holo_light, otherSettingKeys); - } + addControls(keys, otherSettingKeys); + requestLayout(); + } - for (int i = 0; i < keys.length; i++) { - IconListPreference pref = (IconListPreference) group.findPreference(keys[i]); - if (pref != null) { - addIndicator(context, pref); + protected void addControls(String[] keys, String[] otherSettingKeys) { + if (keys != null) { + for (int i = 0; i < keys.length; i++) { + IconListPreference pref = + (IconListPreference) mPreferenceGroup.findPreference(keys[i]); + if (pref != null) { + addIndicator(mContext, pref); + } } } - requestLayout(); + + // Add other settings indicator. + if (otherSettingKeys != null) { + addOtherSettingIndicator(mContext, + R.drawable.ic_settings_holo_light, otherSettingKeys); + } } - public void initializeCameraPicker(Context context, PreferenceGroup group) { - ListPreference pref = group.findPreference( + protected void initializeCameraPicker() { + ListPreference pref = mPreferenceGroup.findPreference( CameraSettings.KEY_CAMERA_ID); - if ((pref == null) || (mCameraPicker != null)) return; - mCameraPicker = new CameraPicker(context); + if (pref == null) return; + mCameraPicker = new CameraPicker(mContext); mCameraPicker.initialize(pref); addView(mCameraPicker); } - private void removeIndicators() { - for (View v: mIndicators) { - removeView(v); - } - mIndicators.clear(); - } - @Override public boolean shouldDelayChildPressedState() { // Return false so the pressed feedback of the back/front camera switch |