diff options
author | Adrian Roos <roosa@google.com> | 2014-08-12 17:28:58 +0200 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-08-12 17:27:41 +0000 |
commit | 5fd872e8ea44ffcd4fce1d1196736dca4f270508 (patch) | |
tree | 88ddf296a41c3b3ee9d962f52f911c0907236a8c /packages/SystemUI/src/com/android/systemui/settings | |
parent | 14690b0aa380697179eb0432939a8ce96e6561f0 (diff) | |
download | frameworks_base-5fd872e8ea44ffcd4fce1d1196736dca4f270508.zip frameworks_base-5fd872e8ea44ffcd4fce1d1196736dca4f270508.tar.gz frameworks_base-5fd872e8ea44ffcd4fce1d1196736dca4f270508.tar.bz2 |
Hide panel while changing brightness
Bug: 15408618
Change-Id: Ic1f934f9ddbb582453b4b52a4b4402c71ac79654
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/settings')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java | 1 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java index 108c8df..2113c68 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java +++ b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java @@ -188,6 +188,7 @@ public class BrightnessController implements ToggleSlider.Listener { mListening = false; } + @Override public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) { updateIcon(mAutomatic); if (!mAutomatic) { diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java index 4b78072..acfeb4f 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java +++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java @@ -29,6 +29,7 @@ import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; import com.android.systemui.R; +import com.android.systemui.statusbar.policy.BrightnessMirrorController; public class ToggleSlider extends RelativeLayout { public interface Listener { @@ -43,6 +44,9 @@ public class ToggleSlider extends RelativeLayout { private SeekBar mSlider; private TextView mLabel; + private ToggleSlider mMirror; + private BrightnessMirrorController mMirrorController; + public ToggleSlider(Context context) { this(context, null); } @@ -72,6 +76,18 @@ public class ToggleSlider extends RelativeLayout { a.recycle(); } + public void setMirror(ToggleSlider toggleSlider) { + mMirror = toggleSlider; + if (mMirror != null) { + mMirror.mToggle.setChecked(mToggle.isChecked()); + mMirror.mSlider.setProgress(mSlider.getProgress()); + } + } + + public void setMirrorController(BrightnessMirrorController c) { + mMirrorController = c; + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -109,6 +125,10 @@ public class ToggleSlider extends RelativeLayout { mListener.onChanged( ToggleSlider.this, mTracking, checked, mSlider.getProgress()); } + + if (mMirror != null) { + mMirror.mToggle.setChecked(checked); + } } }; @@ -119,6 +139,10 @@ public class ToggleSlider extends RelativeLayout { mListener.onChanged( ToggleSlider.this, mTracking, mToggle.isChecked(), progress); } + + if (mMirror != null) { + mMirror.mSlider.setProgress(progress); + } } @Override @@ -131,6 +155,15 @@ public class ToggleSlider extends RelativeLayout { } mToggle.setChecked(false); + + if (mMirror != null) { + mMirror.mSlider.setPressed(true); + } + + if (mMirrorController != null) { + mMirrorController.showMirror(); + mMirrorController.setLocation((View) getParent()); + } } @Override @@ -141,6 +174,14 @@ public class ToggleSlider extends RelativeLayout { mListener.onChanged( ToggleSlider.this, mTracking, mToggle.isChecked(), mSlider.getProgress()); } + + if (mMirror != null) { + mMirror.mSlider.setPressed(false); + } + + if (mMirrorController != null) { + mMirrorController.hideMirror(); + } } }; } |