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

Commit 4666cbd5 authored by Mady Mellor's avatar Mady Mellor
Browse files

Fix showing gear behind notification when RTL language selected

Need to alter the translation to place the view when in RTL.

Bug: 27596418
parent 482c7da6
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ public class NotificationSettingsIconRow extends FrameLayout implements View.OnC
        mAnimating = false;
        mSnapping = false;
        mDismissing = false;
        setIconLocation(true /* on left */);
        setIconLocation(true /* on left */, true /* force */);
        if (mListener != null) {
            mListener.onSettingsIconRowReset(this);
        }
@@ -103,6 +103,7 @@ public class NotificationSettingsIconRow extends FrameLayout implements View.OnC

    public void setNotificationRowParent(ExpandableNotificationRow parent) {
        mParent = parent;
        setIconLocation(mOnLeft, true /* force */);
    }

    public ExpandableNotificationRow getNotificationParent() {
@@ -175,7 +176,7 @@ public class NotificationSettingsIconRow extends FrameLayout implements View.OnC
        if (isIconLocationChange(transX)) {
            setGearAlpha(0f);
        }
        setIconLocation(transX > 0 /* fromLeft */);
        setIconLocation(transX > 0 /* fromLeft */, false /* force */);
        mFadeAnimator = ValueAnimator.ofFloat(mGearIcon.getAlpha(), 1);
        mFadeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
@@ -212,12 +213,20 @@ public class NotificationSettingsIconRow extends FrameLayout implements View.OnC
        mFadeAnimator.start();
    }

    public void setIconLocation(boolean onLeft) {
        if (onLeft == mOnLeft || mSnapping) {
            // Same side? Do nothing.
    @Override
    public void onRtlPropertiesChanged(int layoutDirection) {
        setIconLocation(mOnLeft, true /* force */);
    }

    public void setIconLocation(boolean onLeft, boolean force) {
        if ((!force && onLeft == mOnLeft) || mSnapping || mParent == null) {
            // Do nothing
            return;
        }
        setTranslationX(onLeft ? 0 : (mParent.getWidth() - mHorizSpaceForGear));
        final boolean isRtl = mParent.isLayoutRtl();
        final float left = isRtl ? -(mParent.getWidth() - mHorizSpaceForGear) : 0;
        final float right = isRtl ? 0 : (mParent.getWidth() - mHorizSpaceForGear);
        setTranslationX(onLeft ? left : right);
        mOnLeft = onLeft;
    }

+2 −1
Original line number Diff line number Diff line
@@ -3471,7 +3471,8 @@ public class NotificationStackScrollLayout extends ViewGroup
                    } else {
                        // Check scheduled, reset alpha and update location; check will fade it in
                        mCurrIconRow.setGearAlpha(0f);
                        mCurrIconRow.setIconLocation(translation > 0 /* onLeft */);
                        mCurrIconRow.setIconLocation(translation > 0 /* onLeft */,
                                false /* force */);
                    }
                }
            }