diff options
author | Steve Kondik <shade@chemlab.org> | 2012-06-14 09:57:33 +0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-06-14 09:57:33 +0400 |
commit | 8e5a6d0ba382c6ab265fe7a4b61596f00d1da6ce (patch) | |
tree | 809de51d45db224eb68c6a739faf02bdd51dedd7 /packages | |
parent | 4ccca1f800ca8f38051d5e8144d80a9f6bfc5cdc (diff) | |
parent | 2110da5e778dc7e394103a30d490bc9ce677b83b (diff) | |
download | frameworks_base-8e5a6d0ba382c6ab265fe7a4b61596f00d1da6ce.zip frameworks_base-8e5a6d0ba382c6ab265fe7a4b61596f00d1da6ce.tar.gz frameworks_base-8e5a6d0ba382c6ab265fe7a4b61596f00d1da6ce.tar.bz2 |
Merge "Status Bar Brightness Control Padding" into ics
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 8708104..e2ae054 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -125,6 +125,8 @@ public class PhoneStatusBar extends StatusBar { private static final boolean CLOSE_PANEL_WHEN_EMPTIED = true; + private static final float BRIGHTNESS_CONTROL_PADDING = 0.15f; + private boolean mShowClock; private boolean mBrightnessControl; private boolean mAutoBrightness; @@ -1594,7 +1596,16 @@ public class PhoneStatusBar extends StatusBar { if (yVel < 50.0f) { if (mLinger > 20) { float x = (float) event.getRawX(); - int newBrightness = (int) Math.round(((x / mScreenWidth) * android.os.Power.BRIGHTNESS_ON)); + float raw = (x / mScreenWidth); + + // Add a padding to the brightness control on both sides to make it easier + // to reach min/max brightness + float padded = Math.min(1.0f - BRIGHTNESS_CONTROL_PADDING, Math.max(BRIGHTNESS_CONTROL_PADDING, raw)); + float value = (padded - BRIGHTNESS_CONTROL_PADDING) / (1 - (2.0f * BRIGHTNESS_CONTROL_PADDING)); + + int newBrightness = mMinBrightness + (int) Math.round(value * + (android.os.Power.BRIGHTNESS_ON - mMinBrightness)); + newBrightness = Math.min(newBrightness, android.os.Power.BRIGHTNESS_ON); newBrightness = Math.max(newBrightness, mMinBrightness); try { |