summaryrefslogtreecommitdiff
path: root/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
diff options
context:
space:
mode:
Diffstat (limited to 'quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java')
-rw-r--r--quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java45
1 files changed, 40 insertions, 5 deletions
diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
index f0364eb410..ff175f18f2 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java
@@ -15,6 +15,8 @@
*/
package com.android.quickstep.fallback;
+import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
+import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
@@ -22,14 +24,22 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
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.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.TaskView.FLAG_UPDATE_ALL;
+import android.util.FloatProperty;
+import android.util.Pair;
+
+import androidx.annotation.NonNull;
+
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.statemanager.StateManager.StateHandler;
@@ -77,9 +87,7 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
float clearAllButtonAlpha = state.hasClearAllButton() ? 1 : 0;
setter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
clearAllButtonAlpha, LINEAR);
- float overviewButtonAlpha =
- state.hasOverviewActions() && mRecentsView.shouldShowOverviewActionsForState(state)
- ? 1 : 0;
+ float overviewButtonAlpha = state.hasOverviewActions() ? 1 : 0;
setter.setFloat(mActivity.getActionsView().getVisibilityAlpha(),
MultiValueAlpha.VALUE, overviewButtonAlpha, LINEAR);
@@ -94,10 +102,37 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
setter.setFloat(mRecentsView, TASK_MODALNESS, state.getOverviewModalness(),
config.getInterpolator(ANIM_OVERVIEW_MODAL, LINEAR));
setter.setFloat(mRecentsView, FULLSCREEN_PROGRESS, state.isFullScreen() ? 1 : 0, LINEAR);
- setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS,
- state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile()) ? 1f : 0f, LINEAR);
+ boolean showAsGrid = state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile());
+ setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f,
+ showAsGrid ? INSTANT : FINAL_FRAME);
setter.setViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
+
+ RecentsState currentState = mActivity.getStateManager().getState();
+ if (isSplitSelectionState(state) && !isSplitSelectionState(currentState)) {
+ setter.add(mRecentsView.createSplitSelectInitAnimation().buildAnim());
+ }
+
+ Pair<FloatProperty, FloatProperty> taskViewsFloat =
+ mRecentsView.getPagedOrientationHandler().getSplitSelectTaskOffset(
+ TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION,
+ mActivity.getDeviceProfile());
+ setter.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);
+ if (isSplitSelectionState(state)) {
+ mRecentsView.applySplitPrimaryScrollOffset();
+ setter.setFloat(mRecentsView, taskViewsFloat.first,
+ mRecentsView.getSplitSelectTranslation(), LINEAR);
+ } else {
+ mRecentsView.resetSplitPrimaryScrollOffset();
+ setter.setFloat(mRecentsView, taskViewsFloat.first, 0, LINEAR);
+ }
+ }
+
+ /**
+ * @return true if {@param toState} is {@link RecentsState#OVERVIEW_SPLIT_SELECT}
+ */
+ private boolean isSplitSelectionState(@NonNull RecentsState toState) {
+ return toState == OVERVIEW_SPLIT_SELECT;
}
}