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

Commit c282209e authored by Joshua Mokut's avatar Joshua Mokut Committed by Android (Google) Code Review
Browse files

Merge "Updated brightness dialog width logic" into main

parents d5c5b8f6 ca0fa06d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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
+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);