summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-07-25 14:13:04 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-07-25 15:22:27 -0700
commite6fd19b19f6afd4d894e3f6f413ec8568c7300a4 (patch)
treef61d47e74347359157b1d2c7532aa4703401b46b /src
parentb0e80bcee7735589f5a11b1abc858acb6bf9d438 (diff)
downloadandroid_packages_apps_Trebuchet-e6fd19b19f6afd4d894e3f6f413ec8568c7300a4.tar.gz
android_packages_apps_Trebuchet-e6fd19b19f6afd4d894e3f6f413ec8568c7300a4.tar.bz2
android_packages_apps_Trebuchet-e6fd19b19f6afd4d894e3f6f413ec8568c7300a4.zip
Fixing regression where the source icon becomes visible while dragging
Bug: 30291280 Change-Id: I5687e00371315a318e8ff93dd3de4c5f437a6971
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index c9eee81e4..20532c1a5 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -87,6 +87,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
private boolean mIsAboveIcon;
private boolean mIsAnimatingOpen;
+ private boolean mSrcIconDragStarted;
+
/**
* Sorts shortcuts in rank order, with manifest shortcuts coming before dynamic shortcuts.
*/
@@ -349,7 +351,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
boolean containerContainsTouch = x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
if (shouldStartDeferredDrag((int) x, (int) y, containerContainsTouch)) {
- cleanupDeferredDrag();
+ mSrcIconDragStarted = true;
+ cleanupDeferredDrag(true);
mDeferredDragIcon.getParent().requestDisallowInterceptTouchEvent(false);
mDeferredDragIcon.getOnLongClickListener().onLongClick(mDeferredDragIcon);
mLauncher.getDragController().onTouchEvent(ev);
@@ -379,7 +382,7 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
}
}
} else if (action == MotionEvent.ACTION_UP) {
- cleanupDeferredDrag();
+ cleanupDeferredDrag(true);
// Launch a shortcut if user was hovering over it.
for (int i = 0; i < childCount; i++) {
DeepShortcutView shortcut = getShortcutAt(i);
@@ -389,7 +392,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
}
}
} else if (action == MotionEvent.ACTION_CANCEL) {
- cleanupDeferredDrag();
+ // Do not change the source icon visibility if we are already dragging the source icon.
+ cleanupDeferredDrag(!mSrcIconDragStarted);
}
return true;
}
@@ -414,11 +418,13 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
return !containerContainsTouch && (newDistToEdge - distToEdge > mStartDragThreshold);
}
- public void cleanupDeferredDrag() {
+ public void cleanupDeferredDrag(boolean updateSrcVisibility) {
if (mDragView != null) {
mDragView.remove();
}
- mDeferredDragIcon.setVisibility(VISIBLE);
+ if (updateSrcVisibility) {
+ mDeferredDragIcon.setVisibility(VISIBLE);
+ }
}
@Override