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

Commit f00906cc authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Use window corner radius for desktop task snapshots" into udc-qpr-dev

parents 40a44e08 7313bc78
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.quickstep.util.CancellableTask;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.QuickStepContract;

import java.util.ArrayList;
import java.util.Arrays;
@@ -79,7 +80,7 @@ public class DesktopTaskView extends TaskView {

    private static final String TAG = DesktopTaskView.class.getSimpleName();

    private static final boolean DEBUG = true;
    private static final boolean DEBUG = false;

    @NonNull
    private List<Task> mTasks = new ArrayList<>();
@@ -91,6 +92,8 @@ public class DesktopTaskView extends TaskView {

    private final ArrayList<CancellableTask<?>> mPendingThumbnailRequests = new ArrayList<>();

    private final TaskView.FullscreenDrawParams mSnapshotDrawParams;

    private View mBackgroundView;

    public DesktopTaskView(Context context) {
@@ -103,6 +106,10 @@ public class DesktopTaskView extends TaskView {

    public DesktopTaskView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        mSnapshotDrawParams = new FullscreenDrawParams(
                QuickStepContract.getWindowCornerRadius(context),
                QuickStepContract.getWindowCornerRadius(context));
    }

    @Override
@@ -465,14 +472,20 @@ public class DesktopTaskView extends TaskView {
        for (int i = 0; i < mSnapshotViewMap.size(); i++) {
            TaskThumbnailView thumbnailView = mSnapshotViewMap.valueAt(i);
            thumbnailView.getTaskOverlay().setFullscreenProgress(progress);
            updateSnapshotRadius();
        }
        updateSnapshotRadius();
    }

    @Override
    protected void updateSnapshotRadius() {
        super.updateSnapshotRadius();
        for (int i = 0; i < mSnapshotViewMap.size(); i++) {
            mSnapshotViewMap.valueAt(i).setFullscreenParams(mCurrentFullscreenParams);
            if (i == 0) {
                // All snapshots share the same params. Only update it with the first snapshot.
                updateFullscreenParams(mSnapshotDrawParams,
                        mSnapshotView.getPreviewPositionHelper());
            }
            mSnapshotViewMap.valueAt(i).setFullscreenParams(mSnapshotDrawParams);
        }
    }

+11 −3
Original line number Diff line number Diff line
@@ -1707,10 +1707,15 @@ public class TaskView extends FrameLayout implements Reusable {
    }

    void updateCurrentFullscreenParams(PreviewPositionHelper previewPositionHelper) {
        updateFullscreenParams(mCurrentFullscreenParams, previewPositionHelper);
    }

    protected void updateFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams,
            PreviewPositionHelper previewPositionHelper) {
        if (getRecentsView() == null) {
            return;
        }
        mCurrentFullscreenParams.setProgress(mFullscreenProgress, getRecentsView().getScaleX(),
        fullscreenParams.setProgress(mFullscreenProgress, getRecentsView().getScaleX(),
                getScaleX(), getWidth(), mActivity.getDeviceProfile(), previewPositionHelper);
    }

@@ -1860,9 +1865,12 @@ public class TaskView extends FrameLayout implements Reusable {
        public float mCurrentDrawnCornerRadius;

        public FullscreenDrawParams(Context context) {
            mCornerRadius = TaskCornerRadius.get(context);
            mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context);
            this(TaskCornerRadius.get(context), QuickStepContract.getWindowCornerRadius(context));
        }

        FullscreenDrawParams(float cornerRadius, float windowCornerRadius) {
            mCornerRadius = cornerRadius;
            mWindowCornerRadius = windowCornerRadius;
            mCurrentDrawnCornerRadius = mCornerRadius;
        }