* commit '611136c15c54e4c9da8deea9edf55c22cd56ec0f': Add method to set action button on MotionEvent
This commit is contained in:
@@ -1399,6 +1399,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
|
|||||||
private static native int nativeGetButtonState(long nativePtr);
|
private static native int nativeGetButtonState(long nativePtr);
|
||||||
private static native void nativeSetButtonState(long nativePtr, int buttonState);
|
private static native void nativeSetButtonState(long nativePtr, int buttonState);
|
||||||
private static native int nativeGetActionButton(long nativePtr);
|
private static native int nativeGetActionButton(long nativePtr);
|
||||||
|
private static native void nativeSetActionButton(long nativePtr, int actionButton);
|
||||||
private static native void nativeOffsetLocation(long nativePtr, float deltaX, float deltaY);
|
private static native void nativeOffsetLocation(long nativePtr, float deltaX, float deltaY);
|
||||||
private static native float nativeGetXOffset(long nativePtr);
|
private static native float nativeGetXOffset(long nativePtr);
|
||||||
private static native float nativeGetYOffset(long nativePtr);
|
private static native float nativeGetYOffset(long nativePtr);
|
||||||
@@ -2283,6 +2284,16 @@ public final class MotionEvent extends InputEvent implements Parcelable {
|
|||||||
return nativeGetActionButton(mNativePtr);
|
return nativeGetActionButton(mNativePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the action button for the event.
|
||||||
|
*
|
||||||
|
* @see #getActionButton()
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final void setActionButton(int button) {
|
||||||
|
nativeSetActionButton(mNativePtr, button);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the original raw X coordinate of this event. For touch
|
* Returns the original raw X coordinate of this event. For touch
|
||||||
* events on the screen, this is the original location of the event
|
* events on the screen, this is the original location of the event
|
||||||
|
|||||||
@@ -462,6 +462,12 @@ static int android_view_MotionEvent_nativeGetActionButton(JNIEnv* env, jclass cl
|
|||||||
return event->getActionButton();
|
return event->getActionButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void android_view_MotionEvent_nativeSetActionButton(JNIEnv* env, jclass clazz,
|
||||||
|
jlong nativePtr, jint button) {
|
||||||
|
MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
|
||||||
|
event->setActionButton(button);
|
||||||
|
}
|
||||||
|
|
||||||
static jboolean android_view_MotionEvent_nativeIsTouchEvent(JNIEnv* env, jclass clazz,
|
static jboolean android_view_MotionEvent_nativeIsTouchEvent(JNIEnv* env, jclass clazz,
|
||||||
jlong nativePtr) {
|
jlong nativePtr) {
|
||||||
MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
|
MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
|
||||||
@@ -779,6 +785,9 @@ static JNINativeMethod gMotionEventMethods[] = {
|
|||||||
{ "nativeGetActionButton",
|
{ "nativeGetActionButton",
|
||||||
"(J)I",
|
"(J)I",
|
||||||
(void*)android_view_MotionEvent_nativeGetActionButton},
|
(void*)android_view_MotionEvent_nativeGetActionButton},
|
||||||
|
{ "nativeSetActionButton",
|
||||||
|
"(JI)V",
|
||||||
|
(void*)android_view_MotionEvent_nativeSetActionButton},
|
||||||
{ "nativeIsTouchEvent",
|
{ "nativeIsTouchEvent",
|
||||||
"(J)Z",
|
"(J)Z",
|
||||||
(void*)android_view_MotionEvent_nativeIsTouchEvent },
|
(void*)android_view_MotionEvent_nativeIsTouchEvent },
|
||||||
|
|||||||
Reference in New Issue
Block a user