Fix issues when dragging items onto workspace screens
- In All Apps, mini workspace screens sometimes disappeared
- In All Apps, one mini workspace screens had "strong" blue outline when it shouldn't have
- In spring loaded mode, adjacent screens were not being properly rendered
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 097fbc0..c9f2f6c 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1435,7 +1435,7 @@
oldAlphas[i] = cl.getAlpha();
newAlphas[i] = finalAlpha;
- if (animated && !(oldAlphas[i] == 0f && newAlphas[i] == 0f)) {
+ if (animated) {
oldXs[i] = cl.getX();
oldYs[i] = cl.getY();
oldScaleXs[i] = cl.getScaleX();
@@ -1456,7 +1456,7 @@
cl.setBackgroundAlpha(finalAlpha);
cl.setAlpha(finalAlpha);
cl.setRotationY(rotation);
- if (!animated) mShrinkAnimationListener.onAnimationEnd(null);
+ mShrinkAnimationListener.onAnimationEnd(null);
}
// increment newX for the next screen
x += scaledPageWidth + extraScaledSpacing;
@@ -1514,7 +1514,6 @@
setVerticalWallpaperOffset(
a * oldVerticalWallpaperOffset + b * newVerticalWallpaperOffset);
for (int i = 0; i < screenCount; i++) {
- if (oldAlphas[i] == 0f && newAlphas[i] == 0f) continue;
final CellLayout cl = (CellLayout) getChildAt(i);
cl.fastInvalidate();
cl.setFastX(a * oldXs[i] + b * newXs[i]);
@@ -1624,6 +1623,9 @@
case BOTTOM_HIDDEN:
case BOTTOM_VISIBLE:
case SPRING_LOADED:
+ if (state != ShrinkState.TOP) {
+ cl.setIsDefaultDropTarget(false);
+ }
if (!isDragHappening) {
// even if a drag isn't happening, we don't want to show a screen as
// accepting drops if it doesn't have at least one free cell
@@ -1765,7 +1767,7 @@
oldAlphas[i] = cl.getAlpha();
newAlphas[i] = finalAlphaValue;
- if (animated && !(oldAlphas[i] == 0f && newAlphas[i] == 0f)) {
+ if (animated) {
oldTranslationXs[i] = cl.getTranslationX();
oldTranslationYs[i] = cl.getTranslationY();
oldScaleXs[i] = cl.getScaleX();
@@ -1790,7 +1792,7 @@
cl.setBackgroundAlphaMultiplier(finalAlphaMultiplierValue);
cl.setAlpha(finalAlphaValue);
cl.setRotationY(rotation);
- if (!animated) mUnshrinkAnimationListener.onAnimationEnd(null);
+ mUnshrinkAnimationListener.onAnimationEnd(null);
}
}
Display display = mLauncher.getWindowManager().getDefaultDisplay();
@@ -1842,7 +1844,6 @@
setVerticalWallpaperOffset(
a * oldVerticalWallpaperOffset + b * newVerticalWallpaperOffset);
for (int i = 0; i < screenCount; i++) {
- if (oldAlphas[i] == 0f && newAlphas[i] == 0f) continue;
final CellLayout cl = (CellLayout) getChildAt(i);
cl.fastInvalidate();
cl.setFastTranslationX(
@@ -1869,7 +1870,6 @@
final float b = (Float) animation.getAnimatedValue();
final float a = 1f - b;
for (int i = 0; i < screenCount; i++) {
- if (oldAlphas[i] == 0f && newAlphas[i] == 0f) continue;
final CellLayout cl = (CellLayout) getChildAt(i);
cl.setFastRotationY(a * oldRotationYs[i] + b * newRotationYs[i]);
}
@@ -2182,11 +2182,13 @@
originY = (int)mTempOriginXY[1];
}
- // When you drag to a particular screen, make that the new current/default screen, so any
- // subsequent taps add items to that screen
- int dragTargetIndex = indexOfChild(mDragTargetLayout);
- if (mCurrentPage != dragTargetIndex && (mIsSmall || mIsInUnshrinkAnimation)) {
- scrollToNewPageWithoutMovingPages(dragTargetIndex);
+ // When you are in customization mode and drag to a particular screen, make that the
+ // new current/default screen, so any subsequent taps add items to that screen
+ if (!mLauncher.isAllAppsVisible()) {
+ int dragTargetIndex = indexOfChild(mDragTargetLayout);
+ if (mCurrentPage != dragTargetIndex && (mIsSmall || mIsInUnshrinkAnimation)) {
+ scrollToNewPageWithoutMovingPages(dragTargetIndex);
+ }
}
if (source != this) {