diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index 8427885d10..8782ee65a5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -30,15 +30,16 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.FIRST_FLOATING_TASK_TRANSLATE_OFFSCREEN; -import static com.android.quickstep.views.RecentsView.OVERVIEW_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.SPLIT_INSTRUCTIONS_FADE; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; +import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA; import android.graphics.Rect; import android.graphics.RectF; import android.util.FloatProperty; +import android.view.animation.Interpolator; import androidx.annotation.NonNull; @@ -78,7 +79,7 @@ public abstract class BaseRecentsViewStateController getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness()); RECENTS_GRID_PROGRESS.set(mRecentsView, state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f); - OVERVIEW_PROGRESS.set(mRecentsView, state == LauncherState.OVERVIEW ? 1f : 0f); + TASK_THUMBNAIL_SPLASH_ALPHA.set(mRecentsView, state.showTaskThumbnailSplash() ? 1f : 0f); } @Override @@ -157,13 +158,19 @@ public abstract class BaseRecentsViewStateController mRecentsView, getTaskModalnessProperty(), toState.getOverviewModalness(), config.getInterpolator(ANIM_OVERVIEW_MODAL, LINEAR)); - boolean showAsGrid = toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()); - setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f, - showAsGrid ? INSTANT : FINAL_FRAME); - boolean toOverview = toState == LauncherState.OVERVIEW; - setter.setFloat(mRecentsView, OVERVIEW_PROGRESS, toOverview ? 1f : 0f, - toOverview ? INSTANT : FINAL_FRAME); + LauncherState fromState = mLauncher.getStateManager().getState(); + setter.setFloat(mRecentsView, TASK_THUMBNAIL_SPLASH_ALPHA, + toState.showTaskThumbnailSplash() ? 1f : 0f, + !toState.showTaskThumbnailSplash() && fromState == LauncherState.QUICK_SWITCH + ? LINEAR : INSTANT); + + boolean showAsGrid = toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()); + Interpolator gridProgressInterpolator = showAsGrid + ? fromState == LauncherState.QUICK_SWITCH ? LINEAR : INSTANT + : FINAL_FRAME; + setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f, + gridProgressInterpolator); } abstract FloatProperty getTaskModalnessProperty(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index b7330072d4..2eade67cc1 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -82,6 +82,11 @@ public class BackgroundAppState extends OverviewState { return false; } + @Override + public boolean showTaskThumbnailSplash() { + return true; + } + @Override protected float getDepthUnchecked(Context context) { return 1; diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 6f925db36e..922679b5f4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -48,6 +48,7 @@ import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; +import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.Animator; @@ -225,6 +226,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // Set RecentView's initial properties. RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]); ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, 1f); + TASK_THUMBNAIL_SPLASH_ALPHA.set(mRecentsView, fromState.showTaskThumbnailSplash() ? 1f : 0); mRecentsView.setContentAlpha(1); mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress()); mLauncher.getActionsView().getVisibilityAlpha().setValue( diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index c7c3441acf..7337132a6a 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -27,13 +27,13 @@ import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; -import static com.android.quickstep.views.RecentsView.OVERVIEW_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.TASK_MODALNESS; import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; +import static com.android.quickstep.views.RecentsView.TASK_THUMBNAIL_SPLASH_ALPHA; import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL; import android.util.FloatProperty; @@ -106,8 +106,8 @@ public class FallbackRecentsStateController implements StateHandler { private static final int FLAG_SCRIM = BaseState.getFlag(5); private static final int FLAG_LIVE_TILE = BaseState.getFlag(6); private static final int FLAG_OVERVIEW_UI = BaseState.getFlag(7); + private static final int FLAG_TASK_THUMBNAIL_SPLASH = BaseState.getFlag(8); public static final RecentsState DEFAULT = new RecentsState(0, FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID @@ -49,7 +50,8 @@ public class RecentsState implements BaseState { FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_OVERVIEW_UI); public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2, - FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN | FLAG_OVERVIEW_UI); + FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN | FLAG_OVERVIEW_UI + | FLAG_TASK_THUMBNAIL_SPLASH); public static final RecentsState HOME = new RecentsState(3, 0); public static final RecentsState BG_LAUNCHER = new LauncherState(4, 0); public static final RecentsState OVERVIEW_SPLIT_SELECT = new RecentsState(5, @@ -139,6 +141,11 @@ public class RecentsState implements BaseState { return hasFlag(FLAG_SHOW_AS_GRID) && deviceProfile.isTablet; } + @Override + public boolean showTaskThumbnailSplash() { + return hasFlag(FLAG_TASK_THUMBNAIL_SPLASH); + } + /** * True if the state has overview panel visible. */ diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index 2dff18e654..f718be884c 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -319,6 +319,6 @@ public class GroupedTaskView extends TaskView { protected void applyThumbnailSplashAlpha() { super.applyThumbnailSplashAlpha(); mSnapshotView2.setSplashAlpha( - Utilities.mapToRange(mOverviewProgress, 0f, 1f, 1f, 0f, LINEAR)); + Utilities.mapToRange(mTaskThumbnailSplashAlpha, 0f, 1f, 1f, 0f, LINEAR)); } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 31c1bfcf53..69557a8103 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -381,19 +381,19 @@ public abstract class RecentsView OVERVIEW_PROGRESS = - new FloatProperty("overviewProgress") { + public static final FloatProperty TASK_THUMBNAIL_SPLASH_ALPHA = + new FloatProperty("taskThumbnailSplashAlpha") { @Override - public void setValue(RecentsView view, float overviewProgress) { - view.setOverviewProgress(overviewProgress); + public void setValue(RecentsView view, float taskThumbnailSplashAlpha) { + view.setTaskThumbnailSplashAlpha(taskThumbnailSplashAlpha); } @Override public Float get(RecentsView view) { - return view.mOverviewProgress; + return view.mTaskThumbnailSplashAlpha; } }; @@ -520,7 +520,7 @@ public abstract class RecentsView endState = mSizeStrategy.stateFromGestureEndTarget(endTarget); + if (endState.displayOverviewTasksAsGrid(mActivity.getDeviceProfile())) { TaskView runningTaskView = getRunningTaskView(); float runningTaskPrimaryGridTranslation = 0; if (runningTaskView != null) { @@ -2268,11 +2269,12 @@ public abstract class RecentsViewUpdates the alpha of any splash screen over the thumbnail if it exists. + * Updates alpha of task thumbnail splash on swipe up/down. */ - public void setOverviewProgress(float overviewProgress) { - mOverviewProgress = overviewProgress; + public void setTaskThumbnailSplashAlpha(float taskThumbnailSplashAlpha) { + mTaskThumbnailSplashAlpha = taskThumbnailSplashAlpha; applyThumbnailSplashAlpha(); } protected void applyThumbnailSplashAlpha() { - mSnapshotView.setSplashAlpha( - Utilities.mapToRange(mOverviewProgress, 0f, 1f, 1f, 0f, LINEAR)); + mSnapshotView.setSplashAlpha(Utilities.boundToRange(mTaskThumbnailSplashAlpha, 0f, 1f)); } private void setSplitSelectTranslationX(float x) { diff --git a/src/com/android/launcher3/statemanager/BaseState.java b/src/com/android/launcher3/statemanager/BaseState.java index f9a36ad17c..32378b8384 100644 --- a/src/com/android/launcher3/statemanager/BaseState.java +++ b/src/com/android/launcher3/statemanager/BaseState.java @@ -63,4 +63,11 @@ public interface BaseState { default boolean displayOverviewTasksAsGrid(DeviceProfile deviceProfile) { return false; } + + /** + * For this state, whether tasks should show the thumbnail splash. + */ + default boolean showTaskThumbnailSplash() { + return false; + } }