Loading packages/DocumentsUI/src/com/android/documentsui/Events.java +1 −28 Original line number Diff line number Diff line Loading @@ -35,31 +35,10 @@ public final class Events { * Returns true if event was triggered by a mouse. */ public static boolean isMouseEvent(MotionEvent e) { return isMouseType(e.getToolType(0)); } /** * Returns true if event was triggered by a finger or stylus touch. */ public static boolean isTouchEvent(MotionEvent e) { return isTouchType(e.getToolType(0)); } /** * Returns true if event was triggered by a mouse. */ public static boolean isMouseType(int toolType) { int toolType = e.getToolType(0); return toolType == MotionEvent.TOOL_TYPE_MOUSE; } /** * Returns true if event was triggered by a finger or stylus touch. */ public static boolean isTouchType(int toolType) { return toolType == MotionEvent.TOOL_TYPE_FINGER || toolType == MotionEvent.TOOL_TYPE_STYLUS; } /** * Returns true if event was triggered by a finger or stylus touch. */ Loading Loading @@ -116,7 +95,6 @@ public final class Events { * of related code. */ public interface InputEvent extends AutoCloseable { boolean isTouchEvent(); boolean isMouseEvent(); boolean isPrimaryButtonPressed(); boolean isSecondaryButtonPressed(); Loading Loading @@ -211,11 +189,6 @@ public final class Events { recycle(); } @Override public boolean isTouchEvent() { return Events.isTouchEvent(mEvent); } @Override public boolean isMouseEvent() { return Events.isMouseEvent(mEvent); Loading packages/DocumentsUI/src/com/android/documentsui/dirlist/BandController.java +4 −4 Original line number Diff line number Diff line Loading @@ -85,14 +85,14 @@ public class BandController extends RecyclerView.OnScrollListener { new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { try (MotionInputEvent event = MotionInputEvent.obtain(e, view)) { try (InputEvent event = MotionInputEvent.obtain(e, view)) { return handleEvent(event); } } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { if (Events.isMouseEvent(e)) { try (MotionInputEvent event = MotionInputEvent.obtain(e, view)) { try (InputEvent event = MotionInputEvent.obtain(e, view)) { processInputEvent(event); } } Loading Loading @@ -177,7 +177,7 @@ public class BandController extends RecyclerView.OnScrollListener { mSelection = selection; } private boolean handleEvent(MotionInputEvent e) { private boolean handleEvent(InputEvent e) { // Don't start, or extend bands on right click. if (e.isSecondaryButtonPressed()) { return false; Loading Loading @@ -230,7 +230,7 @@ public class BandController extends RecyclerView.OnScrollListener { } } boolean shouldStart(MotionInputEvent e) { boolean shouldStart(InputEvent e) { return !isActive() && e.isActionDown() // the initial button press && mAdapter.getItemCount() > 0 Loading packages/DocumentsUI/tests/src/com/android/documentsui/TestInputEvent.java +0 −5 Original line number Diff line number Diff line Loading @@ -21,11 +21,6 @@ public class TestInputEvent implements Events.InputEvent { this.position = position; } @Override public boolean isTouchEvent() { return !mouseEvent; } @Override public boolean isMouseEvent() { return mouseEvent; Loading Loading
packages/DocumentsUI/src/com/android/documentsui/Events.java +1 −28 Original line number Diff line number Diff line Loading @@ -35,31 +35,10 @@ public final class Events { * Returns true if event was triggered by a mouse. */ public static boolean isMouseEvent(MotionEvent e) { return isMouseType(e.getToolType(0)); } /** * Returns true if event was triggered by a finger or stylus touch. */ public static boolean isTouchEvent(MotionEvent e) { return isTouchType(e.getToolType(0)); } /** * Returns true if event was triggered by a mouse. */ public static boolean isMouseType(int toolType) { int toolType = e.getToolType(0); return toolType == MotionEvent.TOOL_TYPE_MOUSE; } /** * Returns true if event was triggered by a finger or stylus touch. */ public static boolean isTouchType(int toolType) { return toolType == MotionEvent.TOOL_TYPE_FINGER || toolType == MotionEvent.TOOL_TYPE_STYLUS; } /** * Returns true if event was triggered by a finger or stylus touch. */ Loading Loading @@ -116,7 +95,6 @@ public final class Events { * of related code. */ public interface InputEvent extends AutoCloseable { boolean isTouchEvent(); boolean isMouseEvent(); boolean isPrimaryButtonPressed(); boolean isSecondaryButtonPressed(); Loading Loading @@ -211,11 +189,6 @@ public final class Events { recycle(); } @Override public boolean isTouchEvent() { return Events.isTouchEvent(mEvent); } @Override public boolean isMouseEvent() { return Events.isMouseEvent(mEvent); Loading
packages/DocumentsUI/src/com/android/documentsui/dirlist/BandController.java +4 −4 Original line number Diff line number Diff line Loading @@ -85,14 +85,14 @@ public class BandController extends RecyclerView.OnScrollListener { new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { try (MotionInputEvent event = MotionInputEvent.obtain(e, view)) { try (InputEvent event = MotionInputEvent.obtain(e, view)) { return handleEvent(event); } } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { if (Events.isMouseEvent(e)) { try (MotionInputEvent event = MotionInputEvent.obtain(e, view)) { try (InputEvent event = MotionInputEvent.obtain(e, view)) { processInputEvent(event); } } Loading Loading @@ -177,7 +177,7 @@ public class BandController extends RecyclerView.OnScrollListener { mSelection = selection; } private boolean handleEvent(MotionInputEvent e) { private boolean handleEvent(InputEvent e) { // Don't start, or extend bands on right click. if (e.isSecondaryButtonPressed()) { return false; Loading Loading @@ -230,7 +230,7 @@ public class BandController extends RecyclerView.OnScrollListener { } } boolean shouldStart(MotionInputEvent e) { boolean shouldStart(InputEvent e) { return !isActive() && e.isActionDown() // the initial button press && mAdapter.getItemCount() > 0 Loading
packages/DocumentsUI/tests/src/com/android/documentsui/TestInputEvent.java +0 −5 Original line number Diff line number Diff line Loading @@ -21,11 +21,6 @@ public class TestInputEvent implements Events.InputEvent { this.position = position; } @Override public boolean isTouchEvent() { return !mouseEvent; } @Override public boolean isMouseEvent() { return mouseEvent; Loading