Deprecate and remove usage of MotionEventCompat methods.
We bumped our minSdk to 14 and now most of MotionEventCompat methods and
constants are no longer needed.
Bug: 32794064
Test: ./gradlew assemble assembleAndroidTest
Change-Id: I5fc698fc8243107cd969743b7500163818f8c258
diff --git a/api/current.txt b/api/current.txt
index 28d5677..9519c8c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7354,71 +7354,71 @@
public final class MotionEventCompat {
method public static deprecated int findPointerIndex(android.view.MotionEvent, int);
- method public static int getActionIndex(android.view.MotionEvent);
- method public static int getActionMasked(android.view.MotionEvent);
- method public static float getAxisValue(android.view.MotionEvent, int);
- method public static float getAxisValue(android.view.MotionEvent, int, int);
- method public static int getButtonState(android.view.MotionEvent);
+ method public static deprecated int getActionIndex(android.view.MotionEvent);
+ method public static deprecated int getActionMasked(android.view.MotionEvent);
+ method public static deprecated float getAxisValue(android.view.MotionEvent, int);
+ method public static deprecated float getAxisValue(android.view.MotionEvent, int, int);
+ method public static deprecated int getButtonState(android.view.MotionEvent);
method public static deprecated int getPointerCount(android.view.MotionEvent);
method public static deprecated int getPointerId(android.view.MotionEvent, int);
method public static deprecated int getSource(android.view.MotionEvent);
method public static deprecated float getX(android.view.MotionEvent, int);
method public static deprecated float getY(android.view.MotionEvent, int);
method public static boolean isFromSource(android.view.MotionEvent, int);
- field public static final int ACTION_HOVER_ENTER = 9; // 0x9
- field public static final int ACTION_HOVER_EXIT = 10; // 0xa
- field public static final int ACTION_HOVER_MOVE = 7; // 0x7
- field public static final int ACTION_MASK = 255; // 0xff
- field public static final int ACTION_POINTER_DOWN = 5; // 0x5
- field public static final int ACTION_POINTER_INDEX_MASK = 65280; // 0xff00
- field public static final int ACTION_POINTER_INDEX_SHIFT = 8; // 0x8
- field public static final int ACTION_POINTER_UP = 6; // 0x6
- field public static final int ACTION_SCROLL = 8; // 0x8
- field public static final int AXIS_BRAKE = 23; // 0x17
- field public static final int AXIS_DISTANCE = 24; // 0x18
- field public static final int AXIS_GAS = 22; // 0x16
- field public static final int AXIS_GENERIC_1 = 32; // 0x20
- field public static final int AXIS_GENERIC_10 = 41; // 0x29
- field public static final int AXIS_GENERIC_11 = 42; // 0x2a
- field public static final int AXIS_GENERIC_12 = 43; // 0x2b
- field public static final int AXIS_GENERIC_13 = 44; // 0x2c
- field public static final int AXIS_GENERIC_14 = 45; // 0x2d
- field public static final int AXIS_GENERIC_15 = 46; // 0x2e
- field public static final int AXIS_GENERIC_16 = 47; // 0x2f
- field public static final int AXIS_GENERIC_2 = 33; // 0x21
- field public static final int AXIS_GENERIC_3 = 34; // 0x22
- field public static final int AXIS_GENERIC_4 = 35; // 0x23
- field public static final int AXIS_GENERIC_5 = 36; // 0x24
- field public static final int AXIS_GENERIC_6 = 37; // 0x25
- field public static final int AXIS_GENERIC_7 = 38; // 0x26
- field public static final int AXIS_GENERIC_8 = 39; // 0x27
- field public static final int AXIS_GENERIC_9 = 40; // 0x28
- field public static final int AXIS_HAT_X = 15; // 0xf
- field public static final int AXIS_HAT_Y = 16; // 0x10
- field public static final int AXIS_HSCROLL = 10; // 0xa
- field public static final int AXIS_LTRIGGER = 17; // 0x11
- field public static final int AXIS_ORIENTATION = 8; // 0x8
- field public static final int AXIS_PRESSURE = 2; // 0x2
+ field public static final deprecated int ACTION_HOVER_ENTER = 9; // 0x9
+ field public static final deprecated int ACTION_HOVER_EXIT = 10; // 0xa
+ field public static final deprecated int ACTION_HOVER_MOVE = 7; // 0x7
+ field public static final deprecated int ACTION_MASK = 255; // 0xff
+ field public static final deprecated int ACTION_POINTER_DOWN = 5; // 0x5
+ field public static final deprecated int ACTION_POINTER_INDEX_MASK = 65280; // 0xff00
+ field public static final deprecated int ACTION_POINTER_INDEX_SHIFT = 8; // 0x8
+ field public static final deprecated int ACTION_POINTER_UP = 6; // 0x6
+ field public static final deprecated int ACTION_SCROLL = 8; // 0x8
+ field public static final deprecated int AXIS_BRAKE = 23; // 0x17
+ field public static final deprecated int AXIS_DISTANCE = 24; // 0x18
+ field public static final deprecated int AXIS_GAS = 22; // 0x16
+ field public static final deprecated int AXIS_GENERIC_1 = 32; // 0x20
+ field public static final deprecated int AXIS_GENERIC_10 = 41; // 0x29
+ field public static final deprecated int AXIS_GENERIC_11 = 42; // 0x2a
+ field public static final deprecated int AXIS_GENERIC_12 = 43; // 0x2b
+ field public static final deprecated int AXIS_GENERIC_13 = 44; // 0x2c
+ field public static final deprecated int AXIS_GENERIC_14 = 45; // 0x2d
+ field public static final deprecated int AXIS_GENERIC_15 = 46; // 0x2e
+ field public static final deprecated int AXIS_GENERIC_16 = 47; // 0x2f
+ field public static final deprecated int AXIS_GENERIC_2 = 33; // 0x21
+ field public static final deprecated int AXIS_GENERIC_3 = 34; // 0x22
+ field public static final deprecated int AXIS_GENERIC_4 = 35; // 0x23
+ field public static final deprecated int AXIS_GENERIC_5 = 36; // 0x24
+ field public static final deprecated int AXIS_GENERIC_6 = 37; // 0x25
+ field public static final deprecated int AXIS_GENERIC_7 = 38; // 0x26
+ field public static final deprecated int AXIS_GENERIC_8 = 39; // 0x27
+ field public static final deprecated int AXIS_GENERIC_9 = 40; // 0x28
+ field public static final deprecated int AXIS_HAT_X = 15; // 0xf
+ field public static final deprecated int AXIS_HAT_Y = 16; // 0x10
+ field public static final deprecated int AXIS_HSCROLL = 10; // 0xa
+ field public static final deprecated int AXIS_LTRIGGER = 17; // 0x11
+ field public static final deprecated int AXIS_ORIENTATION = 8; // 0x8
+ field public static final deprecated int AXIS_PRESSURE = 2; // 0x2
field public static final int AXIS_RELATIVE_X = 27; // 0x1b
field public static final int AXIS_RELATIVE_Y = 28; // 0x1c
- field public static final int AXIS_RTRIGGER = 18; // 0x12
- field public static final int AXIS_RUDDER = 20; // 0x14
- field public static final int AXIS_RX = 12; // 0xc
- field public static final int AXIS_RY = 13; // 0xd
- field public static final int AXIS_RZ = 14; // 0xe
- field public static final int AXIS_SIZE = 3; // 0x3
- field public static final int AXIS_THROTTLE = 19; // 0x13
- field public static final int AXIS_TILT = 25; // 0x19
- field public static final int AXIS_TOOL_MAJOR = 6; // 0x6
- field public static final int AXIS_TOOL_MINOR = 7; // 0x7
- field public static final int AXIS_TOUCH_MAJOR = 4; // 0x4
- field public static final int AXIS_TOUCH_MINOR = 5; // 0x5
- field public static final int AXIS_VSCROLL = 9; // 0x9
- field public static final int AXIS_WHEEL = 21; // 0x15
- field public static final int AXIS_X = 0; // 0x0
- field public static final int AXIS_Y = 1; // 0x1
- field public static final int AXIS_Z = 11; // 0xb
- field public static final int BUTTON_PRIMARY = 1; // 0x1
+ field public static final deprecated int AXIS_RTRIGGER = 18; // 0x12
+ field public static final deprecated int AXIS_RUDDER = 20; // 0x14
+ field public static final deprecated int AXIS_RX = 12; // 0xc
+ field public static final deprecated int AXIS_RY = 13; // 0xd
+ field public static final deprecated int AXIS_RZ = 14; // 0xe
+ field public static final deprecated int AXIS_SIZE = 3; // 0x3
+ field public static final deprecated int AXIS_THROTTLE = 19; // 0x13
+ field public static final deprecated int AXIS_TILT = 25; // 0x19
+ field public static final deprecated int AXIS_TOOL_MAJOR = 6; // 0x6
+ field public static final deprecated int AXIS_TOOL_MINOR = 7; // 0x7
+ field public static final deprecated int AXIS_TOUCH_MAJOR = 4; // 0x4
+ field public static final deprecated int AXIS_TOUCH_MINOR = 5; // 0x5
+ field public static final deprecated int AXIS_VSCROLL = 9; // 0x9
+ field public static final deprecated int AXIS_WHEEL = 21; // 0x15
+ field public static final deprecated int AXIS_X = 0; // 0x0
+ field public static final deprecated int AXIS_Y = 1; // 0x1
+ field public static final deprecated int AXIS_Z = 11; // 0xb
+ field public static final deprecated int BUTTON_PRIMARY = 1; // 0x1
}
public abstract interface NestedScrollingChild {
diff --git a/compat/honeycomb_mr1/android/support/v4/view/MotionEventCompatHoneycombMr1.java b/compat/honeycomb_mr1/android/support/v4/view/MotionEventCompatHoneycombMr1.java
deleted file mode 100644
index ae4da58..0000000
--- a/compat/honeycomb_mr1/android/support/v4/view/MotionEventCompatHoneycombMr1.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v4.view;
-
-import android.support.annotation.RequiresApi;
-import android.view.MotionEvent;
-
-/**
- * Motion event compatibility class for API 12+.
- */
-
-@RequiresApi(12)
-class MotionEventCompatHoneycombMr1 {
- static float getAxisValue(MotionEvent event, int axis) {
- return event.getAxisValue(axis);
- }
-
- static float getAxisValue(MotionEvent event, int axis, int pointerIndex) {
- return event.getAxisValue(axis, pointerIndex);
- }
-}
diff --git a/compat/ics/android/support/v4/view/MotionEventCompatICS.java b/compat/ics/android/support/v4/view/MotionEventCompatICS.java
deleted file mode 100644
index 986bab7..0000000
--- a/compat/ics/android/support/v4/view/MotionEventCompatICS.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v4.view;
-
-import android.support.annotation.RequiresApi;
-import android.view.MotionEvent;
-
-@RequiresApi(14)
-class MotionEventCompatICS {
- public static int getButtonState(MotionEvent event) {
- return event.getButtonState();
- }
-}
diff --git a/compat/java/android/support/v4/view/GestureDetectorCompat.java b/compat/java/android/support/v4/view/GestureDetectorCompat.java
index 7b36166..fbecce9 100644
--- a/compat/java/android/support/v4/view/GestureDetectorCompat.java
+++ b/compat/java/android/support/v4/view/GestureDetectorCompat.java
@@ -233,8 +233,8 @@
mVelocityTracker.addMovement(ev);
final boolean pointerUp =
- (action & MotionEventCompat.ACTION_MASK) == MotionEventCompat.ACTION_POINTER_UP;
- final int skipIndex = pointerUp ? MotionEventCompat.getActionIndex(ev) : -1;
+ (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP;
+ final int skipIndex = pointerUp ? ev.getActionIndex() : -1;
// Determine focal point
float sumX = 0, sumY = 0;
@@ -250,22 +250,22 @@
boolean handled = false;
- switch (action & MotionEventCompat.ACTION_MASK) {
- case MotionEventCompat.ACTION_POINTER_DOWN:
+ switch (action & MotionEvent.ACTION_MASK) {
+ case MotionEvent.ACTION_POINTER_DOWN:
mDownFocusX = mLastFocusX = focusX;
mDownFocusY = mLastFocusY = focusY;
// Cancel long press and taps
cancelTaps();
break;
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
mDownFocusX = mLastFocusX = focusX;
mDownFocusY = mLastFocusY = focusY;
// Check the dot product of current velocities.
// If the pointer that left was opposing another velocity vector, clear.
mVelocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
- final int upIndex = MotionEventCompat.getActionIndex(ev);
+ final int upIndex = ev.getActionIndex();
final int id1 = ev.getPointerId(upIndex);
final float x1 = mVelocityTracker.getXVelocity(id1);
final float y1 = mVelocityTracker.getYVelocity(id1);
diff --git a/compat/java/android/support/v4/view/MotionEventCompat.java b/compat/java/android/support/v4/view/MotionEventCompat.java
index 48ce0f9..783fbcd 100644
--- a/compat/java/android/support/v4/view/MotionEventCompat.java
+++ b/compat/java/android/support/v4/view/MotionEventCompat.java
@@ -16,7 +16,6 @@
package android.support.v4.view;
-import android.os.Build;
import android.view.MotionEvent;
/**
@@ -25,253 +24,283 @@
*/
public final class MotionEventCompat {
/**
- * Interface for the full API.
- */
- interface MotionEventVersionImpl {
- float getAxisValue(MotionEvent event, int axis);
- float getAxisValue(MotionEvent event, int axis, int pointerIndex);
- int getButtonState(MotionEvent event);
- }
-
- /**
- * Interface implementation that doesn't use anything about v4 APIs.
- */
- static class BaseMotionEventVersionImpl implements MotionEventVersionImpl {
- @Override
- public float getAxisValue(MotionEvent event, int axis) {
- return 0;
- }
-
- @Override
- public float getAxisValue(MotionEvent event, int axis, int pointerIndex) {
- return 0;
- }
-
- @Override
- public int getButtonState(MotionEvent event) {
- return 0;
- }
- }
-
- /**
- * Interface implementation for devices with at least v12 APIs.
- */
- static class HoneycombMr1MotionEventVersionImpl extends BaseMotionEventVersionImpl {
-
- @Override
- public float getAxisValue(MotionEvent event, int axis) {
- return MotionEventCompatHoneycombMr1.getAxisValue(event, axis);
- }
-
- @Override
- public float getAxisValue(MotionEvent event, int axis, int pointerIndex) {
- return MotionEventCompatHoneycombMr1.getAxisValue(event, axis, pointerIndex);
- }
- }
-
-
- /**
- * Interface implementation for devices with at least v14 APIs.
- */
- private static class ICSMotionEventVersionImpl extends HoneycombMr1MotionEventVersionImpl {
- ICSMotionEventVersionImpl() {
- }
-
- @Override
- public int getButtonState(MotionEvent event) {
- return MotionEventCompatICS.getButtonState(event);
- }
- }
-
- /**
- * Select the correct implementation to use for the current platform.
- */
- static final MotionEventVersionImpl IMPL;
- static {
- if (Build.VERSION.SDK_INT >= 14) {
- IMPL = new ICSMotionEventVersionImpl();
- } else if (Build.VERSION.SDK_INT >= 12) {
- IMPL = new HoneycombMr1MotionEventVersionImpl();
- } else {
- IMPL = new BaseMotionEventVersionImpl();
- }
- }
-
- // -------------------------------------------------------------------
-
- /**
* Synonym for {@link MotionEvent#ACTION_MASK}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_MASK} directly.
*/
+ @Deprecated
public static final int ACTION_MASK = 0xff;
/**
* Synonym for {@link MotionEvent#ACTION_POINTER_DOWN}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_POINTER_DOWN} directly.
*/
+ @Deprecated
public static final int ACTION_POINTER_DOWN = 5;
/**
* Synonym for {@link MotionEvent#ACTION_POINTER_UP}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_POINTER_UP} directly.
*/
+ @Deprecated
public static final int ACTION_POINTER_UP = 6;
/**
* Synonym for {@link MotionEvent#ACTION_HOVER_MOVE}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_HOVER_MOVE} directly.
*/
+ @Deprecated
public static final int ACTION_HOVER_MOVE = 7;
/**
* Synonym for {@link MotionEvent#ACTION_SCROLL}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_SCROLL} directly.
*/
+ @Deprecated
public static final int ACTION_SCROLL = 8;
/**
* Synonym for {@link MotionEvent#ACTION_POINTER_INDEX_MASK}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_POINTER_INDEX_MASK} directly.
*/
+ @Deprecated
public static final int ACTION_POINTER_INDEX_MASK = 0xff00;
/**
* Synonym for {@link MotionEvent#ACTION_POINTER_INDEX_SHIFT}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_POINTER_INDEX_SHIFT} directly.
*/
+ @Deprecated
public static final int ACTION_POINTER_INDEX_SHIFT = 8;
/**
* Synonym for {@link MotionEvent#ACTION_HOVER_ENTER}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_HOVER_ENTER} directly.
*/
+ @Deprecated
public static final int ACTION_HOVER_ENTER = 9;
/**
* Synonym for {@link MotionEvent#ACTION_HOVER_EXIT}.
+ *
+ * @deprecated Use {@link MotionEvent#ACTION_HOVER_EXIT} directly.
*/
+ @Deprecated
public static final int ACTION_HOVER_EXIT = 10;
/**
* Synonym for {@link MotionEvent#AXIS_X}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_X} directly.
*/
+ @Deprecated
public static final int AXIS_X = 0;
/**
* Synonym for {@link MotionEvent#AXIS_Y}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_Y} directly.
*/
+ @Deprecated
public static final int AXIS_Y = 1;
/**
* Synonym for {@link MotionEvent#AXIS_PRESSURE}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_PRESSURE} directly.
*/
+ @Deprecated
public static final int AXIS_PRESSURE = 2;
/**
* Synonym for {@link MotionEvent#AXIS_SIZE}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_SIZE} directly.
*/
+ @Deprecated
public static final int AXIS_SIZE = 3;
/**
* Synonym for {@link MotionEvent#AXIS_TOUCH_MAJOR}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_TOUCH_MAJOR} directly.
*/
+ @Deprecated
public static final int AXIS_TOUCH_MAJOR = 4;
/**
* Synonym for {@link MotionEvent#AXIS_TOUCH_MINOR}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_TOUCH_MINOR} directly.
*/
+ @Deprecated
public static final int AXIS_TOUCH_MINOR = 5;
/**
* Synonym for {@link MotionEvent#AXIS_TOOL_MAJOR}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_TOOL_MAJOR} directly.
*/
+ @Deprecated
public static final int AXIS_TOOL_MAJOR = 6;
/**
* Synonym for {@link MotionEvent#AXIS_TOOL_MINOR}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_TOOL_MINOR} directly.
*/
+ @Deprecated
public static final int AXIS_TOOL_MINOR = 7;
/**
* Synonym for {@link MotionEvent#AXIS_ORIENTATION}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_ORIENTATION} directly.
*/
+ @Deprecated
public static final int AXIS_ORIENTATION = 8;
/**
* Synonym for {@link MotionEvent#AXIS_VSCROLL}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_VSCROLL} directly.
*/
+ @Deprecated
public static final int AXIS_VSCROLL = 9;
/**
* Synonym for {@link MotionEvent#AXIS_HSCROLL}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_HSCROLL} directly.
*/
+ @Deprecated
public static final int AXIS_HSCROLL = 10;
/**
* Synonym for {@link MotionEvent#AXIS_Z}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_Z} directly.
*/
+ @Deprecated
public static final int AXIS_Z = 11;
/**
* Synonym for {@link MotionEvent#AXIS_RX}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_RX} directly.
*/
+ @Deprecated
public static final int AXIS_RX = 12;
/**
* Synonym for {@link MotionEvent#AXIS_RY}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_RY} directly.
*/
+ @Deprecated
public static final int AXIS_RY = 13;
/**
* Synonym for {@link MotionEvent#AXIS_RZ}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_RZ} directly.
*/
+ @Deprecated
public static final int AXIS_RZ = 14;
/**
* Synonym for {@link MotionEvent#AXIS_HAT_X}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_HAT_X} directly.
*/
+ @Deprecated
public static final int AXIS_HAT_X = 15;
/**
* Synonym for {@link MotionEvent#AXIS_HAT_Y}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_HAT_Y} directly.
*/
+ @Deprecated
public static final int AXIS_HAT_Y = 16;
/**
* Synonym for {@link MotionEvent#AXIS_LTRIGGER}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_LTRIGGER} directly.
*/
+ @Deprecated
public static final int AXIS_LTRIGGER = 17;
/**
* Synonym for {@link MotionEvent#AXIS_RTRIGGER}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_RTRIGGER} directly.
*/
+ @Deprecated
public static final int AXIS_RTRIGGER = 18;
/**
* Synonym for {@link MotionEvent#AXIS_THROTTLE}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_THROTTLE} directly.
*/
+ @Deprecated
public static final int AXIS_THROTTLE = 19;
/**
* Synonym for {@link MotionEvent#AXIS_RUDDER}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_RUDDER} directly.
*/
+ @Deprecated
public static final int AXIS_RUDDER = 20;
/**
* Synonym for {@link MotionEvent#AXIS_WHEEL}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_WHEEL} directly.
*/
+ @Deprecated
public static final int AXIS_WHEEL = 21;
/**
* Synonym for {@link MotionEvent#AXIS_GAS}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GAS} directly.
*/
+ @Deprecated
public static final int AXIS_GAS = 22;
/**
* Synonym for {@link MotionEvent#AXIS_BRAKE}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_BRAKE} directly.
*/
+ @Deprecated
public static final int AXIS_BRAKE = 23;
/**
* Synonym for {@link MotionEvent#AXIS_DISTANCE}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_DISTANCE} directly.
*/
+ @Deprecated
public static final int AXIS_DISTANCE = 24;
/**
* Synonym for {@link MotionEvent#AXIS_TILT}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_TILT} directly.
*/
+ @Deprecated
public static final int AXIS_TILT = 25;
/**
@@ -286,104 +315,162 @@
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_1}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_1} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_1 = 32;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_2}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_2} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_2 = 33;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_3}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_3} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_3 = 34;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_4}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_4} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_4 = 35;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_5}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_5} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_5 = 36;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_6}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_6} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_6 = 37;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_7}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_7} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_7 = 38;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_8}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_8} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_8 = 39;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_9}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_9} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_9 = 40;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_10}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_10} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_10 = 41;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_11}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_11} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_11 = 42;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_12}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_12} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_12 = 43;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_13}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_13} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_13 = 44;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_14}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_14} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_14 = 45;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_15}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_15} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_15 = 46;
/**
* Synonym for {@link MotionEvent#AXIS_GENERIC_16}.
+ *
+ * @deprecated Use {@link MotionEvent#AXIS_GENERIC_16} directly.
*/
+ @Deprecated
public static final int AXIS_GENERIC_16 = 47;
/**
* Synonym for {@link MotionEvent#BUTTON_PRIMARY}.
+ *
+ * @deprecated Use {@link MotionEvent#BUTTON_PRIMARY} directly.
*/
+ @Deprecated
public static final int BUTTON_PRIMARY = 1;
/**
* Call {@link MotionEvent#getAction}, returning only the {@link #ACTION_MASK}
* portion.
+ *
+ * @deprecated Call {@link MotionEvent#getAction()} directly. This method will be
+ * removed in a future release.
*/
+ @Deprecated
public static int getActionMasked(MotionEvent event) {
- return event.getAction() & ACTION_MASK;
+ return event.getActionMasked();
}
/**
* Call {@link MotionEvent#getAction}, returning only the pointer index
- * portion
+ * portion.
+ *
+ * @deprecated Call {@link MotionEvent#getActionIndex()} directly. This method will be
+ * removed in a future release.
*/
+ @Deprecated
public static int getActionIndex(MotionEvent event) {
- return (event.getAction() & ACTION_POINTER_INDEX_MASK)
- >> ACTION_POINTER_INDEX_SHIFT;
+ return event.getActionIndex();
}
/**
@@ -470,9 +557,13 @@
*
* @see #AXIS_X
* @see #AXIS_Y
+ *
+ * @deprecated Call {@link MotionEvent#getAxisValue(int)} directly. This method will be
+ * removed in a future release.
*/
+ @Deprecated
public static float getAxisValue(MotionEvent event, int axis) {
- return IMPL.getAxisValue(event, axis);
+ return event.getAxisValue(axis);
}
/**
@@ -486,18 +577,22 @@
*
* @see #AXIS_X
* @see #AXIS_Y
+ *
+ * @deprecated Call {@link MotionEvent#getAxisValue(int, int)} directly. This method will be
+ * removed in a future release.
*/
+ @Deprecated
public static float getAxisValue(MotionEvent event, int axis, int pointerIndex) {
- return IMPL.getAxisValue(event, axis, pointerIndex);
+ return event.getAxisValue(axis, pointerIndex);
}
/**
- *
- * @param event
- * @return
+ * @deprecated Call {@link MotionEvent#getButtonState()} directly. This method will be
+ * removed in a future release.
*/
+ @Deprecated
public static int getButtonState(MotionEvent event) {
- return IMPL.getButtonState(event);
+ return event.getButtonState();
}
private MotionEventCompat() {}
diff --git a/core-ui/java/android/support/v4/view/ViewPager.java b/core-ui/java/android/support/v4/view/ViewPager.java
index c897789..f88b53e 100644
--- a/core-ui/java/android/support/v4/view/ViewPager.java
+++ b/core-ui/java/android/support/v4/view/ViewPager.java
@@ -2020,7 +2020,7 @@
* scrolling there.
*/
- final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;
+ final int action = ev.getAction() & MotionEvent.ACTION_MASK;
// Always take care of the touch gesture being complete.
if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
@@ -2136,7 +2136,7 @@
break;
}
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
@@ -2181,7 +2181,7 @@
final int action = ev.getAction();
boolean needsInvalidate = false;
- switch (action & MotionEventCompat.ACTION_MASK) {
+ switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
mScroller.abortAnimation();
mPopulatePending = false;
@@ -2263,14 +2263,14 @@
needsInvalidate = resetTouch();
}
break;
- case MotionEventCompat.ACTION_POINTER_DOWN: {
- final int index = MotionEventCompat.getActionIndex(ev);
+ case MotionEvent.ACTION_POINTER_DOWN: {
+ final int index = ev.getActionIndex();
final float x = ev.getX(index);
mLastMotionX = x;
mActivePointerId = ev.getPointerId(index);
break;
}
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
break;
@@ -2629,7 +2629,7 @@
}
private void onSecondaryPointerUp(MotionEvent ev) {
- final int pointerIndex = MotionEventCompat.getActionIndex(ev);
+ final int pointerIndex = ev.getActionIndex();
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose a new
diff --git a/core-ui/java/android/support/v4/widget/AutoScrollHelper.java b/core-ui/java/android/support/v4/widget/AutoScrollHelper.java
index 4291a25..74e488a 100644
--- a/core-ui/java/android/support/v4/widget/AutoScrollHelper.java
+++ b/core-ui/java/android/support/v4/widget/AutoScrollHelper.java
@@ -18,7 +18,6 @@
import android.content.res.Resources;
import android.os.SystemClock;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
@@ -457,7 +456,7 @@
return false;
}
- final int action = MotionEventCompat.getActionMasked(event);
+ final int action = event.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
mNeedsCancel = true;
diff --git a/core-ui/java/android/support/v4/widget/DrawerLayout.java b/core-ui/java/android/support/v4/widget/DrawerLayout.java
index f48b036..eb5a446 100644
--- a/core-ui/java/android/support/v4/widget/DrawerLayout.java
+++ b/core-ui/java/android/support/v4/widget/DrawerLayout.java
@@ -41,7 +41,6 @@
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.GravityCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewGroupCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
@@ -1434,7 +1433,7 @@
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
// "|" used deliberately here; both methods should be invoked.
final boolean interceptForDrag = mLeftDragger.shouldInterceptTouchEvent(ev)
@@ -1487,7 +1486,7 @@
final int action = ev.getAction();
boolean wantTouchEvents = true;
- switch (action & MotionEventCompat.ACTION_MASK) {
+ switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
final float x = ev.getX();
final float y = ev.getY();
diff --git a/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java b/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java
index 526575c..a9bc39b 100644
--- a/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java
+++ b/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java
@@ -24,7 +24,6 @@
import android.support.v4.util.SparseArrayCompat;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.KeyEventCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewCompat.FocusDirection;
import android.support.v4.view.ViewCompat.FocusRealDirection;
@@ -185,12 +184,12 @@
}
switch (event.getAction()) {
- case MotionEventCompat.ACTION_HOVER_MOVE:
- case MotionEventCompat.ACTION_HOVER_ENTER:
+ case MotionEvent.ACTION_HOVER_MOVE:
+ case MotionEvent.ACTION_HOVER_ENTER:
final int virtualViewId = getVirtualViewAt(event.getX(), event.getY());
updateHoveredVirtualView(virtualViewId);
return (virtualViewId != INVALID_ID);
- case MotionEventCompat.ACTION_HOVER_EXIT:
+ case MotionEvent.ACTION_HOVER_EXIT:
if (mAccessibilityFocusedVirtualViewId != INVALID_ID) {
updateHoveredVirtualView(INVALID_ID);
return true;
diff --git a/core-ui/java/android/support/v4/widget/NestedScrollView.java b/core-ui/java/android/support/v4/widget/NestedScrollView.java
index da44ccb..2cfd551 100644
--- a/core-ui/java/android/support/v4/widget/NestedScrollView.java
+++ b/core-ui/java/android/support/v4/widget/NestedScrollView.java
@@ -29,7 +29,6 @@
import android.support.annotation.RestrictTo;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.InputDeviceCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.NestedScrollingParent;
@@ -623,7 +622,7 @@
return true;
}
- switch (action & MotionEventCompat.ACTION_MASK) {
+ switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE: {
/*
* mIsBeingDragged == false, otherwise the shortcut would have caught it. Check
@@ -704,7 +703,7 @@
}
stopNestedScroll();
break;
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
@@ -722,7 +721,7 @@
MotionEvent vtev = MotionEvent.obtain(ev);
- final int actionMasked = MotionEventCompat.getActionMasked(ev);
+ final int actionMasked = ev.getActionMasked();
if (actionMasked == MotionEvent.ACTION_DOWN) {
mNestedYOffset = 0;
@@ -855,13 +854,13 @@
mActivePointerId = INVALID_POINTER;
endDrag();
break;
- case MotionEventCompat.ACTION_POINTER_DOWN: {
- final int index = MotionEventCompat.getActionIndex(ev);
+ case MotionEvent.ACTION_POINTER_DOWN: {
+ final int index = ev.getActionIndex();
mLastMotionY = (int) ev.getY(index);
mActivePointerId = ev.getPointerId(index);
break;
}
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionY = (int) ev.getY(ev.findPointerIndex(mActivePointerId));
break;
@@ -875,8 +874,7 @@
}
private void onSecondaryPointerUp(MotionEvent ev) {
- final int pointerIndex = (ev.getAction() & MotionEventCompat.ACTION_POINTER_INDEX_MASK)
- >> MotionEventCompat.ACTION_POINTER_INDEX_SHIFT;
+ final int pointerIndex = ev.getActionIndex();
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose a new
@@ -894,10 +892,9 @@
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDeviceCompat.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
- case MotionEventCompat.ACTION_SCROLL: {
+ case MotionEvent.ACTION_SCROLL: {
if (!mIsBeingDragged) {
- final float vscroll = MotionEventCompat.getAxisValue(event,
- MotionEventCompat.AXIS_VSCROLL);
+ final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vscroll != 0) {
final int delta = (int) (vscroll * getVerticalScrollFactorCompat());
final int range = getScrollRange();
diff --git a/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java b/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
index 00b5bd0..e13bc61 100644
--- a/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
+++ b/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
@@ -36,7 +36,6 @@
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.AccessibilityDelegateCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.util.AttributeSet;
@@ -766,7 +765,7 @@
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
// Preserve the open state based on the last view that was touched.
if (!mCanSlide && action == MotionEvent.ACTION_DOWN && getChildCount() > 1) {
@@ -832,10 +831,9 @@
mDragHelper.processTouchEvent(ev);
- final int action = ev.getAction();
boolean wantTouchEvents = true;
- switch (action & MotionEventCompat.ACTION_MASK) {
+ switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
final float x = ev.getX();
final float y = ev.getY();
diff --git a/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java b/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java
index 4f5b6f1..8ccbe95 100644
--- a/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java
+++ b/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java
@@ -24,7 +24,6 @@
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.v4.content.ContextCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.NestedScrollingParent;
@@ -678,7 +677,7 @@
public boolean onInterceptTouchEvent(MotionEvent ev) {
ensureTarget();
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
int pointerIndex;
if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
@@ -718,7 +717,7 @@
startDragging(y);
break;
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
@@ -984,7 +983,7 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
int pointerIndex = -1;
if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
@@ -1023,8 +1022,8 @@
}
break;
}
- case MotionEventCompat.ACTION_POINTER_DOWN: {
- pointerIndex = MotionEventCompat.getActionIndex(ev);
+ case MotionEvent.ACTION_POINTER_DOWN: {
+ pointerIndex = ev.getActionIndex();
if (pointerIndex < 0) {
Log.e(LOG_TAG,
"Got ACTION_POINTER_DOWN event but have an invalid action index.");
@@ -1034,7 +1033,7 @@
break;
}
- case MotionEventCompat.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
@@ -1159,7 +1158,7 @@
}
private void onSecondaryPointerUp(MotionEvent ev) {
- final int pointerIndex = MotionEventCompat.getActionIndex(ev);
+ final int pointerIndex = ev.getActionIndex();
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose a new
diff --git a/core-ui/java/android/support/v4/widget/ViewDragHelper.java b/core-ui/java/android/support/v4/widget/ViewDragHelper.java
index 5833708..29ff799 100644
--- a/core-ui/java/android/support/v4/widget/ViewDragHelper.java
+++ b/core-ui/java/android/support/v4/widget/ViewDragHelper.java
@@ -18,7 +18,6 @@
package android.support.v4.widget;
import android.content.Context;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.Log;
import android.view.MotionEvent;
@@ -950,8 +949,8 @@
* @return true if the parent view should return true from onInterceptTouchEvent
*/
public boolean shouldInterceptTouchEvent(MotionEvent ev) {
- final int action = MotionEventCompat.getActionMasked(ev);
- final int actionIndex = MotionEventCompat.getActionIndex(ev);
+ final int action = ev.getActionMasked();
+ final int actionIndex = ev.getActionIndex();
if (action == MotionEvent.ACTION_DOWN) {
// Reset things for a new event stream, just in case we didn't get
@@ -985,7 +984,7 @@
break;
}
- case MotionEventCompat.ACTION_POINTER_DOWN: {
+ case MotionEvent.ACTION_POINTER_DOWN: {
final int pointerId = ev.getPointerId(actionIndex);
final float x = ev.getX(actionIndex);
final float y = ev.getY(actionIndex);
@@ -1063,7 +1062,7 @@
break;
}
- case MotionEventCompat.ACTION_POINTER_UP: {
+ case MotionEvent.ACTION_POINTER_UP: {
final int pointerId = ev.getPointerId(actionIndex);
clearMotionHistory(pointerId);
break;
@@ -1086,8 +1085,8 @@
* @param ev The touch event received by the parent view
*/
public void processTouchEvent(MotionEvent ev) {
- final int action = MotionEventCompat.getActionMasked(ev);
- final int actionIndex = MotionEventCompat.getActionIndex(ev);
+ final int action = ev.getActionMasked();
+ final int actionIndex = ev.getActionIndex();
if (action == MotionEvent.ACTION_DOWN) {
// Reset things for a new event stream, just in case we didn't get
@@ -1121,7 +1120,7 @@
break;
}
- case MotionEventCompat.ACTION_POINTER_DOWN: {
+ case MotionEvent.ACTION_POINTER_DOWN: {
final int pointerId = ev.getPointerId(actionIndex);
final float x = ev.getX(actionIndex);
final float y = ev.getY(actionIndex);
@@ -1194,7 +1193,7 @@
break;
}
- case MotionEventCompat.ACTION_POINTER_UP: {
+ case MotionEvent.ACTION_POINTER_UP: {
final int pointerId = ev.getPointerId(actionIndex);
if (mDragState == STATE_DRAGGING && pointerId == mActivePointerId) {
// Try to find another pointer that's still holding on to the captured view.
diff --git a/design/src/android/support/design/widget/BottomSheetBehavior.java b/design/src/android/support/design/widget/BottomSheetBehavior.java
index a69b8bd..1c4c860 100644
--- a/design/src/android/support/design/widget/BottomSheetBehavior.java
+++ b/design/src/android/support/design/widget/BottomSheetBehavior.java
@@ -30,7 +30,6 @@
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.AbsSavedState;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
import android.util.AttributeSet;
@@ -259,7 +258,7 @@
mIgnoreEvents = true;
return false;
}
- int action = MotionEventCompat.getActionMasked(event);
+ int action = event.getActionMasked();
// Record the velocity
if (action == MotionEvent.ACTION_DOWN) {
reset();
@@ -309,7 +308,7 @@
if (!child.isShown()) {
return false;
}
- int action = MotionEventCompat.getActionMasked(event);
+ int action = event.getActionMasked();
if (mState == STATE_DRAGGING && action == MotionEvent.ACTION_DOWN) {
return true;
}
diff --git a/design/src/android/support/design/widget/CoordinatorLayout.java b/design/src/android/support/design/widget/CoordinatorLayout.java
index ada6a0e..8a2c4f2 100644
--- a/design/src/android/support/design/widget/CoordinatorLayout.java
+++ b/design/src/android/support/design/widget/CoordinatorLayout.java
@@ -50,7 +50,6 @@
import android.support.v4.util.Pools;
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.GravityCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingParent;
import android.support.v4.view.NestedScrollingParentHelper;
import android.support.v4.view.ViewCompat;
@@ -421,7 +420,7 @@
MotionEvent cancelEvent = null;
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
final List<View> topmostChildList = mTempList1;
getTopSortedChildren(topmostChildList);
@@ -489,7 +488,7 @@
public boolean onInterceptTouchEvent(MotionEvent ev) {
MotionEvent cancelEvent = null;
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
// Make sure we reset in case we had missed a previous important event.
if (action == MotionEvent.ACTION_DOWN) {
@@ -515,7 +514,7 @@
boolean cancelSuper = false;
MotionEvent cancelEvent = null;
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
if (mBehaviorTouchView != null || (cancelSuper = performIntercept(ev, TYPE_ON_TOUCH))) {
// Safe since performIntercept guarantees that
diff --git a/design/src/android/support/design/widget/HeaderBehavior.java b/design/src/android/support/design/widget/HeaderBehavior.java
index 31dab82..3420bd4 100644
--- a/design/src/android/support/design/widget/HeaderBehavior.java
+++ b/design/src/android/support/design/widget/HeaderBehavior.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.support.design.widget.CoordinatorLayout.Behavior;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ScrollerCompat;
import android.util.AttributeSet;
@@ -63,7 +62,7 @@
return true;
}
- switch (MotionEventCompat.getActionMasked(ev)) {
+ switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
mIsBeingDragged = false;
final int x = (int) ev.getX();
@@ -121,7 +120,7 @@
mTouchSlop = ViewConfiguration.get(parent.getContext()).getScaledTouchSlop();
}
- switch (MotionEventCompat.getActionMasked(ev)) {
+ switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
final int x = (int) ev.getX();
final int y = (int) ev.getY();
diff --git a/design/src/android/support/design/widget/SwipeDismissBehavior.java b/design/src/android/support/design/widget/SwipeDismissBehavior.java
index fed5332..d857334 100644
--- a/design/src/android/support/design/widget/SwipeDismissBehavior.java
+++ b/design/src/android/support/design/widget/SwipeDismissBehavior.java
@@ -21,7 +21,6 @@
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
import android.view.MotionEvent;
@@ -174,7 +173,7 @@
public boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) {
boolean dispatchEventToHelper = mInterceptingEvents;
- switch (MotionEventCompat.getActionMasked(event)) {
+ switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
mInterceptingEvents = parent.isPointInChildBounds(child,
(int) event.getX(), (int) event.getY());
diff --git a/design/tests/src/android/support/design/widget/BottomSheetBehaviorTouchTest.java b/design/tests/src/android/support/design/widget/BottomSheetBehaviorTouchTest.java
index 4e3bbf5..51ab0fa 100644
--- a/design/tests/src/android/support/design/widget/BottomSheetBehaviorTouchTest.java
+++ b/design/tests/src/android/support/design/widget/BottomSheetBehaviorTouchTest.java
@@ -28,7 +28,6 @@
import android.support.test.espresso.ViewAssertion;
import android.support.test.espresso.action.ViewActions;
import android.support.test.filters.MediumTest;
-import android.support.v4.view.MotionEventCompat;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
@@ -52,7 +51,7 @@
@Override
public boolean onTouch(View v, MotionEvent event) {
- switch (MotionEventCompat.getActionMasked(event)) {
+ switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
mDown = true;
break;
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/DragAndDropActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/DragAndDropActivity.java
index 7daa3eb..ee092c3 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/DragAndDropActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/DragAndDropActivity.java
@@ -16,19 +16,16 @@
package com.example.android.supportv7.widget.touch;
-import com.example.android.supportv7.R;
-import com.example.android.supportv7.widget.util.ConfigToggle;
-
-import android.annotation.TargetApi;
-import android.os.Build;
import android.support.v4.content.ContextCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import com.example.android.supportv7.R;
+import com.example.android.supportv7.widget.util.ConfigToggle;
+
public class DragAndDropActivity extends ItemTouchHelperActivity {
boolean mDragUpEnabled = true;
@@ -112,7 +109,7 @@
vh.actionButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
- if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
mItemTouchHelper.startDrag(vh);
}
return false;
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/SwipeToDismissActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/SwipeToDismissActivity.java
index 7444c23..14a7495 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/SwipeToDismissActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/touch/SwipeToDismissActivity.java
@@ -16,20 +16,19 @@
package com.example.android.supportv7.widget.touch;
-import com.example.android.supportv7.R;
-import com.example.android.supportv7.widget.util.ConfigToggle;
-
import android.annotation.TargetApi;
import android.graphics.Canvas;
import android.os.Build;
import android.support.v4.content.ContextCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import com.example.android.supportv7.R;
+import com.example.android.supportv7.widget.util.ConfigToggle;
+
public class SwipeToDismissActivity extends ItemTouchHelperActivity {
boolean mSwipeStartEnabled = true;
boolean mSwipeEndEnabled = true;
@@ -153,7 +152,7 @@
vh.actionButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
- if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
mItemTouchHelper.startSwipe(vh);
}
return false;
diff --git a/v13/java/android/support/v13/view/DragStartHelper.java b/v13/java/android/support/v13/view/DragStartHelper.java
index d32f9f7..5180996 100644
--- a/v13/java/android/support/v13/view/DragStartHelper.java
+++ b/v13/java/android/support/v13/view/DragStartHelper.java
@@ -140,8 +140,8 @@
case MotionEvent.ACTION_MOVE:
if (!MotionEventCompat.isFromSource(event, InputDeviceCompat.SOURCE_MOUSE)
- || (MotionEventCompat.getButtonState(event)
- & MotionEventCompat.BUTTON_PRIMARY) == 0) {
+ || (event.getButtonState()
+ & MotionEvent.BUTTON_PRIMARY) == 0) {
break;
}
if (mDragging) {
diff --git a/v7/appcompat/src/android/support/v7/widget/AbsActionBarView.java b/v7/appcompat/src/android/support/v7/widget/AbsActionBarView.java
index 413f47f..bab60c4 100644
--- a/v7/appcompat/src/android/support/v7/widget/AbsActionBarView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AbsActionBarView.java
@@ -19,7 +19,6 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
@@ -91,7 +90,7 @@
// eat the rest of the gesture without reporting the events to the default implementation
// since that's what it expects.
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
mEatingTouch = false;
}
@@ -115,19 +114,19 @@
// Same deal as onTouchEvent() above. Eat all hover events, but still
// respect the touch event dispatch contract.
- final int action = MotionEventCompat.getActionMasked(ev);
- if (action == MotionEventCompat.ACTION_HOVER_ENTER) {
+ final int action = ev.getActionMasked();
+ if (action == MotionEvent.ACTION_HOVER_ENTER) {
mEatingHover = false;
}
if (!mEatingHover) {
final boolean handled = super.onHoverEvent(ev);
- if (action == MotionEventCompat.ACTION_HOVER_ENTER && !handled) {
+ if (action == MotionEvent.ACTION_HOVER_ENTER && !handled) {
mEatingHover = true;
}
}
- if (action == MotionEventCompat.ACTION_HOVER_EXIT
+ if (action == MotionEvent.ACTION_HOVER_EXIT
|| action == MotionEvent.ACTION_CANCEL) {
mEatingHover = false;
}
diff --git a/v7/appcompat/src/android/support/v7/widget/DropDownListView.java b/v7/appcompat/src/android/support/v7/widget/DropDownListView.java
index f6a75f7..5cad340 100644
--- a/v7/appcompat/src/android/support/v7/widget/DropDownListView.java
+++ b/v7/appcompat/src/android/support/v7/widget/DropDownListView.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.os.Build;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.widget.ListViewAutoScrollHelper;
import android.support.v7.appcompat.R;
@@ -98,7 +97,7 @@
boolean handledEvent = true;
boolean clearPressedItem = false;
- final int actionMasked = MotionEventCompat.getActionMasked(event);
+ final int actionMasked = event.getActionMasked();
switch (actionMasked) {
case MotionEvent.ACTION_CANCEL:
handledEvent = false;
diff --git a/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java b/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java
index fa5e02c..849b86c 100644
--- a/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java
+++ b/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java
@@ -22,7 +22,6 @@
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.view.menu.ShowableListMenu;
import android.view.MotionEvent;
@@ -204,7 +203,7 @@
return false;
}
- final int actionMasked = MotionEventCompat.getActionMasked(srcEvent);
+ final int actionMasked = srcEvent.getActionMasked();
switch (actionMasked) {
case MotionEvent.ACTION_DOWN:
mActivePointerId = srcEvent.getPointerId(0);
@@ -309,7 +308,7 @@
dstEvent.recycle();
// Always cancel forwarding when the touch stream ends.
- final int action = MotionEventCompat.getActionMasked(srcEvent);
+ final int action = srcEvent.getActionMasked();
final boolean keepForwarding = action != MotionEvent.ACTION_UP
&& action != MotionEvent.ACTION_CANCEL;
diff --git a/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java b/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
index 3ed014d..6042485 100644
--- a/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
+++ b/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
@@ -29,7 +29,6 @@
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.graphics.drawable.DrawableCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R;
import android.support.v7.content.res.AppCompatResources;
@@ -887,7 +886,7 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
mVelocityTracker.addMovement(ev);
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN: {
final float x = ev.getX();
diff --git a/v7/appcompat/src/android/support/v7/widget/Toolbar.java b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
index 8c39331..0f44761 100644
--- a/v7/appcompat/src/android/support/v7/widget/Toolbar.java
+++ b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
@@ -37,7 +37,6 @@
import android.support.v4.view.GravityCompat;
import android.support.v4.view.MarginLayoutParamsCompat;
import android.support.v4.view.MenuItemCompat;
-import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.appcompat.R;
@@ -1460,7 +1459,7 @@
// eat the rest of the gesture without reporting the events to the default implementation
// since that's what it expects.
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
mEatingTouch = false;
}
@@ -1484,7 +1483,7 @@
// Same deal as onTouchEvent() above. Eat all hover events, but still
// respect the touch event dispatch contract.
- final int action = MotionEventCompat.getActionMasked(ev);
+ final int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_HOVER_ENTER) {
mEatingHover = false;
}