Merge "Fix a bug where context menu keeps popping up as we move cursor." into nyc-andromeda-dev
diff --git a/src/com/android/documentsui/dirlist/ListeningGestureDetector.java b/src/com/android/documentsui/dirlist/ListeningGestureDetector.java
index 7a23d00..b743779 100644
--- a/src/com/android/documentsui/dirlist/ListeningGestureDetector.java
+++ b/src/com/android/documentsui/dirlist/ListeningGestureDetector.java
@@ -25,11 +25,9 @@
import android.view.View;
import android.view.View.OnTouchListener;
-import com.android.documentsui.Events;
-
-// Previously we listened to events with one class, only to bounce them forward
-// to GestureDetector. We're still doing that here, but with a single class
-// that reduces overall complexity in our glue code.
+// Receives event meant for both directory and empty view, and either pass them to
+// {@link UserInputHandler} for simple gestures (Single Tap, Long-Press), or intercept them for
+// other types of gestures (drag n' drop)
final class ListeningGestureDetector extends GestureDetector
implements OnItemTouchListener, OnTouchListener {
@@ -51,7 +49,7 @@
if (itemView != null && mDragHelper.onTouch(itemView, e)) {
return true;
}
- // Forward unhandled events to the GestureDetector.
+ // Forward unhandled events to UserInputHandler.
return onTouchEvent(e);
}
@@ -68,12 +66,10 @@
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {}
- // For mEmptyView right-click context menu
+ // For mEmptyView events
@Override
public boolean onTouch(View v, MotionEvent event) {
- if (event.getButtonState() == MotionEvent.BUTTON_SECONDARY) {
- return mInputHandler.onRightClick(event);
- }
- return false;
+ // Pass events to UserInputHandler.
+ return onTouchEvent(event);
}
}
\ No newline at end of file