Translate IconMenu to top / left of thumbnail view
When splitting a task that is already part of a split app pair from the
TaskBar, with the enableOverviewIconMenu feature enabled, position the
IconMenu to the left of a leftRightSplitApp pair, or the top of a
topBottomSplitApp pair
Fixes: 317001670
Test: Manual
Flag: ACONFIG com.android.launcher3.enable_overview_icon_menu TEAMFOOD
Flag: ACONFIG com.android.launcher3.enable_grid_only_overview TEAMFOOD
Change-Id: I4740d7c96635ee9542f7061938baf6fbf2ca01d4
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index 0ee27be..ba59118 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -40,6 +40,7 @@
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.Launcher
import com.android.launcher3.QuickstepTransitionManager
import com.android.launcher3.Utilities
@@ -50,12 +51,14 @@
import com.android.launcher3.statemanager.StateManager
import com.android.launcher3.statemanager.StatefulActivity
import com.android.launcher3.taskbar.TaskbarActivityContext
+import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE
import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource
import com.android.launcher3.views.BaseDragLayer
import com.android.quickstep.TaskViewUtils
import com.android.quickstep.views.FloatingAppPairView
import com.android.quickstep.views.FloatingTaskView
import com.android.quickstep.views.GroupedTaskView
+import com.android.quickstep.views.IconAppChipView
import com.android.quickstep.views.RecentsView
import com.android.quickstep.views.SplitInstructionsView
import com.android.quickstep.views.TaskThumbnailView
@@ -155,16 +158,36 @@
val iconView: View = taskIdAttributeContainer.iconView.asView()
builder.add(ObjectAnimator.ofFloat(thumbnail, TaskThumbnailView.SPLASH_ALPHA, 1f))
thumbnail.setShowSplashForSplitSelection(true)
+ // With the new `IconAppChipView`, we always want to keep the chip pinned to the
+ // top left of the task / thumbnail.
+ if (enableOverviewIconMenu()) {
+ builder.add(
+ ObjectAnimator.ofFloat(
+ (iconView as IconAppChipView).splitTranslationX,
+ MULTI_PROPERTY_VALUE,
+ 0f
+ )
+ )
+ builder.add(
+ ObjectAnimator.ofFloat(
+ iconView.splitTranslationY,
+ MULTI_PROPERTY_VALUE,
+ 0f
+ )
+ )
+ }
if (deviceProfile.isLeftRightSplit) {
// Center view first so scaling happens uniformly, alternatively we can move pivotX to 0
val centerThumbnailTranslationX: Float = (taskViewWidth - thumbnail.width) / 2f
- val centerIconTranslationX: Float = (taskViewWidth - iconView.width) / 2f
val finalScaleX: Float = taskViewWidth.toFloat() / thumbnail.width
builder.add(ObjectAnimator.ofFloat(thumbnail,
TaskThumbnailView.SPLIT_SELECT_TRANSLATE_X, centerThumbnailTranslationX))
- // icons are anchored from Gravity.END, so need to use negative translation
- builder.add(ObjectAnimator.ofFloat(iconView, View.TRANSLATION_X,
+ if (!enableOverviewIconMenu()) {
+ // icons are anchored from Gravity.END, so need to use negative translation
+ val centerIconTranslationX: Float = (taskViewWidth - iconView.width) / 2f
+ builder.add(ObjectAnimator.ofFloat(iconView, View.TRANSLATION_X,
-centerIconTranslationX))
+ }
builder.add(ObjectAnimator.ofFloat(thumbnail, View.SCALE_X, finalScaleX))
// Reset other dimensions
@@ -183,7 +206,6 @@
// asymmetry causes problems..
// Icon defaults to center | horizontal, we add additional translation for split
- val centerIconTranslationX = 0f
var centerThumbnailTranslationY: Float
// TODO(b/271468547), primary thumbnail has layout margin above it, so secondary
@@ -200,9 +222,10 @@
builder.add(ObjectAnimator.ofFloat(thumbnail,
TaskThumbnailView.SPLIT_SELECT_TRANSLATE_Y, centerThumbnailTranslationY))
- // icons are anchored from Gravity.END, so need to use negative translation
- builder.add(ObjectAnimator.ofFloat(iconView, View.TRANSLATION_X,
- centerIconTranslationX))
+ if (!enableOverviewIconMenu()) {
+ // icons are anchored from Gravity.END, so need to use negative translation
+ builder.add(ObjectAnimator.ofFloat(iconView, View.TRANSLATION_X, 0f))
+ }
builder.add(ObjectAnimator.ofFloat(thumbnail, View.SCALE_Y, finalScaleY))
// Reset other dimensions
diff --git a/quickstep/src/com/android/quickstep/views/IconAppChipView.java b/quickstep/src/com/android/quickstep/views/IconAppChipView.java
index 6bb98e1..ba42594 100644
--- a/quickstep/src/com/android/quickstep/views/IconAppChipView.java
+++ b/quickstep/src/com/android/quickstep/views/IconAppChipView.java
@@ -97,11 +97,25 @@
private final MultiPropertyFactory<View> mViewTranslationY;
/**
+ * Gets the view split x-axis translation
+ */
+ public MultiPropertyFactory<View>.MultiProperty getSplitTranslationX() {
+ return mViewTranslationX.get(INDEX_SPLIT_TRANSLATION);
+ }
+
+ /**
* Sets the view split x-axis translation
* @param translationX x-axis translation
*/
public void setSplitTranslationX(float translationX) {
- mViewTranslationX.get(INDEX_SPLIT_TRANSLATION).setValue(translationX);
+ getSplitTranslationX().setValue(translationX);
+ }
+
+ /**
+ * Gets the view split y-axis translation
+ */
+ public MultiPropertyFactory<View>.MultiProperty getSplitTranslationY() {
+ return mViewTranslationY.get(INDEX_SPLIT_TRANSLATION);
}
/**
@@ -109,7 +123,7 @@
* @param translationY y-axis translation
*/
public void setSplitTranslationY(float translationY) {
- mViewTranslationY.get(INDEX_SPLIT_TRANSLATION).setValue(translationY);
+ getSplitTranslationY().setValue(translationY);
}
/**