Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca0fa06d authored by Joshua Mokut's avatar Joshua Mokut Committed by Josh
Browse files

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
parent 07537696
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4266,6 +4266,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
+7 −5
Original line number Diff line number Diff line
@@ -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);