Fixing issue with touch scrolling the prediction bar.
Change-Id: Ie15ca96e5ea33a54508285aa76fb6aea81b2376d
This commit is contained in:
1 parent
358af81ca4
commit
6b27614c54
3 files changed
+88
-16
No files matched your search
@@ -22,6 +22,7 @@ import com.android.launcher3.util.Thunk;
|
||||
|
||||
public class CheckLongPressHelper {
|
||||
@Thunk View mView;
|
||||
@Thunk View.OnLongClickListener mListener;
|
||||
@Thunk boolean mHasPerformedLongPress;
|
||||
private CheckForLongPress mPendingCheckForLongPress;
|
||||
|
||||
@@ -29,7 +30,13 @@ public class CheckLongPressHelper {
|
||||
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 @@ public class CheckLongPressHelper {
|
||||
mView = v;
|
||||
}
|
||||
|
||||
public CheckLongPressHelper(View v, View.OnLongClickListener listener) {
|
||||
mView = v;
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public void postCheckForLongPress() {
|
||||
mHasPerformedLongPress = false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user