You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
copy android.widget.Scroller from AOSP and implement missing scroll APIs
This is needed to make ViewPager functional
This commit is contained in:
@@ -116,6 +116,9 @@ void set_up_handle_cache(JNIEnv *env)
|
||||
handle_cache.view.getSuggestedMinimumHeight = _METHOD(handle_cache.view.class, "getSuggestedMinimumHeight", "()I");
|
||||
handle_cache.view.setMeasuredDimension = _METHOD(handle_cache.view.class, "setMeasuredDimension", "(II)V");
|
||||
handle_cache.view.onGenericMotionEvent = _METHOD(handle_cache.view.class, "onGenericMotionEvent", "(Landroid/view/MotionEvent;)Z");
|
||||
handle_cache.view.computeScroll = _METHOD(handle_cache.view.class, "computeScroll", "()V");
|
||||
handle_cache.view.getScrollX = _METHOD(handle_cache.view.class, "getScrollX", "()I");
|
||||
handle_cache.view.getScrollY = _METHOD(handle_cache.view.class, "getScrollY", "()I");
|
||||
|
||||
handle_cache.asset_manager.class = _REF((*env)->FindClass(env, "android/content/res/AssetManager"));
|
||||
handle_cache.asset_manager.extractFromAPK = _STATIC_METHOD(handle_cache.asset_manager.class, "extractFromAPK", "(Ljava/lang/String;Ljava/lang/String;)V");
|
||||
|
||||
@@ -77,6 +77,9 @@ struct handle_cache {
|
||||
jmethodID getSuggestedMinimumHeight;
|
||||
jmethodID setMeasuredDimension;
|
||||
jmethodID onGenericMotionEvent;
|
||||
jmethodID computeScroll;
|
||||
jmethodID getScrollX;
|
||||
jmethodID getScrollY;
|
||||
} view;
|
||||
struct {
|
||||
jclass class;
|
||||
|
||||
@@ -45,7 +45,13 @@ static void android_layout_allocate(GtkLayoutManager *layout_manager, GtkWidget
|
||||
if((*env)->ExceptionCheck(env))
|
||||
(*env)->ExceptionDescribe(env);
|
||||
|
||||
(*env)->CallVoidMethod(env, layout->view, handle_cache.view.onLayout, TRUE, 0, 0, width, height);
|
||||
(*env)->CallVoidMethod(env, layout->view, handle_cache.view.computeScroll);
|
||||
if((*env)->ExceptionCheck(env))
|
||||
(*env)->ExceptionDescribe(env);
|
||||
int scroll_x = (*env)->CallIntMethod(env, layout->view, handle_cache.view.getScrollX);
|
||||
int scroll_y = (*env)->CallIntMethod(env, layout->view, handle_cache.view.getScrollY);
|
||||
|
||||
(*env)->CallVoidMethod(env, layout->view, handle_cache.view.onLayout, TRUE, scroll_x, scroll_y, width, height);
|
||||
if((*env)->ExceptionCheck(env))
|
||||
(*env)->ExceptionDescribe(env);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user