Loading core/java/android/content/Intent.java +8 −0 Original line number Diff line number Diff line Loading @@ -4291,6 +4291,14 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_SHOW_BRIGHTNESS_DIALOG = "com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"; /** * Intent Extra: holds boolean that determines whether brightness dialog is full width when * in landscape mode. * @hide */ public static final String EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH = "android.intent.extra.BRIGHTNESS_DIALOG_IS_FULL_WIDTH"; /** * Activity Action: Shows the contrast setting dialog. * @hide Loading packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java +7 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.settings.brightness; import static android.content.Intent.EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.WindowManagerPolicyConstants.EXTRA_FROM_BRIGHTNESS_KEY; Loading Loading @@ -83,7 +84,7 @@ public class BrightnessDialog extends Activity { private void setWindowAttributes() { final Window window = getWindow(); window.setGravity(Gravity.TOP | Gravity.LEFT); window.setGravity(Gravity.TOP | Gravity.START); window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); window.requestFeature(Window.FEATURE_NO_TITLE); Loading Loading @@ -130,13 +131,14 @@ public class BrightnessDialog extends Activity { Configuration configuration = getResources().getConfiguration(); int orientation = configuration.orientation; int screenWidth = getWindowManager().getDefaultDisplay().getWidth(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { lp.width = getWindowManager().getDefaultDisplay().getWidth() / 2 - lp.leftMargin * 2; boolean shouldBeFullWidth = getIntent() .getBooleanExtra(EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH, false); lp.width = (shouldBeFullWidth ? screenWidth : screenWidth / 2) - horizontalMargin * 2; } else if (orientation == Configuration.ORIENTATION_PORTRAIT) { lp.width = getWindowManager().getDefaultDisplay().getWidth() - lp.leftMargin * 2; lp.width = screenWidth - horizontalMargin * 2; } frame.setLayoutParams(lp); Loading Loading
core/java/android/content/Intent.java +8 −0 Original line number Diff line number Diff line Loading @@ -4291,6 +4291,14 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_SHOW_BRIGHTNESS_DIALOG = "com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"; /** * Intent Extra: holds boolean that determines whether brightness dialog is full width when * in landscape mode. * @hide */ public static final String EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH = "android.intent.extra.BRIGHTNESS_DIALOG_IS_FULL_WIDTH"; /** * Activity Action: Shows the contrast setting dialog. * @hide Loading
packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java +7 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.settings.brightness; import static android.content.Intent.EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.WindowManagerPolicyConstants.EXTRA_FROM_BRIGHTNESS_KEY; Loading Loading @@ -83,7 +84,7 @@ public class BrightnessDialog extends Activity { private void setWindowAttributes() { final Window window = getWindow(); window.setGravity(Gravity.TOP | Gravity.LEFT); window.setGravity(Gravity.TOP | Gravity.START); window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); window.requestFeature(Window.FEATURE_NO_TITLE); Loading Loading @@ -130,13 +131,14 @@ public class BrightnessDialog extends Activity { Configuration configuration = getResources().getConfiguration(); int orientation = configuration.orientation; int screenWidth = getWindowManager().getDefaultDisplay().getWidth(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { lp.width = getWindowManager().getDefaultDisplay().getWidth() / 2 - lp.leftMargin * 2; boolean shouldBeFullWidth = getIntent() .getBooleanExtra(EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH, false); lp.width = (shouldBeFullWidth ? screenWidth : screenWidth / 2) - horizontalMargin * 2; } else if (orientation == Configuration.ORIENTATION_PORTRAIT) { lp.width = getWindowManager().getDefaultDisplay().getWidth() - lp.leftMargin * 2; lp.width = screenWidth - horizontalMargin * 2; } frame.setLayoutParams(lp); Loading