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
add more APIs needed for NewPipe
This commit is contained in:
@@ -177,11 +177,3 @@ JNIEXPORT void JNICALL Java_android_app_Activity_nativeOpenURI(JNIEnv *env, jcla
|
||||
}
|
||||
|
||||
extern GtkWindow *window; // TODO: get this in a better way
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeShare(JNIEnv *env, jclass class, jstring text_jstring)
|
||||
{
|
||||
const char *text = (*env)->GetStringUTFChars(env, text_jstring, NULL);
|
||||
GdkClipboard *clipboard = gdk_display_get_clipboard(gtk_root_get_display(GTK_ROOT(window)));
|
||||
gdk_clipboard_set_text(clipboard, text);
|
||||
(*env)->ReleaseStringUTFChars(env, text_jstring, text);
|
||||
}
|
||||
|
||||
16
src/api-impl-jni/content/android_content_ClipboardManager.c
Normal file
16
src/api-impl-jni/content/android_content_ClipboardManager.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../util.h"
|
||||
|
||||
#include "../generated_headers/android_content_ClipboardManager.h"
|
||||
|
||||
extern GtkWindow *window; // TODO: get this in a better way
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_content_ClipboardManager_native_1set_1clipboard(JNIEnv *env, jclass class, jstring text_jstring)
|
||||
{
|
||||
const char *text = (*env)->GetStringUTFChars(env, text_jstring, NULL);
|
||||
GdkClipboard *clipboard = gdk_display_get_clipboard(gtk_root_get_display(GTK_ROOT(window)));
|
||||
gdk_clipboard_set_text(clipboard, text);
|
||||
(*env)->ReleaseStringUTFChars(env, text_jstring, text);
|
||||
}
|
||||
@@ -41,14 +41,6 @@ JNIEXPORT void JNICALL Java_android_app_Activity_nativeStartActivity
|
||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeOpenURI
|
||||
(JNIEnv *, jclass, jstring);
|
||||
|
||||
/*
|
||||
* Class: android_app_Activity
|
||||
* Method: nativeShare
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeShare
|
||||
(JNIEnv *, jclass, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class android_content_ClipboardManager */
|
||||
|
||||
#ifndef _Included_android_content_ClipboardManager
|
||||
#define _Included_android_content_ClipboardManager
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef android_content_ClipboardManager_MSG_REPORT_PRIMARY_CLIP_CHANGED
|
||||
#define android_content_ClipboardManager_MSG_REPORT_PRIMARY_CLIP_CHANGED 1L
|
||||
/*
|
||||
* Class: android_content_ClipboardManager
|
||||
* Method: native_set_clipboard
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_content_ClipboardManager_native_1set_1clipboard
|
||||
(JNIEnv *, jclass, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -239,6 +239,14 @@ JNIEXPORT void JNICALL Java_android_widget_TextView_setTextSize
|
||||
JNIEXPORT void JNICALL Java_android_widget_TextView_native_1setTextColor
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: android_widget_TextView
|
||||
* Method: getText
|
||||
* Signature: ()Ljava/lang/CharSequence;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_android_widget_TextView_getText
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -79,3 +79,8 @@ JNIEXPORT void JNICALL Java_android_widget_TextView_native_1set_1markup(JNIEnv *
|
||||
|
||||
gtk_label_set_use_markup(label, value);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_android_widget_TextView_getText(JNIEnv *env, jobject this)
|
||||
{
|
||||
return _JSTRING(gtk_label_get_text(GTK_LABEL(_PTR(_GET_LONG_FIELD(this, "widget")))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user