add more APIs needed for NewPipe

This commit is contained in:
Julian Winkler
2024-03-16 12:49:28 +01:00
parent b3c0023a45
commit 276b5ca7ef
40 changed files with 768 additions and 50 deletions

View File

@@ -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);
}

View 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);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")))));
}