Merge "Refresh thumbnail splash when task icon changes." into tm-qpr-dev am: f5f3a80959

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21319101

Change-Id: I34d77503f27fa5d12e1f1db689e499880105ccdf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-02-09 16:59:43 +00:00
committed by Automerger Merge Worker
5 changed files with 30 additions and 3 deletions
@@ -355,6 +355,12 @@ public class GroupedTaskView extends TaskView {
mSnapshotView2.setSplashAlpha(mTaskThumbnailSplashAlpha); mSnapshotView2.setSplashAlpha(mTaskThumbnailSplashAlpha);
} }
@Override
protected void refreshTaskThumbnailSplash() {
super.refreshTaskThumbnailSplash();
mSnapshotView2.refreshSplashView();
}
/** /**
* Sets visibility for thumbnails and associated elements (DWB banners). * Sets visibility for thumbnails and associated elements (DWB banners).
* IconView is unaffected. * IconView is unaffected.
@@ -92,6 +92,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
@Override @Override
public void onTaskIconChanged(int taskId) { 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 Launcher needs to return to split select state, do it now, after the icon has updated.
if (mActivity.hasPendingSplitSelectInfo()) { if (mActivity.hasPendingSplitSelectInfo()) {
PendingSplitSelectInfo recoveryData = mActivity.getPendingSplitSelectInfo(); PendingSplitSelectInfo recoveryData = mActivity.getPendingSplitSelectInfo();
@@ -956,6 +956,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. * Update the thumbnail of the task.
* @param refreshNow Refresh immediately if it's true. * @param refreshNow Refresh immediately if it's true.
@@ -342,10 +342,11 @@ public class TaskThumbnailView extends View {
// Draw splash above thumbnail to hide inconsistencies in rotation and aspect ratios. // Draw splash above thumbnail to hide inconsistencies in rotation and aspect ratios.
if (shouldShowSplashView()) { if (shouldShowSplashView()) {
// 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) { if (mSplashView != null) {
canvas.drawRoundRect(x, y, width + 1, height + 1, cornerRadius,
cornerRadius, mSplashBackgroundPaint);
mSplashView.layout((int) x, (int) (y + 1), (int) width, (int) height - 1); mSplashView.layout((int) x, (int) (y + 1), (int) width, (int) height - 1);
mSplashView.draw(canvas); mSplashView.draw(canvas);
} }
@@ -375,6 +376,13 @@ public class TaskThumbnailView extends View {
|| isThumbnailRotationDifferentFromTask(); || isThumbnailRotationDifferentFromTask();
} }
protected void refreshSplashView() {
if (mTask != null) {
updateSplashView(mTask.icon);
invalidate();
}
}
private void updateSplashView(Drawable icon) { private void updateSplashView(Drawable icon) {
if (icon == null || icon.getConstantState() == null) { if (icon == null || icon.getConstantState() == null) {
mSplashViewDrawable = null; mSplashViewDrawable = null;
@@ -1215,6 +1215,10 @@ public class TaskView extends FrameLayout implements Reusable {
mSnapshotView.setSplashAlpha(mTaskThumbnailSplashAlpha); mSnapshotView.setSplashAlpha(mTaskThumbnailSplashAlpha);
} }
protected void refreshTaskThumbnailSplash() {
mSnapshotView.refreshSplashView();
}
private void setSplitSelectTranslationX(float x) { private void setSplitSelectTranslationX(float x) {
mSplitSelectTranslationX = x; mSplitSelectTranslationX = x;
applyTranslationX(); applyTranslationX();