diff options
Diffstat (limited to 'android/src/org/rockbox/RockboxKeyboardInput.java')
-rw-r--r-- | android/src/org/rockbox/RockboxKeyboardInput.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/android/src/org/rockbox/RockboxKeyboardInput.java b/android/src/org/rockbox/RockboxKeyboardInput.java new file mode 100644 index 0000000000..b037f6c4bb --- /dev/null +++ b/android/src/org/rockbox/RockboxKeyboardInput.java | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Jonathan Gordon | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | package org.rockbox; | ||
23 | |||
24 | import android.app.Activity; | ||
25 | import android.content.BroadcastReceiver; | ||
26 | import android.content.Intent; | ||
27 | import android.util.Log; | ||
28 | |||
29 | public class RockboxKeyboardInput | ||
30 | { | ||
31 | private BroadcastReceiver b; | ||
32 | private String result; | ||
33 | |||
34 | public RockboxKeyboardInput() | ||
35 | { | ||
36 | result = null; | ||
37 | } | ||
38 | |||
39 | public void kbd_input(String text) | ||
40 | { | ||
41 | RockboxActivity a = (RockboxActivity) RockboxService.get_instance().get_activity(); | ||
42 | Intent kbd = new Intent(a, KeyboardActivity.class); | ||
43 | kbd.putExtra("value", text); | ||
44 | a.waitForActivity(kbd, new HostCallback(){ | ||
45 | |||
46 | @Override | ||
47 | public void onComplete(int resultCode, Intent data) { | ||
48 | if (resultCode == Activity.RESULT_OK) | ||
49 | { | ||
50 | result = data.getStringExtra("value"); | ||
51 | } | ||
52 | else { | ||
53 | result = ""; | ||
54 | } | ||
55 | } | ||
56 | }); | ||
57 | } | ||
58 | public String get_result() | ||
59 | { | ||
60 | return result; | ||
61 | } | ||
62 | |||
63 | public boolean is_usable() | ||
64 | { | ||
65 | return RockboxService.get_instance().get_activity() != null; | ||
66 | } | ||
67 | |||
68 | |||
69 | } | ||