summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-11-06 01:40:24 +0000
committerThomas Martitz <kugel@rockbox.org>2010-11-06 01:40:24 +0000
commit739d76cfda5793256e849acd082d90f1e09c9494 (patch)
tree4fb4f027e296040fcd8e36722709f7762285c2d3 /apps
parent93640fc22847e70f0070061ed1effc5d063dd600 (diff)
downloadrockbox-739d76cfda5793256e849acd082d90f1e09c9494.tar.gz
rockbox-739d76cfda5793256e849acd082d90f1e09c9494.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/hosted/keyboard.c18
-rw-r--r--apps/hosted/yesno.c14
2 files changed, 25 insertions, 7 deletions
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 @@
25#include <stdbool.h> 25#include <stdbool.h>
26#include "string-extra.h" 26#include "string-extra.h"
27#include "kernel.h" 27#include "kernel.h"
28#include "lang.h"
28 29
29extern JNIEnv *env_ptr; 30extern JNIEnv *env_ptr;
30static jclass RockboxKeyboardInput_class; 31static jclass RockboxKeyboardInput_class;
@@ -67,7 +68,10 @@ static void kdb_init(void)
67 RockboxKeyboardInput_class, 68 RockboxKeyboardInput_class,
68 constructor); 69 constructor);
69 kbd_inputfunc = e->GetMethodID(env_ptr, RockboxKeyboardInput_class, 70 kbd_inputfunc = e->GetMethodID(env_ptr, RockboxKeyboardInput_class,
70 "kbd_input", "(Ljava/lang/String;)V"); 71 "kbd_input",
72 "(Ljava/lang/String;"
73 "Ljava/lang/String;"
74 "Ljava/lang/String;)V");
71 kbd_is_usable = e->GetMethodID(env_ptr, RockboxKeyboardInput_class, 75 kbd_is_usable = e->GetMethodID(env_ptr, RockboxKeyboardInput_class,
72 "is_usable", "()Z"); 76 "is_usable", "()Z");
73 } 77 }
@@ -80,12 +84,15 @@ static void kdb_init(void)
80 84
81int kbd_input(char* text, int buflen) 85int kbd_input(char* text, int buflen)
82{ 86{
83 JNIEnv e = *env_ptr; 87 JNIEnv e = *env_ptr;
84 jstring str = e->NewStringUTF(env_ptr, text); 88 jstring str = e->NewStringUTF(env_ptr, text);
89 jstring ok_text = e->NewStringUTF(env_ptr, str(LANG_KBD_OK));
90 jstring cancel_text = e->NewStringUTF(env_ptr, str(LANG_KBD_CANCEL));
85 const char *utf8_string; 91 const char *utf8_string;
86 kdb_init(); 92 kdb_init();
87 93
88 e->CallVoidMethod(env_ptr, RockboxKeyboardInput_instance,kbd_inputfunc,str); 94 e->CallVoidMethod(env_ptr, RockboxKeyboardInput_instance,kbd_inputfunc,
95 str, ok_text, cancel_text);
89 96
90 wakeup_wait(&kbd_wakeup, TIMEOUT_BLOCK); 97 wakeup_wait(&kbd_wakeup, TIMEOUT_BLOCK);
91 98
@@ -96,6 +103,9 @@ int kbd_input(char* text, int buflen)
96 e->ReleaseStringUTFChars(env_ptr, new_string, utf8_string); 103 e->ReleaseStringUTFChars(env_ptr, new_string, utf8_string);
97 e->DeleteGlobalRef(env_ptr, new_string); 104 e->DeleteGlobalRef(env_ptr, new_string);
98 } 105 }
106 e->DeleteGlobalRef(env_ptr, str);
107 e->DeleteGlobalRef(env_ptr, ok_text);
108 e->DeleteGlobalRef(env_ptr, cancel_text);
99 109
100 return !accepted; /* return 0 on success */ 110 return !accepted; /* return 0 on success */
101} 111}
diff --git a/apps/hosted/yesno.c b/apps/hosted/yesno.c
index 2a8c02edd5..d00cb063af 100644
--- a/apps/hosted/yesno.c
+++ b/apps/hosted/yesno.c
@@ -62,7 +62,10 @@ static void yesno_init(void)
62 RockboxYesno_class, 62 RockboxYesno_class,
63 constructor); 63 constructor);
64 yesno_func = e->GetMethodID(env_ptr, RockboxYesno_class, 64 yesno_func = e->GetMethodID(env_ptr, RockboxYesno_class,
65 "yesno_display", "(Ljava/lang/String;)V"); 65 "yesno_display",
66 "(Ljava/lang/String;"
67 "Ljava/lang/String;"
68 "Ljava/lang/String;)V");
66 yesno_is_usable = e->GetMethodID(env_ptr, RockboxYesno_class, 69 yesno_is_usable = e->GetMethodID(env_ptr, RockboxYesno_class,
67 "is_usable", "()Z"); 70 "is_usable", "()Z");
68 } 71 }
@@ -100,12 +103,17 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
100 103
101 JNIEnv e = *env_ptr; 104 JNIEnv e = *env_ptr;
102 jstring message = build_message(main_message); 105 jstring message = build_message(main_message);
103 106 jstring yes = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_YES));
104 e->CallVoidMethod(env_ptr, RockboxYesno_instance, yesno_func, message); 107 jstring no = (*env_ptr)->NewStringUTF(env_ptr, str(LANG_SET_BOOL_NO));
108
109 e->CallVoidMethod(env_ptr, RockboxYesno_instance, yesno_func,
110 message, yes, no);
105 111
106 wakeup_wait(&yesno_wakeup, TIMEOUT_BLOCK); 112 wakeup_wait(&yesno_wakeup, TIMEOUT_BLOCK);
107 113
108 e->DeleteLocalRef(env_ptr, message); 114 e->DeleteLocalRef(env_ptr, message);
115 e->DeleteLocalRef(env_ptr, yes);
116 e->DeleteLocalRef(env_ptr, no);
109 117
110 return ret ? YESNO_YES : YESNO_NO; 118 return ret ? YESNO_YES : YESNO_NO;
111} 119}