From 739d76cfda5793256e849acd082d90f1e09c9494 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 6 Nov 2010 01:40:24 +0000 Subject: Android: Use our translations for the yes/no/ok/cancel buttons in the yesno and keyboard dialog. Second part of FS#11708. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28515 a1c6a512-1295-4272-9138-f99709370657 --- apps/hosted/keyboard.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'apps/hosted/keyboard.c') diff --git a/apps/hosted/keyboard.c b/apps/hosted/keyboard.c index 6cc14d654f..ab461cf52d 100644 --- a/apps/hosted/keyboard.c +++ b/apps/hosted/keyboard.c @@ -25,6 +25,7 @@ #include #include "string-extra.h" #include "kernel.h" +#include "lang.h" extern JNIEnv *env_ptr; static jclass RockboxKeyboardInput_class; @@ -67,7 +68,10 @@ static void kdb_init(void) RockboxKeyboardInput_class, constructor); kbd_inputfunc = e->GetMethodID(env_ptr, RockboxKeyboardInput_class, - "kbd_input", "(Ljava/lang/String;)V"); + "kbd_input", + "(Ljava/lang/String;" + "Ljava/lang/String;" + "Ljava/lang/String;)V"); kbd_is_usable = e->GetMethodID(env_ptr, RockboxKeyboardInput_class, "is_usable", "()Z"); } @@ -80,12 +84,15 @@ static void kdb_init(void) int kbd_input(char* text, int buflen) { - JNIEnv e = *env_ptr; - jstring str = e->NewStringUTF(env_ptr, text); + JNIEnv e = *env_ptr; + jstring str = e->NewStringUTF(env_ptr, text); + jstring ok_text = e->NewStringUTF(env_ptr, str(LANG_KBD_OK)); + jstring cancel_text = e->NewStringUTF(env_ptr, str(LANG_KBD_CANCEL)); const char *utf8_string; kdb_init(); - e->CallVoidMethod(env_ptr, RockboxKeyboardInput_instance,kbd_inputfunc,str); + e->CallVoidMethod(env_ptr, RockboxKeyboardInput_instance,kbd_inputfunc, + str, ok_text, cancel_text); wakeup_wait(&kbd_wakeup, TIMEOUT_BLOCK); @@ -96,6 +103,9 @@ int kbd_input(char* text, int buflen) e->ReleaseStringUTFChars(env_ptr, new_string, utf8_string); e->DeleteGlobalRef(env_ptr, new_string); } + e->DeleteGlobalRef(env_ptr, str); + e->DeleteGlobalRef(env_ptr, ok_text); + e->DeleteGlobalRef(env_ptr, cancel_text); return !accepted; /* return 0 on success */ } -- cgit v1.2.3