summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2012-10-12 15:24:36 -0400
committerJohn Spurlock <jspurlock@google.com>2012-10-12 15:24:36 -0400
commitf5bc42dbf881403820e6fcebbb2aa428849547dc (patch)
tree3033ec46578e478da85b9e37e3f39df58c7a0443 /packages
parent957b27f62b5dd439c71ab8e2c0e46313ea89d4e8 (diff)
downloadframeworks_base-f5bc42dbf881403820e6fcebbb2aa428849547dc.zip
frameworks_base-f5bc42dbf881403820e6fcebbb2aa428849547dc.tar.gz
frameworks_base-f5bc42dbf881403820e6fcebbb2aa428849547dc.tar.bz2
Keep QS brightness slider icon in sync.
It now reflects auto-on or auto-off as it changes. Bug:7303599 Change-Id: I1b1bd6a0545950795f83449c3778e91afa9d04a5
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java1
3 files changed, 17 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index 8c390c8..faf20e2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -754,6 +754,7 @@ class QuickSettings {
mBrightnessDialog.setCanceledOnTouchOutside(true);
mBrightnessController = new BrightnessController(mContext,
+ (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon),
(ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider));
mBrightnessController.addStateChangedCallback(mModel);
mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
index 0009503..e18b28a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
@@ -28,6 +28,7 @@ import android.provider.Settings.SettingNotFoundException;
import android.util.Slog;
import android.view.IWindowManager;
import android.widget.CompoundButton;
+import android.widget.ImageView;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
@@ -40,6 +41,7 @@ public class BrightnessController implements ToggleSlider.Listener {
private final int mMaximumBacklight;
private final Context mContext;
+ private final ImageView mIcon;
private final ToggleSlider mControl;
private final boolean mAutomaticAvailable;
private final IPowerManager mPower;
@@ -52,8 +54,9 @@ public class BrightnessController implements ToggleSlider.Listener {
public void onBrightnessLevelChanged();
}
- public BrightnessController(Context context, ToggleSlider control) {
+ public BrightnessController(Context context, ImageView icon, ToggleSlider control) {
mContext = context;
+ mIcon = icon;
mControl = control;
mUserTracker = new CurrentUserTracker(mContext);
@@ -84,8 +87,10 @@ public class BrightnessController implements ToggleSlider.Listener {
automatic = 0;
}
control.setChecked(automatic != 0);
+ updateIcon(automatic != 0);
} else {
control.setChecked(false);
+ updateIcon(false /*automatic*/);
//control.hideToggle();
}
@@ -105,6 +110,7 @@ public class BrightnessController implements ToggleSlider.Listener {
public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) {
setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
: Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ updateIcon(automatic);
if (!automatic) {
final int val = value + mMinimumBacklight;
setBrightness(val);
@@ -136,4 +142,12 @@ public class BrightnessController implements ToggleSlider.Listener {
} catch (RemoteException ex) {
}
}
+
+ private void updateIcon(boolean automatic) {
+ if (mIcon != null) {
+ mIcon.setImageResource(automatic ?
+ com.android.systemui.R.drawable.ic_qs_brightness_auto_on :
+ com.android.systemui.R.drawable.ic_qs_brightness_auto_off);
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
index 194f1f6..f71842e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java
@@ -78,6 +78,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener {
});
mBrightness = new BrightnessController(context,
+ (ImageView)findViewById(R.id.brightness_icon),
(ToggleSlider)findViewById(R.id.brightness));
mDoNotDisturb = new DoNotDisturbController(context,
(CompoundButton)findViewById(R.id.do_not_disturb_checkbox));