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

Commit 036b5854 authored by Sreyas Rangaraju's avatar Sreyas Rangaraju Committed by Android (Google) Code Review
Browse files

Merge "Fix DWB cutting off above inset when translating down." into sc-dev

parents 8e16391b 25992f12
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public final class DigitalWellBeingToast {
    private ViewOutlineProvider mOldBannerOutlineProvider;
    private float mBannerOffsetPercentage;
    private float mBannerAlpha = 1f;
    private float mVerticalOffset = 0f;

    public DigitalWellBeingToast(BaseDraggingActivity activity, TaskView taskView) {
        mActivity = activity;
@@ -275,16 +276,17 @@ public final class DigitalWellBeingToast {
            @Override
            public void getOutline(View view, Outline outline) {
                mOldBannerOutlineProvider.getOutline(view, outline);
                outline.offset(0, -Math.round(view.getTranslationY()));
                outline.offset(0, Math.round(-view.getTranslationY() + mVerticalOffset));
            }
        });
        mBanner.setClipToOutline(true);
    }

    void updateBannerOffset(float offsetPercentage) {
    void updateBannerOffset(float offsetPercentage, float verticalOffset) {
        if (mBanner != null && mBannerOffsetPercentage != offsetPercentage) {
            mVerticalOffset = verticalOffset;
            mBannerOffsetPercentage = offsetPercentage;
            mBanner.setTranslationY(offsetPercentage * mBanner.getHeight());
            mBanner.setTranslationY(offsetPercentage * mBanner.getHeight() + mVerticalOffset);
            mBanner.invalidateOutline();
        }
    }
+6 −3
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.graphics.Outline;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
@@ -429,7 +428,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
            mContextualChip.setScaleX(comp(modalness));
            mContextualChip.setScaleY(comp(modalness));
        }
        mDigitalWellBeingToast.updateBannerOffset(modalness);
        mDigitalWellBeingToast.updateBannerOffset(modalness,
                mCurrentFullscreenParams.mCurrentDrawnInsets.top
                        + mCurrentFullscreenParams.mCurrentDrawnInsets.bottom);
    }

    public TaskMenuView getMenuView() {
@@ -666,7 +667,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
            mContextualChip.setScaleX(scale);
            mContextualChip.setScaleY(scale);
        }
        mDigitalWellBeingToast.updateBannerOffset(1f - scale);
        mDigitalWellBeingToast.updateBannerOffset(1f - scale,
                mCurrentFullscreenParams.mCurrentDrawnInsets.top
                        + mCurrentFullscreenParams.mCurrentDrawnInsets.bottom);
    }

    public void setIconScaleAnimStartProgress(float startProgress) {