summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-07-26 17:20:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-07-26 17:20:25 +0000
commitc664f24de25675ad9c2e732345a9c470686d6971 (patch)
tree8766518ce77aa5ca485102874c4746f273e50804 /src
parent2f88ef34fb47b2ef96055ed2234a696fb83c1019 (diff)
parente6fd19b19f6afd4d894e3f6f413ec8568c7300a4 (diff)
downloadandroid_packages_apps_Trebuchet-c664f24de25675ad9c2e732345a9c470686d6971.tar.gz
android_packages_apps_Trebuchet-c664f24de25675ad9c2e732345a9c470686d6971.tar.bz2
android_packages_apps_Trebuchet-c664f24de25675ad9c2e732345a9c470686d6971.zip
Merge "Fixing regression where the source icon becomes visible while dragging" into ub-launcher3-calgary
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 fdc0bd22f..92afeb9a8 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -91,6 +91,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.
*/
@@ -356,7 +358,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);
@@ -386,7 +389,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);
@@ -396,7 +399,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;
}
@@ -421,11 +425,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