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

Commit 97ef7f00 authored by Pat Manning's avatar Pat Manning
Browse files

Refresh thumbnail splash when task icon changes.

This is usually a result of TaskIconCache updating in the background.

Fix: 267744363
Test: manual.
Change-Id: I83620f3774def7ffb07906a6d45b64e9aad6de71
parent c3cb117b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -355,6 +355,12 @@ public class GroupedTaskView extends TaskView {
        mSnapshotView2.setSplashAlpha(mTaskThumbnailSplashAlpha);
    }

    @Override
    protected void refreshTaskThumbnailSplash() {
        super.refreshTaskThumbnailSplash();
        mSnapshotView2.refreshSplashView();
    }

    /**
     *     Sets visibility for thumbnails and associated elements (DWB banners).
     *     IconView is unaffected.
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher

    @Override
    public void onTaskIconChanged(int taskId) {
        super.onTaskIconChanged(taskId);
        // If Launcher needs to return to split select state, do it now, after the icon has updated.
        if (mActivity.hasPendingSplitSelectInfo()) {
            PendingSplitSelectInfo recoveryData = mActivity.getPendingSplitSelectInfo();
+8 −0
Original line number Diff line number Diff line
@@ -954,6 +954,14 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        }
    }

    @Override
    public void onTaskIconChanged(int taskId) {
        TaskView taskView = getTaskViewByTaskId(taskId);
        if (taskView != null) {
            taskView.refreshTaskThumbnailSplash();
        }
    }

    /**
     * Update the thumbnail of the task.
     * @param refreshNow Refresh immediately if it's true.
+11 −3
Original line number Diff line number Diff line
@@ -342,10 +342,11 @@ public class TaskThumbnailView extends View {

        // Draw splash above thumbnail to hide inconsistencies in rotation and aspect ratios.
        if (shouldShowSplashView()) {
            if (mSplashView != null) {
            // Always draw background for hiding inconsistencies, even if splash view is not yet
            // loaded (which can happen as task icons are loaded asynchronously in the background)
            canvas.drawRoundRect(x, y, width + 1, height + 1, cornerRadius,
                    cornerRadius, mSplashBackgroundPaint);

            if (mSplashView != null) {
                mSplashView.layout((int) x, (int) (y + 1), (int) width, (int) height - 1);
                mSplashView.draw(canvas);
            }
@@ -375,6 +376,13 @@ public class TaskThumbnailView extends View {
                || isThumbnailRotationDifferentFromTask();
    }

    protected void refreshSplashView() {
        if (mTask != null) {
            updateSplashView(mTask.icon);
            invalidate();
        }
    }

    private void updateSplashView(Drawable icon) {
        if (icon == null || icon.getConstantState() == null) {
            mSplashViewDrawable = null;
+4 −0
Original line number Diff line number Diff line
@@ -1184,6 +1184,10 @@ public class TaskView extends FrameLayout implements Reusable {
        mSnapshotView.setSplashAlpha(mTaskThumbnailSplashAlpha);
    }

    protected void refreshTaskThumbnailSplash() {
        mSnapshotView.refreshSplashView();
    }

    private void setSplitSelectTranslationX(float x) {
        mSplitSelectTranslationX = x;
        applyTranslationX();