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

Commit 25992f12 authored by Sreyas's avatar Sreyas
Browse files

Fix DWB cutting off above inset when translating down.

Bug: 180979788
Test: Manual
Change-Id: I08577db4149b339fa217cab6401250a3fca10e65
parent 1408c645
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) {