OSDN Git Service

Settings: fix a few color picker inconsistentcies
authorRoman Birg <roman@cyngn.com>
Thu, 30 Jul 2015 22:20:52 +0000 (15:20 -0700)
committerRicardo Cerqueira <ricardo@cyngn.com>
Thu, 28 Jan 2016 14:30:48 +0000 (14:30 +0000)
Don't assume we can pulse when calling setAllValues().

Don't display both on/off pulse values when it cannot pulse.

Default to Always on when we can't pulse.

Ref: CYNGNOS-403
Change-Id: Ie356cdc35cb545dd51896697f89ef265ada1147f
Signed-off-by: Roman Birg <roman@cyngn.com>
src/com/android/settings/notificationlight/ApplicationLightPreference.java

index 9feb050..a12f45b 100644 (file)
@@ -148,7 +148,7 @@ public class ApplicationLightPreference extends DialogPreference {
             mOnValueView.setText(mapLengthValue(mOnValue));
         }
         if (mOffValueView != null) {
-            if (mOnValue == 1) {
+            if (mOnValue == 1 || !mOnOffChangeable) {
                 mOffValueView.setVisibility(View.GONE);
             } else {
                 mOffValueView.setVisibility(View.VISIBLE);
@@ -226,7 +226,6 @@ public class ApplicationLightPreference extends DialogPreference {
         mColorValue = color;
         mOnValue = onValue;
         mOffValue = offValue;
-        mOnOffChangeable = true;
         updatePreferenceViews();
     }
 
@@ -260,6 +259,9 @@ public class ApplicationLightPreference extends DialogPreference {
     }
 
     private String mapLengthValue(Integer time) {
+        if (!mOnOffChangeable) {
+            return getContext().getString(R.string.pulse_length_always_on);
+        }
         if (time == DEFAULT_TIME) {
             return getContext().getString(R.string.default_time);
         }