summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/settings
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-01-10 17:42:51 -0800
committerAdrian Roos <roosa@google.com>2014-01-14 16:12:33 -0800
commitd8ea484e2c7561a91b07773c83ffad42cfd459ee (patch)
tree7d5d8426cbee70654ec55c2c7af833eb49c035c4 /packages/SystemUI/src/com/android/systemui/settings
parent4a5eb8fe18337597ece6ca1cedbbb56a0b309c39 (diff)
downloadframeworks_base-d8ea484e2c7561a91b07773c83ffad42cfd459ee.zip
frameworks_base-d8ea484e2c7561a91b07773c83ffad42cfd459ee.tar.gz
frameworks_base-d8ea484e2c7561a91b07773c83ffad42cfd459ee.tar.bz2
Make brightness panel behave like volume panel.
Moves the brightness panel to the same spot as the volume panel. To avoid a conflict with the volume panel, brightness is dismissed when the volume keys are pressed. Bug: 7217009 Bug: 7217154 Change-Id: Ib8331a1e390cbedca40fa237243ea2cfd088e521
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/settings')
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java b/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
index ff79f04..bd5e5e8 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
@@ -21,6 +21,8 @@ import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
+import android.view.Gravity;
+import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
@@ -67,9 +69,15 @@ public class BrightnessDialog extends Dialog implements
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
- window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
- window.getAttributes().privateFlags |=
+ window.setGravity(Gravity.TOP);
+ WindowManager.LayoutParams lp = window.getAttributes();
+ // Offset from the top
+ lp.y = getContext().getResources().getDimensionPixelOffset(
+ com.android.internal.R.dimen.volume_panel_top);
+ lp.type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
+ lp.privateFlags |=
WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
+ window.setAttributes(lp);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.requestFeature(Window.FEATURE_NO_TITLE);
@@ -108,4 +116,13 @@ public class BrightnessDialog extends Dialog implements
mHandler.removeCallbacks(mDismissDialogRunnable);
}
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
+ keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
+ keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) {
+ dismiss();
+ }
+ return super.onKeyDown(keyCode, event);
+ }
}