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

Commit 17d0080c authored by Andy Wickham's avatar Andy Wickham
Browse files

Adjusts Clear all to be vertically centered with the tasks.

I made a sample task where the content of the app was
centered, and I added lines to demonstrate the center
while in Overview. As you can see, the center of the
app content is slightly different from the TaskView
in Recents - it seems part of the bottom of the app
gets removed when transitioning to Recents (for the
rounded corner radius or nav bar?). On Pixel 4, I
had to add 46dp of padding to the bottom line for it
to appear at the bottom of the screenshot in Recents.

Screenshot: https://drive.google.com/file/d/1xzQNXWb0T0UGDhDS9Ov-AduM3nd-pfg8/view?usp=sharing
Before: https://drive.google.com/file/d/1ghN9VWP44XjcZkdmI106dy4_jB4Vs4J3/view?usp=sharing

Rotating between landscape and portrait:
https://drive.google.com/file/d/1OD5aKT9LCE5w950-6AaHfWXU4sLyW3Qe/view?usp=sharing

Fixes: 154964045
Change-Id: I594057e3b5df58c5a907b6ca14daa700d5011b7b
parent 60096e99
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -45,12 +45,15 @@ public class ClearAllButton extends Button implements PageCallbacks {
    private float mVisibilityAlpha = 1;

    private boolean mIsRtl;
    private final float mOriginalTranslationX, mOriginalTranslationY;

    private int mScrollOffset;

    public ClearAllButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        mIsRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
        mOriginalTranslationX = getTranslationX();
        mOriginalTranslationY = getTranslationY();
    }

    @Override
@@ -99,7 +102,8 @@ public class ClearAllButton extends Button implements PageCallbacks {

        float shift = Math.min(scrollState.scrollFromEdge, orientationSize);
        float translation = mIsRtl ? (mScrollOffset - shift) : (mScrollOffset + shift);
        orientationHandler.setPrimaryAndResetSecondaryTranslate(this, translation);
        orientationHandler.setPrimaryAndResetSecondaryTranslate(
                this, translation, mOriginalTranslationX, mOriginalTranslationY);
        mScrollAlpha = 1 - shift / orientationSize;
        updateAlpha();
    }
+1 −2
Original line number Diff line number Diff line
@@ -23,5 +23,4 @@
    android:text="@string/recents_clear_all"
    android:textColor="?attr/workspaceTextColor"
    android:textSize="14sp"
    android:translationY="@dimen/task_thumbnail_half_top_margin"
    />
 No newline at end of file
    android:translationY="@dimen/task_thumbnail_half_top_margin" />
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -148,8 +148,9 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    }

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

+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ public interface PagedOrientationHandler {
    int getSecondaryDimension(View view);
    FloatProperty<View> getPrimaryViewTranslate();
    FloatProperty<View> getSecondaryViewTranslate();
    void setPrimaryAndResetSecondaryTranslate(View view, float translation);
    void setPrimaryAndResetSecondaryTranslate(
            View view, float translation, float defaultTranslationX, float defaultTranslationY);
    int getPrimaryScroll(View view);
    float getPrimaryScale(View view);
    int getChildStart(View view);
+3 −2
Original line number Diff line number Diff line
@@ -145,9 +145,10 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
    }

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

    @Override
Loading