Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -754,6 +754,7 @@ class QuickSettings { mBrightnessDialog.setCanceledOnTouchOutside(true); mBrightnessDialog.setCanceledOnTouchOutside(true); mBrightnessController = new BrightnessController(mContext, mBrightnessController = new BrightnessController(mContext, (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon), (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider)); (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider)); mBrightnessController.addStateChangedCallback(mModel); mBrightnessController.addStateChangedCallback(mModel); mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java +15 −1 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.provider.Settings.SettingNotFoundException; import android.util.Slog; import android.util.Slog; import android.view.IWindowManager; import android.view.IWindowManager; import android.widget.CompoundButton; import android.widget.CompoundButton; import android.widget.ImageView; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; Loading @@ -40,6 +41,7 @@ public class BrightnessController implements ToggleSlider.Listener { private final int mMaximumBacklight; private final int mMaximumBacklight; private final Context mContext; private final Context mContext; private final ImageView mIcon; private final ToggleSlider mControl; private final ToggleSlider mControl; private final boolean mAutomaticAvailable; private final boolean mAutomaticAvailable; private final IPowerManager mPower; private final IPowerManager mPower; Loading @@ -52,8 +54,9 @@ public class BrightnessController implements ToggleSlider.Listener { public void onBrightnessLevelChanged(); public void onBrightnessLevelChanged(); } } public BrightnessController(Context context, ToggleSlider control) { public BrightnessController(Context context, ImageView icon, ToggleSlider control) { mContext = context; mContext = context; mIcon = icon; mControl = control; mControl = control; mUserTracker = new CurrentUserTracker(mContext); mUserTracker = new CurrentUserTracker(mContext); Loading Loading @@ -84,8 +87,10 @@ public class BrightnessController implements ToggleSlider.Listener { automatic = 0; automatic = 0; } } control.setChecked(automatic != 0); control.setChecked(automatic != 0); updateIcon(automatic != 0); } else { } else { control.setChecked(false); control.setChecked(false); updateIcon(false /*automatic*/); //control.hideToggle(); //control.hideToggle(); } } Loading @@ -105,6 +110,7 @@ public class BrightnessController implements ToggleSlider.Listener { public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) { public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) { setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); updateIcon(automatic); if (!automatic) { if (!automatic) { final int val = value + mMinimumBacklight; final int val = value + mMinimumBacklight; setBrightness(val); setBrightness(val); Loading Loading @@ -136,4 +142,12 @@ public class BrightnessController implements ToggleSlider.Listener { } catch (RemoteException ex) { } 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); } } } } packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { }); }); mBrightness = new BrightnessController(context, mBrightness = new BrightnessController(context, (ImageView)findViewById(R.id.brightness_icon), (ToggleSlider)findViewById(R.id.brightness)); (ToggleSlider)findViewById(R.id.brightness)); mDoNotDisturb = new DoNotDisturbController(context, mDoNotDisturb = new DoNotDisturbController(context, (CompoundButton)findViewById(R.id.do_not_disturb_checkbox)); (CompoundButton)findViewById(R.id.do_not_disturb_checkbox)); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -754,6 +754,7 @@ class QuickSettings { mBrightnessDialog.setCanceledOnTouchOutside(true); mBrightnessDialog.setCanceledOnTouchOutside(true); mBrightnessController = new BrightnessController(mContext, mBrightnessController = new BrightnessController(mContext, (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon), (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider)); (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider)); mBrightnessController.addStateChangedCallback(mModel); mBrightnessController.addStateChangedCallback(mModel); mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java +15 −1 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.provider.Settings.SettingNotFoundException; import android.util.Slog; import android.util.Slog; import android.view.IWindowManager; import android.view.IWindowManager; import android.widget.CompoundButton; import android.widget.CompoundButton; import android.widget.ImageView; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; Loading @@ -40,6 +41,7 @@ public class BrightnessController implements ToggleSlider.Listener { private final int mMaximumBacklight; private final int mMaximumBacklight; private final Context mContext; private final Context mContext; private final ImageView mIcon; private final ToggleSlider mControl; private final ToggleSlider mControl; private final boolean mAutomaticAvailable; private final boolean mAutomaticAvailable; private final IPowerManager mPower; private final IPowerManager mPower; Loading @@ -52,8 +54,9 @@ public class BrightnessController implements ToggleSlider.Listener { public void onBrightnessLevelChanged(); public void onBrightnessLevelChanged(); } } public BrightnessController(Context context, ToggleSlider control) { public BrightnessController(Context context, ImageView icon, ToggleSlider control) { mContext = context; mContext = context; mIcon = icon; mControl = control; mControl = control; mUserTracker = new CurrentUserTracker(mContext); mUserTracker = new CurrentUserTracker(mContext); Loading Loading @@ -84,8 +87,10 @@ public class BrightnessController implements ToggleSlider.Listener { automatic = 0; automatic = 0; } } control.setChecked(automatic != 0); control.setChecked(automatic != 0); updateIcon(automatic != 0); } else { } else { control.setChecked(false); control.setChecked(false); updateIcon(false /*automatic*/); //control.hideToggle(); //control.hideToggle(); } } Loading @@ -105,6 +110,7 @@ public class BrightnessController implements ToggleSlider.Listener { public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) { public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) { setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); updateIcon(automatic); if (!automatic) { if (!automatic) { final int val = value + mMinimumBacklight; final int val = value + mMinimumBacklight; setBrightness(val); setBrightness(val); Loading Loading @@ -136,4 +142,12 @@ public class BrightnessController implements ToggleSlider.Listener { } catch (RemoteException ex) { } 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); } } } }
packages/SystemUI/src/com/android/systemui/statusbar/tablet/SettingsView.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class SettingsView extends LinearLayout implements View.OnClickListener { }); }); mBrightness = new BrightnessController(context, mBrightness = new BrightnessController(context, (ImageView)findViewById(R.id.brightness_icon), (ToggleSlider)findViewById(R.id.brightness)); (ToggleSlider)findViewById(R.id.brightness)); mDoNotDisturb = new DoNotDisturbController(context, mDoNotDisturb = new DoNotDisturbController(context, (CompoundButton)findViewById(R.id.do_not_disturb_checkbox)); (CompoundButton)findViewById(R.id.do_not_disturb_checkbox)); Loading