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

Commit d90e9176 authored by dongwan0605.kim's avatar dongwan0605.kim Committed by Michael W
Browse files

Fix gear not showing when rotation or RTL changed

When rotation or RTL changed, gear button's translationX should be
updated to new position.

Test: (Rotation) Swipe notification to left > Gear is showing on the
right > Rotate the device > Gear button should be visible
Test: (RTL) Swipe notification to left > Set RTL language
> Swipe notification to right in RTL configuration
> Gear button should be visible

Change-Id: I04a657d380b746b30585ff8159b7a9b4865f423a
parent 4bb727ff
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -238,14 +238,28 @@ public class NotificationSettingsIconRow extends FrameLayout implements View.OnC
        }
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        if (mIconPlaced) {
            setIconLocation(mOnLeft, true /* force */);
        }
    }

    @Override
    public void onRtlPropertiesChanged(int layoutDirection) {
        setIconLocation(mOnLeft);
        if (mIconPlaced) {
            setIconLocation(mOnLeft, true /* force */);
        }
    }

    public void setIconLocation(boolean onLeft) {
        if ((mIconPlaced && onLeft == mOnLeft) || mSnapping || mParent == null
                || mGearIcon.getWidth() == 0) {
        setIconLocation(onLeft, false /* force */);
    }

    private void setIconLocation(boolean onLeft, boolean force) {
        if (mParent == null || mGearIcon.getWidth() == 0
                || (!force && ((mIconPlaced && onLeft == mOnLeft) || mSnapping))) {
            // Do nothing
            return;
        }