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

Commit 3b00d2f6 authored by Nikki Moteva's avatar Nikki Moteva
Browse files

Settings: Fix cut off brightness slider

The brightness slider gets cut off in multi-window and freeform window
because the top margin is too short. This change adds a padding for top
margin when in multi-window or freeform.

Bug: 389946114
Test: Manually test brightness slider in multi-window and freeform modes
Flag: EXEMPT bugfix
Change-Id: Id10c1ade9efe32f06bba3e33bec314f62009302b
parent 382e19e7
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.settings.brightness;

import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
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;
@@ -157,6 +159,7 @@ public class BrightnessDialog extends Activity {
    }

    void setBrightnessDialogViewAttributes(View container) {
        Configuration configuration = getResources().getConfiguration();
        // The brightness mirror container is INVISIBLE by default.
        container.setVisibility(View.VISIBLE);
        ViewGroup.MarginLayoutParams lp =
@@ -171,9 +174,16 @@ public class BrightnessDialog extends Activity {
                        R.dimen.notification_guts_option_vertical_padding);

        lp.topMargin = verticalMargin;
        // If in multi-window or freeform, increase the top margin so the brightness dialog
        // doesn't get cut off.
        final int windowingMode = configuration.windowConfiguration.getWindowingMode();
        if (windowingMode == WINDOWING_MODE_MULTI_WINDOW
                || windowingMode == WINDOWING_MODE_FREEFORM) {
            lp.topMargin += 50;
        }

        lp.bottomMargin = verticalMargin;

        Configuration configuration = getResources().getConfiguration();
        int orientation = configuration.orientation;
        int windowWidth = getWindowAvailableWidth();