diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt index a2d3859135..da26d5a77e 100644 --- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt @@ -24,6 +24,7 @@ import android.animation.ObjectAnimator import android.animation.ValueAnimator import android.app.ActivityManager.RunningTaskInfo import android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW +import android.content.Context import android.graphics.Bitmap import android.graphics.Rect import android.graphics.RectF @@ -41,8 +42,10 @@ import androidx.annotation.VisibleForTesting import com.android.app.animation.Interpolators import com.android.launcher3.DeviceProfile import com.android.launcher3.Flags.enableOverviewIconMenu +import com.android.launcher3.InsettableFrameLayout import com.android.launcher3.Launcher import com.android.launcher3.QuickstepTransitionManager +import com.android.launcher3.R import com.android.launcher3.Utilities import com.android.launcher3.anim.PendingAnimation import com.android.launcher3.apppairs.AppPairIcon @@ -268,6 +271,51 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC } } + /** + * Creates and returns a view to fade in at .4 animation progress and adds it to the provided + * [pendingAnimation]. Assumes that animation will be the final split placeholder launch anim. + * + * [secondPlaceholderEndingBounds] refers to the second placeholder view that gets added on + * screen, not the logical second app. + * For landscape it's the left app and for portrait the top one. + */ + fun addDividerPlaceholderViewToAnim(pendingAnimation: PendingAnimation, + launcher: StatefulActivity<*>, + secondPlaceholderEndingBounds: Rect, + context: Context) : View { + val mSplitDividerPlaceholderView = View(context) + val recentsView = launcher.getOverviewPanel>() + val dp : com.android.launcher3.DeviceProfile = launcher.getDeviceProfile() + // Add it before/under the most recently added first floating taskView + val firstAddedSplitViewIndex: Int = launcher.getDragLayer().indexOfChild( + recentsView.splitSelectController.firstFloatingTaskView) + launcher.getDragLayer().addView(mSplitDividerPlaceholderView, firstAddedSplitViewIndex) + val lp = mSplitDividerPlaceholderView.layoutParams as InsettableFrameLayout.LayoutParams + lp.topMargin = 0 + + if (dp.isLeftRightSplit) { + lp.height = secondPlaceholderEndingBounds.height() + lp.width = launcher.resources + .getDimensionPixelSize(R.dimen.split_divider_handle_region_height) + mSplitDividerPlaceholderView.translationX = secondPlaceholderEndingBounds.right - lp.width / 2f + mSplitDividerPlaceholderView.translationY = 0f + } else { + lp.height = launcher.resources + .getDimensionPixelSize(R.dimen.split_divider_handle_region_height) + lp.width = secondPlaceholderEndingBounds.width() + mSplitDividerPlaceholderView.translationY = secondPlaceholderEndingBounds.top - lp.height / 2f + mSplitDividerPlaceholderView.translationX = 0f + } + + mSplitDividerPlaceholderView.alpha = 0f + mSplitDividerPlaceholderView.setBackgroundColor(launcher.resources + .getColor(R.color.taskbar_background_dark)) + val timings = AnimUtils.getDeviceSplitToConfirmTimings(dp.isTablet) + pendingAnimation.setViewAlpha(mSplitDividerPlaceholderView, 1f, + Interpolators.clampToProgress(timings.stagedRectScaleXInterpolator, 0.4f, 1f)) + return mSplitDividerPlaceholderView + } + /** Does not play any animation if user is not currently in split selection state. */ fun playPlaceholderDismissAnim(launcher: StatefulActivity<*>, splitDismissEvent: EventEnum) { if (!splitSelectStateController.isSplitSelectActive) { diff --git a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java index e068301b67..1b98ba40af 100644 --- a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java +++ b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java @@ -163,6 +163,10 @@ public class SplitToWorkspaceController { new RectF(firstTaskStartingBounds), firstTaskEndingBounds, false /* fadeWithThumbnail */, true /* isStagedTask */); + View mSplitDividerPlaceholderView = recentsView.getSplitSelectController() + .getSplitAnimationController().addDividerPlaceholderViewToAnim(pendingAnimation, + mLauncher, secondTaskEndingBounds, view.getContext()); + FloatingTaskView secondFloatingTaskView = FloatingTaskView.getFloatingTaskView(mLauncher, view, bitmap, icon, secondTaskStartingBounds); secondFloatingTaskView.setAlpha(1); @@ -189,6 +193,7 @@ public class SplitToWorkspaceController { private void cleanUp() { mLauncher.getDragLayer().removeView(firstFloatingTaskView); mLauncher.getDragLayer().removeView(secondFloatingTaskView); + mLauncher.getDragLayer().removeView(mSplitDividerPlaceholderView); mController.getSplitAnimationController().removeSplitInstructionsView(mLauncher); mController.resetState(); } diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index 18922a6fb3..5eebc3e285 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -299,7 +299,6 @@ public class FloatingTaskView extends FrameLayout { ValueAnimator transitionAnimator = ValueAnimator.ofFloat(0, 1); animation.add(transitionAnimator); - long animDuration = animation.getDuration(); RectF floatingTaskViewBounds = new RectF(); if (fadeWithThumbnail) { diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index c42bad3ddb..5fb936dfdb 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -721,6 +721,7 @@ public abstract class RecentsView + + + + + + \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index a912e2d0e8..76109c007e 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -445,6 +445,8 @@ 24dp 60dp 8dp + 96dp + 48dp 16dp 3dp