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
LinearLayout: handle overwritten performClick() method
This is needed to make TabLayout functional
This commit is contained in:
@@ -119,6 +119,7 @@ void set_up_handle_cache(JNIEnv *env)
|
|||||||
handle_cache.view.computeScroll = _METHOD(handle_cache.view.class, "computeScroll", "()V");
|
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.getScrollX = _METHOD(handle_cache.view.class, "getScrollX", "()I");
|
||||||
handle_cache.view.getScrollY = _METHOD(handle_cache.view.class, "getScrollY", "()I");
|
handle_cache.view.getScrollY = _METHOD(handle_cache.view.class, "getScrollY", "()I");
|
||||||
|
handle_cache.view.performClick = _METHOD(handle_cache.view.class, "performClick", "()Z");
|
||||||
|
|
||||||
handle_cache.asset_manager.class = _REF((*env)->FindClass(env, "android/content/res/AssetManager"));
|
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");
|
handle_cache.asset_manager.extractFromAPK = _STATIC_METHOD(handle_cache.asset_manager.class, "extractFromAPK", "(Ljava/lang/String;Ljava/lang/String;)V");
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ struct handle_cache {
|
|||||||
jmethodID computeScroll;
|
jmethodID computeScroll;
|
||||||
jmethodID getScrollX;
|
jmethodID getScrollX;
|
||||||
jmethodID getScrollY;
|
jmethodID getScrollY;
|
||||||
|
jmethodID performClick;
|
||||||
} view;
|
} view;
|
||||||
struct {
|
struct {
|
||||||
jclass class;
|
jclass class;
|
||||||
|
|||||||
@@ -10,6 +10,15 @@
|
|||||||
#include "../generated_headers/android_widget_LinearLayout.h"
|
#include "../generated_headers/android_widget_LinearLayout.h"
|
||||||
#include "../generated_headers/android_view_ViewGroup.h"
|
#include "../generated_headers/android_view_ViewGroup.h"
|
||||||
|
|
||||||
|
static void on_click(GtkGestureClick *gesture, int n_press, double x, double y, jobject this)
|
||||||
|
{
|
||||||
|
JNIEnv *env = get_jni_env();
|
||||||
|
|
||||||
|
(*env)->CallBooleanMethod(env, this, handle_cache.view.performClick);
|
||||||
|
if((*env)->ExceptionCheck(env))
|
||||||
|
(*env)->ExceptionDescribe(env);
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_android_widget_LinearLayout_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
|
JNIEXPORT jlong JNICALL Java_android_widget_LinearLayout_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
|
||||||
{
|
{
|
||||||
int orientation = attribute_set_get_int(env, attrs, "orientation", NULL, 1);
|
int orientation = attribute_set_get_int(env, attrs, "orientation", NULL, 1);
|
||||||
@@ -22,6 +31,12 @@ JNIEXPORT jlong JNICALL Java_android_widget_LinearLayout_native_1constructor(JNI
|
|||||||
gtk_widget_set_hexpand_set(box, true); // FIXME: to counteract expand on drawing areas
|
gtk_widget_set_hexpand_set(box, true); // FIXME: to counteract expand on drawing areas
|
||||||
gtk_widget_set_vexpand_set(box, true); // XXX
|
gtk_widget_set_vexpand_set(box, true); // XXX
|
||||||
}
|
}
|
||||||
|
if (_METHOD(_CLASS(this), "performClick", "()Z") != handle_cache.view.performClick) {
|
||||||
|
GtkEventController *controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
|
||||||
|
|
||||||
|
g_signal_connect(controller, "released", G_CALLBACK(on_click), _REF(this));
|
||||||
|
gtk_widget_add_controller(box, controller);
|
||||||
|
}
|
||||||
return _INTPTR(box);
|
return _INTPTR(box);
|
||||||
|
|
||||||
// struct ninepatch_t *ninepatch = ninepatch_new("/home/Mis012/Github_and_other_sources/org.happysanta.gd_29_src.tar.gz/res/drawable-mdpi/btn_br_down.9.png");
|
// struct ninepatch_t *ninepatch = ninepatch_new("/home/Mis012/Github_and_other_sources/org.happysanta.gd_29_src.tar.gz/res/drawable-mdpi/btn_br_down.9.png");
|
||||||
|
|||||||
Reference in New Issue
Block a user