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

Unverified Commit 6ba2fc84 authored by Arian's avatar Arian Committed by Michael Bestas
Browse files

VolumeDialogImpl: Set touchable region properly for left gravity

Change-Id: I025ae38963d7ca929e01cec26c209d86718ce0e7
parent b1a8b166
Loading
Loading
Loading
Loading
+19 −10
Original line number Original line Diff line number Diff line
@@ -462,8 +462,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        final int[] locInWindow = new int[2];
        final int[] locInWindow = new int[2];
        view.getLocationInWindow(locInWindow);
        view.getLocationInWindow(locInWindow);


        float x = locInWindow[0];
        float xExtraSize = 0;
        float y = locInWindow[1];
        float yExtraSize = 0;


        // The ringer and rows container has extra height at the top to fit the expanded ringer
        // The ringer and rows container has extra height at the top to fit the expanded ringer
        // drawer. This area should not be touchable unless the ringer drawer is open.
        // drawer. This area should not be touchable unless the ringer drawer is open.
@@ -471,19 +471,28 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        // are multiple rows they are touchable.
        // are multiple rows they are touchable.
        if (view == mTopContainer && !mIsRingerDrawerOpen) {
        if (view == mTopContainer && !mIsRingerDrawerOpen) {
            if (!isLandscape()) {
            if (!isLandscape()) {
                y += getRingerDrawerOpenExtraSize();
                yExtraSize = getRingerDrawerOpenExtraSize();
            } else if (getRingerDrawerOpenExtraSize() > getVisibleRowsExtraSize()) {
            } else if (getRingerDrawerOpenExtraSize() > getVisibleRowsExtraSize()) {
                x += (getRingerDrawerOpenExtraSize() - getVisibleRowsExtraSize());
                xExtraSize = (getRingerDrawerOpenExtraSize() - getVisibleRowsExtraSize());
            }
            }
        }
        }


        if (isWindowGravityLeft()) {
            mTouchableRegion.op(
                    locInWindow[0],
                    locInWindow[1] + (int) yExtraSize,
                    locInWindow[0] + view.getWidth() - (int) xExtraSize,
                    locInWindow[1] + view.getHeight(),
                    Region.Op.UNION);
        } else {
            mTouchableRegion.op(
            mTouchableRegion.op(
                (int) x,
                    locInWindow[0] + (int) xExtraSize,
                (int) y,
                    locInWindow[1] + (int) yExtraSize,
                    locInWindow[0] + view.getWidth(),
                    locInWindow[0] + view.getWidth(),
                    locInWindow[1] + view.getHeight(),
                    locInWindow[1] + view.getHeight(),
                    Region.Op.UNION);
                    Region.Op.UNION);
        }
        }
    }


    // Helper to set gravity.
    // Helper to set gravity.
    private void setGravity(ViewGroup viewGroup, int gravity) {
    private void setGravity(ViewGroup viewGroup, int gravity) {