Merge "Move splitInstructionsView reference out of RecentsView" into udc-qpr-dev

This commit is contained in:
Vinit Nayak
2023-08-08 20:40:57 +00:00
committed by Android (Google) Code Review
3 changed files with 33 additions and 22 deletions
@@ -60,8 +60,6 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
)
}
var splitInstructionsView: SplitInstructionsView? = null
/**
* Returns different elements to animate for the initial split selection animation
* depending on the state of the surface from which the split was initiated
@@ -235,7 +233,8 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
animatorSet.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
splitSelectStateController.resetState()
safeRemoveViewFromDragLayer(launcher, splitInstructionsView)
safeRemoveViewFromDragLayer(launcher,
splitSelectStateController.splitInstructionsView)
}
})
return animatorSet
@@ -246,8 +245,9 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
* app for splitscreen
*/
fun getShowSplitInstructionsAnim(launcher: StatefulActivity<*>) : PendingAnimation {
safeRemoveViewFromDragLayer(launcher, splitInstructionsView)
splitInstructionsView = SplitInstructionsView.getSplitInstructionsView(launcher)
safeRemoveViewFromDragLayer(launcher, splitSelectStateController.splitInstructionsView)
val splitInstructionsView = SplitInstructionsView.getSplitInstructionsView(launcher)
splitSelectStateController.splitInstructionsView = splitInstructionsView
val timings = AnimUtils.getDeviceOverviewToSplitTimings(launcher.deviceProfile.isTablet)
val anim = PendingAnimation(100 /*duration */)
anim.setViewAlpha(splitInstructionsView, 1f,
@@ -267,7 +267,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
/** Removes the split instructions view from [launcher] drag layer. */
fun removeSplitInstructionsView(launcher: StatefulActivity<*>) {
safeRemoveViewFromDragLayer(launcher, splitInstructionsView)
safeRemoveViewFromDragLayer(launcher, splitSelectStateController.splitInstructionsView)
}
private fun safeRemoveViewFromDragLayer(launcher: StatefulActivity<*>, view: View?) {
@@ -73,6 +73,7 @@ import com.android.quickstep.TaskAnimationManager;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.views.FloatingTaskView;
import com.android.quickstep.views.GroupedTaskView;
import com.android.quickstep.views.SplitInstructionsView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
@@ -113,6 +114,7 @@ public class SplitSelectStateController {
private GroupedTaskView mLaunchingTaskView;
private FloatingTaskView mFirstFloatingTaskView;
private SplitInstructionsView mSplitInstructionsView;
private final List<SplitSelectionListener> mSplitSelectionListeners = new ArrayList<>();
@@ -630,6 +632,7 @@ public class SplitSelectStateController {
mAnimateCurrentTaskDismissal = false;
mDismissingFromSplitPair = false;
mFirstFloatingTaskView = null;
mSplitInstructionsView = null;
}
/**
@@ -660,11 +663,20 @@ public class SplitSelectStateController {
mFirstFloatingTaskView = floatingTaskView;
}
public void setSplitInstructionsView(SplitInstructionsView splitInstructionsView) {
mSplitInstructionsView = splitInstructionsView;
}
@Nullable
public FloatingTaskView getFirstFloatingTaskView() {
return mFirstFloatingTaskView;
}
@Nullable
public SplitInstructionsView getSplitInstructionsView() {
return mSplitInstructionsView;
}
public AppPairsController getAppPairsController() {
return mAppPairsController;
}
@@ -683,8 +683,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
private final Toast mSplitUnsupportedToast = Toast.makeText(getContext(),
R.string.toast_split_app_unsupported, Toast.LENGTH_SHORT);
private SplitInstructionsView mSplitInstructionsView;
@Nullable
private SplitSelectSource mSplitSelectSource;
@@ -3252,19 +3250,21 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
firstFloatingTaskView.setOnClickListener(this::animateToFullscreen);
// SplitInstructionsView: animate in
safeRemoveDragLayerView(mSplitInstructionsView);
mSplitInstructionsView = SplitInstructionsView.getSplitInstructionsView(mActivity);
mSplitInstructionsView.setAlpha(0);
anim.setViewAlpha(mSplitInstructionsView, 1, clampToProgress(LINEAR,
safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView());
SplitInstructionsView splitInstructionsView =
SplitInstructionsView.getSplitInstructionsView(mActivity);
splitInstructionsView.setAlpha(0);
anim.setViewAlpha(splitInstructionsView, 1, clampToProgress(LINEAR,
timings.getInstructionsContainerFadeInStartOffset(),
timings.getInstructionsContainerFadeInEndOffset()));
anim.setViewAlpha(mSplitInstructionsView.getTextView(), 1, clampToProgress(LINEAR,
anim.setViewAlpha(splitInstructionsView.getTextView(), 1, clampToProgress(LINEAR,
timings.getInstructionsTextFadeInStartOffset(),
timings.getInstructionsTextFadeInEndOffset()));
anim.addFloat(mSplitInstructionsView, mSplitInstructionsView.UNFOLD, 0.1f, 1,
anim.addFloat(splitInstructionsView, splitInstructionsView.UNFOLD, 0.1f, 1,
clampToProgress(EMPHASIZED_DECELERATE,
timings.getInstructionsUnfoldStartOffset(),
timings.getInstructionsUnfoldEndOffset()));
mSplitSelectStateController.setSplitInstructionsView(splitInstructionsView);
InteractionJankMonitorWrapper.begin(this,
InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER, "First tile selected");
@@ -4781,9 +4781,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSecondFloatingTaskView.addConfirmAnimation(pendingAnimation, secondTaskStartingBounds,
secondTaskEndingBounds, true /* fadeWithThumbnail */, false /* isStagedTask */);
pendingAnimation.setViewAlpha(mSplitInstructionsView, 0, clampToProgress(LINEAR,
timings.getInstructionsFadeStartOffset(),
timings.getInstructionsFadeEndOffset()));
pendingAnimation.setViewAlpha(mSplitSelectStateController.getSplitInstructionsView(), 0,
clampToProgress(LINEAR, timings.getInstructionsFadeStartOffset(),
timings.getInstructionsFadeEndOffset()));
pendingAnimation.addEndListener(aBoolean -> {
mSplitSelectStateController.launchSplitTasks(
@@ -4819,9 +4819,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
safeRemoveDragLayerView(mSplitSelectStateController.getFirstFloatingTaskView());
safeRemoveDragLayerView(mSecondFloatingTaskView);
safeRemoveDragLayerView(mSplitInstructionsView);
safeRemoveDragLayerView(mSplitSelectStateController.getSplitInstructionsView());
mSecondFloatingTaskView = null;
mSplitInstructionsView = null;
mSplitSelectSource = null;
mSplitSelectStateController.getSplitAnimationController()
.removeSplitInstructionsView(mActivity);
@@ -4921,8 +4920,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
taskViewsFloat.first.set(this, getSplitSelectTranslation());
taskViewsFloat.second.set(this, 0f);
if (mSplitInstructionsView != null) {
mSplitInstructionsView.ensureProperRotation();
if (mSplitSelectStateController.getSplitInstructionsView() != null) {
mSplitSelectStateController.getSplitInstructionsView().ensureProperRotation();
}
}
@@ -6039,7 +6038,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
@Nullable
public SplitInstructionsView getSplitInstructionsView() {
return mSplitInstructionsView;
return mSplitSelectStateController.getSplitInstructionsView();
}
/** Update the current activity locus id to show the enabled state of Overview */