Merge "Refactor overview progress as splash progress." into tm-qpr-dev
This commit is contained in:
+15
-8
@@ -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<T extends RecentsView>
|
||||
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<T extends RecentsView>
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
@@ -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(
|
||||
|
||||
@@ -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<RecentsState
|
||||
boolean showAsGrid = state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile());
|
||||
setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f,
|
||||
showAsGrid ? INSTANT : FINAL_FRAME);
|
||||
setter.setFloat(mRecentsView, OVERVIEW_PROGRESS, state == RecentsState.DEFAULT ? 1f : 0f,
|
||||
INSTANT);
|
||||
setter.setFloat(mRecentsView, TASK_THUMBNAIL_SPLASH_ALPHA,
|
||||
state.showTaskThumbnailSplash() ? 1f : 0f, INSTANT);
|
||||
|
||||
setter.setViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
|
||||
config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
|
||||
|
||||
@@ -41,6 +41,7 @@ public class RecentsState implements BaseState<RecentsState> {
|
||||
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<RecentsState> {
|
||||
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<RecentsState> {
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,19 +381,19 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
};
|
||||
|
||||
/**
|
||||
* Progress to and from the OVERVIEW state, where being in OverviewState has a value of 1, and
|
||||
* being in any other LauncherState has a value of 0.
|
||||
* Alpha of the task thumbnail splash, where being in BackgroundAppState has a value of 1, and
|
||||
* being in any other state has a value of 0.
|
||||
*/
|
||||
public static final FloatProperty<RecentsView> OVERVIEW_PROGRESS =
|
||||
new FloatProperty<RecentsView>("overviewProgress") {
|
||||
public static final FloatProperty<RecentsView> TASK_THUMBNAIL_SPLASH_ALPHA =
|
||||
new FloatProperty<RecentsView>("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<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
protected float mTaskViewsSecondarySplitTranslation = 0;
|
||||
// Progress from 0 to 1 where 0 is a carousel and 1 is a 2 row grid.
|
||||
private float mGridProgress = 0;
|
||||
private float mOverviewProgress = 0;
|
||||
private float mTaskThumbnailSplashAlpha = 0;
|
||||
private boolean mShowAsGridLastOnLayout = false;
|
||||
private final IntSet mTopRowIdSet = new IntSet();
|
||||
|
||||
@@ -1640,6 +1640,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
taskView.setStableAlpha(mContentAlpha);
|
||||
taskView.setFullscreenProgress(mFullscreenProgress);
|
||||
taskView.setModalness(mTaskModalness);
|
||||
taskView.setTaskThumbnailSplashAlpha(mTaskThumbnailSplashAlpha);
|
||||
}
|
||||
}
|
||||
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
|
||||
@@ -2243,8 +2244,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
updateGridProperties();
|
||||
}
|
||||
|
||||
if (mSizeStrategy.stateFromGestureEndTarget(endTarget)
|
||||
.displayOverviewTasksAsGrid(mActivity.getDeviceProfile())) {
|
||||
BaseState<?> 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 RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
}
|
||||
int overviewProgress = isOverviewEndTarget ? 1 : 0;
|
||||
int splashAlpha = endState.showTaskThumbnailSplash() ? 1 : 0;
|
||||
if (animatorSet == null) {
|
||||
setOverviewProgress(overviewProgress);
|
||||
setTaskThumbnailSplashAlpha(splashAlpha);
|
||||
} else {
|
||||
animatorSet.play(ObjectAnimator.ofFloat(this, OVERVIEW_PROGRESS, overviewProgress));
|
||||
animatorSet.play(
|
||||
ObjectAnimator.ofFloat(this, TASK_THUMBNAIL_SPLASH_ALPHA, splashAlpha));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2723,15 +2725,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mClearAllButton.setGridProgress(gridProgress);
|
||||
}
|
||||
|
||||
private void setOverviewProgress(float overviewProgress) {
|
||||
private void setTaskThumbnailSplashAlpha(float taskThumbnailSplashAlpha) {
|
||||
int taskCount = getTaskViewCount();
|
||||
if (taskCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mOverviewProgress = overviewProgress;
|
||||
mTaskThumbnailSplashAlpha = taskThumbnailSplashAlpha;
|
||||
for (int i = 0; i < taskCount; i++) {
|
||||
requireTaskViewAt(i).setOverviewProgress(overviewProgress);
|
||||
requireTaskViewAt(i).setTaskThumbnailSplashAlpha(taskThumbnailSplashAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4334,6 +4336,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
* If launching one of the adjacent tasks, parallax the center task and other adjacent task
|
||||
* to the right.
|
||||
*/
|
||||
@SuppressLint("Recycle")
|
||||
public AnimatorSet createAdjacentPageAnimForTaskLaunch(TaskView tv) {
|
||||
AnimatorSet anim = new AnimatorSet();
|
||||
|
||||
@@ -4377,7 +4380,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
properties));
|
||||
}
|
||||
}
|
||||
anim.play(ObjectAnimator.ofFloat(recentsView, OVERVIEW_PROGRESS, 1, 0));
|
||||
anim.play(ObjectAnimator.ofFloat(recentsView, TASK_THUMBNAIL_SPLASH_ALPHA, 0, 1));
|
||||
return anim;
|
||||
}
|
||||
|
||||
@@ -4437,7 +4440,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
BACKGROUND_APP.getDepth(mActivity));
|
||||
anim.play(depthAnimator);
|
||||
}
|
||||
anim.play(ObjectAnimator.ofFloat(this, OVERVIEW_PROGRESS, 1f, 0f));
|
||||
anim.play(ObjectAnimator.ofFloat(this, TASK_THUMBNAIL_SPLASH_ALPHA, 0f, 1f));
|
||||
|
||||
anim.play(progressAnim);
|
||||
anim.setInterpolator(interpolator);
|
||||
|
||||
@@ -330,7 +330,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
protected final DigitalWellBeingToast mDigitalWellBeingToast;
|
||||
private float mFullscreenProgress;
|
||||
private float mGridProgress;
|
||||
protected float mOverviewProgress;
|
||||
protected float mTaskThumbnailSplashAlpha;
|
||||
private float mNonGridScale = 1;
|
||||
private float mDismissScale = 1;
|
||||
protected final FullscreenDrawParams mCurrentFullscreenParams;
|
||||
@@ -1056,18 +1056,15 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates progress of task view for entering/exiting overview on swipe up/down.
|
||||
*
|
||||
* <p>Updates 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) {
|
||||
|
||||
@@ -63,4 +63,11 @@ public interface BaseState<T extends BaseState> {
|
||||
default boolean displayOverviewTasksAsGrid(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For this state, whether tasks should show the thumbnail splash.
|
||||
*/
|
||||
default boolean showTaskThumbnailSplash() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user