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

Commit 48ea9e95 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Use appropriate start padding for clear all button

This still shows up a bit strange with
notched phones because we are using
RecentsView padding to give ClearAll the
right amount of spacing. However, we're only
adding padding to the left and right and not
the top/bottom.
That's captured here: b/154436527

Fixes: 150389833
Test: Tested landscape/portrait/seascape
launcher, w/ RTL as well

Change-Id: I49defd58048e609a1f7a821abb97374bcbb94b9f
parent 2f04a9d2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ public class ClearAllButton extends Button implements PageCallbacks {
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        mScrollOffset = mIsRtl ? mParent.getPaddingRight() / 2 : - mParent.getPaddingLeft() / 2;
        PagedOrientationHandler orientationHandler = mParent.getPagedOrientationHandler();
        mScrollOffset = orientationHandler.getClearAllScrollOffset(mParent, mIsRtl);
    }

    @Override
+5 −0
Original line number Diff line number Diff line
@@ -125,6 +125,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
        return rect.height();
    }

    @Override
    public int getClearAllScrollOffset(View view, boolean isRtl) {
        return (isRtl ? view.getPaddingBottom() : - view.getPaddingTop()) / 2;
    }

    @Override
    public int getSecondaryDimension(View view) {
        return view.getWidth();
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public interface PagedOrientationHandler {
    float getPrimaryVelocity(VelocityTracker velocityTracker, int pointerId);
    int getMeasuredSize(View view);
    float getPrimarySize(RectF rect);
    int getClearAllScrollOffset(View view, boolean isRtl);
    int getSecondaryDimension(View view);
    FloatProperty<View> getPrimaryViewTranslate();
    FloatProperty<View> getSecondaryViewTranslate();
+5 −0
Original line number Diff line number Diff line
@@ -122,6 +122,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
        return rect.width();
    }

    @Override
    public int getClearAllScrollOffset(View view, boolean isRtl) {
        return (isRtl ? view.getPaddingRight() : - view.getPaddingLeft()) / 2;
    }

    @Override
    public int getSecondaryDimension(View view) {
        return view.getHeight();
+11 −0
Original line number Diff line number Diff line
@@ -75,4 +75,15 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
    public float getTaskMenuY(float y, View thumbnailView) {
        return y + thumbnailView.getMeasuredHeight();
    }

    @Override
    public int getClearAllScrollOffset(View view, boolean isRtl) {
        return (isRtl ? view.getPaddingTop() : - view.getPaddingBottom()) / 2;
    }

    @Override
    public void setPrimaryAndResetSecondaryTranslate(View view, float translation) {
        view.setTranslationX(0);
        view.setTranslationY(-translation);
    }
}