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

Commit 6e10058e authored by Alex Newcomer's avatar Alex Newcomer
Browse files

Refactor BrightnessDialog layout calculations

Simplifies the usage of the `margin` variable within the `setBrightnessDialogViewAttributes` method. Since this variable was always initialized to 0 and never modified, its use in width calculations and for setting gesture exclusion rectangle bounds was effectively a no-op.

Flag: EXEMPT - just a small refactor
Bug: None
Change-Id: I7d66c1ae27aa92e43b597ce2c78b95e18feb5091
parent 3802311a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -189,9 +189,9 @@ public class BrightnessDialog extends Activity {
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            boolean shouldBeFullWidth = getIntent()
                    .getBooleanExtra(EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH, false);
            lp.width = (shouldBeFullWidth ? windowWidth : windowWidth / 2) - margin * 2;
            lp.width = shouldBeFullWidth ? windowWidth : windowWidth / 2;
        } else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
            lp.width = windowWidth - margin * 2;
            lp.width = windowWidth;
        }

        container.setLayoutParams(lp);
@@ -201,7 +201,7 @@ public class BrightnessDialog extends Activity {
                    // Exclude this view (and its horizontal margins) from triggering gestures.
                    // This prevents back gesture from being triggered by dragging close to the
                    // edge of the slider (0% or 100%).
                    bounds.set(-margin, 0, right - left + margin, bottom - top);
                    bounds.set(0, 0, right - left, bottom - top);
                    v.setSystemGestureExclusionRects(List.of(bounds));
                });
    }