diff options
| author | 2023-10-18 09:20:05 +0100 | |
|---|---|---|
| committer | 2023-10-20 10:09:28 +0000 | |
| commit | ca0fa06df6276c821fde3496b9345df62776d38a (patch) | |
| tree | 5a4d01c757f351fa7a84616a88eb4a1d2b1efb07 | |
| parent | 0753769659674786b0c0fdfa4e2b9aa31dac1310 (diff) | |
Updated brightness dialog width logic
The new default width for brightness slider UI when in
landscape mode is half width. However for settings we want full width. Hence now settings
will also send a boolean along with the Intent to start brightness
dialog activity, specifying that the width of the brightness dialog
should be full width.
Test: open settings->display. click or press "Brightness Level" and
check that the brightness slider UI takes the full width of the right
hand pane of settings
Fixes: 303633970
Change-Id: I82d0c33e533bd366d68d8dcba9c9e741144481ac
| -rw-r--r-- | core/java/android/content/Intent.java | 8 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 44a9acd6ba2f..b90a0e84ed7a 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -4267,6 +4267,14 @@ public class Intent implements Parcelable, Cloneable { "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 */ diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java index 1ecb127f0c92..ead10d6da860 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java +++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java @@ -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; @@ -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); @@ -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); |