Loading core/java/android/view/VelocityTracker.java +9 −9 Original line number Diff line number Diff line Loading @@ -34,17 +34,17 @@ public final class VelocityTracker { private static final int ACTIVE_POINTER_ID = -1; private int mPtr; private long mPtr; private final String mStrategy; private static native int nativeInitialize(String strategy); private static native void nativeDispose(int ptr); private static native void nativeClear(int ptr); private static native void nativeAddMovement(int ptr, MotionEvent event); private static native void nativeComputeCurrentVelocity(int ptr, int units, float maxVelocity); private static native float nativeGetXVelocity(int ptr, int id); private static native float nativeGetYVelocity(int ptr, int id); private static native boolean nativeGetEstimator(int ptr, int id, Estimator outEstimator); private static native long nativeInitialize(String strategy); private static native void nativeDispose(long ptr); private static native void nativeClear(long ptr); private static native void nativeAddMovement(long ptr, MotionEvent event); private static native void nativeComputeCurrentVelocity(long ptr, int units, float maxVelocity); private static native float nativeGetXVelocity(long ptr, int id); private static native float nativeGetYVelocity(long ptr, int id); private static native boolean nativeGetEstimator(long ptr, int id, Estimator outEstimator); /** * Retrieve a new VelocityTracker object to watch the velocity of a Loading core/jni/android_view_VelocityTracker.cpp +18 −18 Original line number Diff line number Diff line Loading @@ -138,26 +138,26 @@ bool VelocityTrackerState::getEstimator(int32_t id, VelocityTracker::Estimator* // --- JNI Methods --- static jint android_view_VelocityTracker_nativeInitialize(JNIEnv* env, jclass clazz, static jlong android_view_VelocityTracker_nativeInitialize(JNIEnv* env, jclass clazz, jstring strategyStr) { if (strategyStr) { ScopedUtfChars strategy(env, strategyStr); return reinterpret_cast<jint>(new VelocityTrackerState(strategy.c_str())); return reinterpret_cast<jlong>(new VelocityTrackerState(strategy.c_str())); } return reinterpret_cast<jint>(new VelocityTrackerState(NULL)); return reinterpret_cast<jlong>(new VelocityTrackerState(NULL)); } static void android_view_VelocityTracker_nativeDispose(JNIEnv* env, jclass clazz, jint ptr) { static void android_view_VelocityTracker_nativeDispose(JNIEnv* env, jclass clazz, jlong ptr) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); delete state; } static void android_view_VelocityTracker_nativeClear(JNIEnv* env, jclass clazz, jint ptr) { static void android_view_VelocityTracker_nativeClear(JNIEnv* env, jclass clazz, jlong ptr) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); state->clear(); } static void android_view_VelocityTracker_nativeAddMovement(JNIEnv* env, jclass clazz, jint ptr, static void android_view_VelocityTracker_nativeAddMovement(JNIEnv* env, jclass clazz, jlong ptr, jobject eventObj) { const MotionEvent* event = android_view_MotionEvent_getNativePtr(env, eventObj); if (!event) { Loading @@ -170,13 +170,13 @@ static void android_view_VelocityTracker_nativeAddMovement(JNIEnv* env, jclass c } static void android_view_VelocityTracker_nativeComputeCurrentVelocity(JNIEnv* env, jclass clazz, jint ptr, jint units, jfloat maxVelocity) { jlong ptr, jint units, jfloat maxVelocity) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); state->computeCurrentVelocity(units, maxVelocity); } static jfloat android_view_VelocityTracker_nativeGetXVelocity(JNIEnv* env, jclass clazz, jint ptr, jint id) { jlong ptr, jint id) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); float vx; state->getVelocity(id, &vx, NULL); Loading @@ -184,7 +184,7 @@ static jfloat android_view_VelocityTracker_nativeGetXVelocity(JNIEnv* env, jclas } static jfloat android_view_VelocityTracker_nativeGetYVelocity(JNIEnv* env, jclass clazz, jint ptr, jint id) { jlong ptr, jint id) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); float vy; state->getVelocity(id, NULL, &vy); Loading @@ -192,7 +192,7 @@ static jfloat android_view_VelocityTracker_nativeGetYVelocity(JNIEnv* env, jclas } static jboolean android_view_VelocityTracker_nativeGetEstimator(JNIEnv* env, jclass clazz, jint ptr, jint id, jobject outEstimatorObj) { jlong ptr, jint id, jobject outEstimatorObj) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); VelocityTracker::Estimator estimator; bool result = state->getEstimator(id, &estimator); Loading @@ -217,28 +217,28 @@ static jboolean android_view_VelocityTracker_nativeGetEstimator(JNIEnv* env, jcl static JNINativeMethod gVelocityTrackerMethods[] = { /* name, signature, funcPtr */ { "nativeInitialize", "(Ljava/lang/String;)I", "(Ljava/lang/String;)J", (void*)android_view_VelocityTracker_nativeInitialize }, { "nativeDispose", "(I)V", "(J)V", (void*)android_view_VelocityTracker_nativeDispose }, { "nativeClear", "(I)V", "(J)V", (void*)android_view_VelocityTracker_nativeClear }, { "nativeAddMovement", "(ILandroid/view/MotionEvent;)V", "(JLandroid/view/MotionEvent;)V", (void*)android_view_VelocityTracker_nativeAddMovement }, { "nativeComputeCurrentVelocity", "(IIF)V", "(JIF)V", (void*)android_view_VelocityTracker_nativeComputeCurrentVelocity }, { "nativeGetXVelocity", "(II)F", "(JI)F", (void*)android_view_VelocityTracker_nativeGetXVelocity }, { "nativeGetYVelocity", "(II)F", "(JI)F", (void*)android_view_VelocityTracker_nativeGetYVelocity }, { "nativeGetEstimator", "(IILandroid/view/VelocityTracker$Estimator;)Z", "(JILandroid/view/VelocityTracker$Estimator;)Z", (void*)android_view_VelocityTracker_nativeGetEstimator }, }; Loading Loading
core/java/android/view/VelocityTracker.java +9 −9 Original line number Diff line number Diff line Loading @@ -34,17 +34,17 @@ public final class VelocityTracker { private static final int ACTIVE_POINTER_ID = -1; private int mPtr; private long mPtr; private final String mStrategy; private static native int nativeInitialize(String strategy); private static native void nativeDispose(int ptr); private static native void nativeClear(int ptr); private static native void nativeAddMovement(int ptr, MotionEvent event); private static native void nativeComputeCurrentVelocity(int ptr, int units, float maxVelocity); private static native float nativeGetXVelocity(int ptr, int id); private static native float nativeGetYVelocity(int ptr, int id); private static native boolean nativeGetEstimator(int ptr, int id, Estimator outEstimator); private static native long nativeInitialize(String strategy); private static native void nativeDispose(long ptr); private static native void nativeClear(long ptr); private static native void nativeAddMovement(long ptr, MotionEvent event); private static native void nativeComputeCurrentVelocity(long ptr, int units, float maxVelocity); private static native float nativeGetXVelocity(long ptr, int id); private static native float nativeGetYVelocity(long ptr, int id); private static native boolean nativeGetEstimator(long ptr, int id, Estimator outEstimator); /** * Retrieve a new VelocityTracker object to watch the velocity of a Loading
core/jni/android_view_VelocityTracker.cpp +18 −18 Original line number Diff line number Diff line Loading @@ -138,26 +138,26 @@ bool VelocityTrackerState::getEstimator(int32_t id, VelocityTracker::Estimator* // --- JNI Methods --- static jint android_view_VelocityTracker_nativeInitialize(JNIEnv* env, jclass clazz, static jlong android_view_VelocityTracker_nativeInitialize(JNIEnv* env, jclass clazz, jstring strategyStr) { if (strategyStr) { ScopedUtfChars strategy(env, strategyStr); return reinterpret_cast<jint>(new VelocityTrackerState(strategy.c_str())); return reinterpret_cast<jlong>(new VelocityTrackerState(strategy.c_str())); } return reinterpret_cast<jint>(new VelocityTrackerState(NULL)); return reinterpret_cast<jlong>(new VelocityTrackerState(NULL)); } static void android_view_VelocityTracker_nativeDispose(JNIEnv* env, jclass clazz, jint ptr) { static void android_view_VelocityTracker_nativeDispose(JNIEnv* env, jclass clazz, jlong ptr) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); delete state; } static void android_view_VelocityTracker_nativeClear(JNIEnv* env, jclass clazz, jint ptr) { static void android_view_VelocityTracker_nativeClear(JNIEnv* env, jclass clazz, jlong ptr) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); state->clear(); } static void android_view_VelocityTracker_nativeAddMovement(JNIEnv* env, jclass clazz, jint ptr, static void android_view_VelocityTracker_nativeAddMovement(JNIEnv* env, jclass clazz, jlong ptr, jobject eventObj) { const MotionEvent* event = android_view_MotionEvent_getNativePtr(env, eventObj); if (!event) { Loading @@ -170,13 +170,13 @@ static void android_view_VelocityTracker_nativeAddMovement(JNIEnv* env, jclass c } static void android_view_VelocityTracker_nativeComputeCurrentVelocity(JNIEnv* env, jclass clazz, jint ptr, jint units, jfloat maxVelocity) { jlong ptr, jint units, jfloat maxVelocity) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); state->computeCurrentVelocity(units, maxVelocity); } static jfloat android_view_VelocityTracker_nativeGetXVelocity(JNIEnv* env, jclass clazz, jint ptr, jint id) { jlong ptr, jint id) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); float vx; state->getVelocity(id, &vx, NULL); Loading @@ -184,7 +184,7 @@ static jfloat android_view_VelocityTracker_nativeGetXVelocity(JNIEnv* env, jclas } static jfloat android_view_VelocityTracker_nativeGetYVelocity(JNIEnv* env, jclass clazz, jint ptr, jint id) { jlong ptr, jint id) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); float vy; state->getVelocity(id, NULL, &vy); Loading @@ -192,7 +192,7 @@ static jfloat android_view_VelocityTracker_nativeGetYVelocity(JNIEnv* env, jclas } static jboolean android_view_VelocityTracker_nativeGetEstimator(JNIEnv* env, jclass clazz, jint ptr, jint id, jobject outEstimatorObj) { jlong ptr, jint id, jobject outEstimatorObj) { VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr); VelocityTracker::Estimator estimator; bool result = state->getEstimator(id, &estimator); Loading @@ -217,28 +217,28 @@ static jboolean android_view_VelocityTracker_nativeGetEstimator(JNIEnv* env, jcl static JNINativeMethod gVelocityTrackerMethods[] = { /* name, signature, funcPtr */ { "nativeInitialize", "(Ljava/lang/String;)I", "(Ljava/lang/String;)J", (void*)android_view_VelocityTracker_nativeInitialize }, { "nativeDispose", "(I)V", "(J)V", (void*)android_view_VelocityTracker_nativeDispose }, { "nativeClear", "(I)V", "(J)V", (void*)android_view_VelocityTracker_nativeClear }, { "nativeAddMovement", "(ILandroid/view/MotionEvent;)V", "(JLandroid/view/MotionEvent;)V", (void*)android_view_VelocityTracker_nativeAddMovement }, { "nativeComputeCurrentVelocity", "(IIF)V", "(JIF)V", (void*)android_view_VelocityTracker_nativeComputeCurrentVelocity }, { "nativeGetXVelocity", "(II)F", "(JI)F", (void*)android_view_VelocityTracker_nativeGetXVelocity }, { "nativeGetYVelocity", "(II)F", "(JI)F", (void*)android_view_VelocityTracker_nativeGetYVelocity }, { "nativeGetEstimator", "(IILandroid/view/VelocityTracker$Estimator;)Z", "(JILandroid/view/VelocityTracker$Estimator;)Z", (void*)android_view_VelocityTracker_nativeGetEstimator }, }; Loading