Use split thumbnail width/height directly
* When swiping to QS from home, the
bounds for the rect on screen are incorrect
because it's technically off-screen when
it's being queried
Fixes: 206155441
Change-Id: Ibb17f2ac291f867b6de06041c980e434ce92cf27
diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
index df99d27..ea83b4d 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java
@@ -4,7 +4,6 @@
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import android.content.Context;
-import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -50,8 +49,6 @@
private final float[] mIcon2CenterCoords = new float[2];
private TransformingTouchDelegate mIcon2TouchDelegate;
@Nullable private StagedSplitBounds mSplitBoundsConfig;
- private final Rect mPrimaryTempRect = new Rect();
- private final Rect mSecondaryTempRect = new Rect();
public GroupedTaskView(Context context) {
super(context);
@@ -239,10 +236,8 @@
int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
- mSnapshotView.getBoundsOnScreen(mPrimaryTempRect);
- mSnapshotView2.getBoundsOnScreen(mSecondaryTempRect);
getPagedOrientationHandler().setSplitIconParams(mIconView, mIconView2,
- taskIconHeight, mPrimaryTempRect, mSecondaryTempRect,
+ taskIconHeight, mSnapshotView.getWidth(), mSnapshotView.getHeight(),
isRtl, deviceProfile, mSplitBoundsConfig);
}
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index 93e3ea7..498f6db 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -429,7 +429,7 @@
@Override
public void setSplitIconParams(View primaryIconView, View secondaryIconView,
- int taskIconHeight, Rect primarySnapshotBounds, Rect secondarySnapshotBounds,
+ int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight,
boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) {
FrameLayout.LayoutParams primaryIconParams =
(FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
@@ -439,13 +439,12 @@
splitConfig.visualDividerBounds.height() :
splitConfig.visualDividerBounds.width());
- int primaryHeight = primarySnapshotBounds.height();
primaryIconParams.gravity = (isRtl ? START : END) | TOP;
- primaryIconView.setTranslationY(primaryHeight - primaryIconView.getHeight() / 2f);
+ primaryIconView.setTranslationY(primarySnapshotHeight - primaryIconView.getHeight() / 2f);
primaryIconView.setTranslationX(0);
secondaryIconParams.gravity = (isRtl ? START : END) | TOP;
- secondaryIconView.setTranslationY(primaryHeight + taskIconHeight + dividerBar);
+ secondaryIconView.setTranslationY(primarySnapshotHeight + taskIconHeight + dividerBar);
secondaryIconView.setTranslationX(0);
primaryIconView.setLayoutParams(primaryIconParams);
secondaryIconView.setLayoutParams(secondaryIconParams);
diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java
index 2ff2feb..95336cd 100644
--- a/src/com/android/launcher3/touch/PagedOrientationHandler.java
+++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java
@@ -152,7 +152,7 @@
void setIconAndSnapshotParams(View iconView, int taskIconMargin, int taskIconHeight,
FrameLayout.LayoutParams snapshotParams, boolean isRtl);
void setSplitIconParams(View primaryIconView, View secondaryIconView,
- int taskIconHeight, Rect primarySnapshotBounds, Rect secondarySnapshotBounds,
+ int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight,
boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig);
/*
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index ba9d09c..835c240 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -523,7 +523,7 @@
@Override
public void setSplitIconParams(View primaryIconView, View secondaryIconView,
- int taskIconHeight, Rect primarySnapshotBounds, Rect secondarySnapshotBounds,
+ int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight,
boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) {
FrameLayout.LayoutParams primaryIconParams =
(FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
@@ -533,15 +533,12 @@
splitConfig.visualDividerBounds.height() :
splitConfig.visualDividerBounds.width());
- int primaryWidth = primarySnapshotBounds.width();
if (deviceProfile.isLandscape) {
primaryIconParams.gravity = TOP | START;
- primaryIconView.setTranslationX(primaryWidth - primaryIconView.getWidth());
+ primaryIconView.setTranslationX(primarySnapshotWidth - primaryIconView.getWidth());
primaryIconView.setTranslationY(0);
-
secondaryIconParams.gravity = TOP | START;
- secondaryIconView.setTranslationX(primaryWidth + dividerBar);
- secondaryIconView.setTranslationY(0);
+ secondaryIconView.setTranslationX(primarySnapshotWidth + dividerBar);
} else {
primaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
primaryIconView.setTranslationX(-(primaryIconView.getWidth()) / 2f);
@@ -549,8 +546,8 @@
secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
secondaryIconView.setTranslationX(secondaryIconView.getWidth() / 2f);
- secondaryIconView.setTranslationY(0);
}
+ secondaryIconView.setTranslationY(0);
primaryIconView.setLayoutParams(primaryIconParams);
secondaryIconView.setLayoutParams(secondaryIconParams);
}
diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
index a0dde22..539e3f8 100644
--- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
@@ -132,10 +132,10 @@
@Override
public void setSplitIconParams(View primaryIconView, View secondaryIconView,
- int taskIconHeight, Rect primarySnapshotBounds, Rect secondarySnapshotBounds,
+ int taskIconHeight, int primarySnapshotWidth, int primarySnapshotHeight,
boolean isRtl, DeviceProfile deviceProfile, StagedSplitBounds splitConfig) {
super.setSplitIconParams(primaryIconView, secondaryIconView, taskIconHeight,
- primarySnapshotBounds, secondarySnapshotBounds, isRtl, deviceProfile, splitConfig);
+ primarySnapshotWidth, primarySnapshotHeight, isRtl, deviceProfile, splitConfig);
FrameLayout.LayoutParams primaryIconParams =
(FrameLayout.LayoutParams) primaryIconView.getLayoutParams();
FrameLayout.LayoutParams secondaryIconParams =