Fixing issue with touch scrolling the prediction bar.
Change-Id: Ie15ca96e5ea33a54508285aa76fb6aea81b2376d
diff --git a/src/com/android/launcher3/CheckLongPressHelper.java b/src/com/android/launcher3/CheckLongPressHelper.java
index 10ca6a3..381b678 100644
--- a/src/com/android/launcher3/CheckLongPressHelper.java
+++ b/src/com/android/launcher3/CheckLongPressHelper.java
@@ -22,6 +22,7 @@
public class CheckLongPressHelper {
@Thunk View mView;
+ @Thunk View.OnLongClickListener mListener;
@Thunk boolean mHasPerformedLongPress;
private CheckForLongPress mPendingCheckForLongPress;
@@ -29,7 +30,13 @@
public void run() {
if ((mView.getParent() != null) && mView.hasWindowFocus()
&& !mHasPerformedLongPress) {
- if (mView.performLongClick()) {
+ boolean handled;
+ if (mListener != null) {
+ handled = mListener.onLongClick(mView);
+ } else {
+ handled = mView.performLongClick();
+ }
+ if (handled) {
mView.setPressed(false);
mHasPerformedLongPress = true;
}
@@ -41,6 +48,11 @@
mView = v;
}
+ public CheckLongPressHelper(View v, View.OnLongClickListener listener) {
+ mView = v;
+ mListener = listener;
+ }
+
public void postCheckForLongPress() {
mHasPerformedLongPress = false;