summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/AndroidManifest.xml3
-rw-r--r--android/res/values/strings.xml2
-rw-r--r--android/src/org/rockbox/KeyboardActivity.java1
-rw-r--r--android/src/org/rockbox/RockboxYesno.java73
-rw-r--r--android/src/org/rockbox/YesnoActivity.java37
5 files changed, 115 insertions, 1 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index c52cac2753..c52d83fd2c 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -17,7 +17,8 @@
17 </activity> 17 </activity>
18 <service android:name=".RockboxService"/> 18 <service android:name=".RockboxService"/>
19 19
20 <activity android:name="KeyboardActivity" android:launchMode="singleTop"></activity> 20 <activity android:name="KeyboardActivity"></activity>
21 <activity android:name="YesnoActivity"></activity>
21</application> 22</application>
22<uses-sdk android:minSdkVersion="4" /> 23<uses-sdk android:minSdkVersion="4" />
23<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> 24<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index b0d41f133d..a2762ddd74 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -6,4 +6,6 @@
6<string name="OK">OK</string> 6<string name="OK">OK</string>
7<string name="Cancel">Cancel</string> 7<string name="Cancel">Cancel</string>
8<string name="KbdInputTitle">Rockbox Keyboard Input</string> 8<string name="KbdInputTitle">Rockbox Keyboard Input</string>
9<string name="Yes">Yes</string>
10<string name="No">No</string>
9</resources> 11</resources>
diff --git a/android/src/org/rockbox/KeyboardActivity.java b/android/src/org/rockbox/KeyboardActivity.java
index c77f686780..7436031f9d 100644
--- a/android/src/org/rockbox/KeyboardActivity.java
+++ b/android/src/org/rockbox/KeyboardActivity.java
@@ -23,6 +23,7 @@ public class KeyboardActivity extends Activity
23 .setTitle(R.string.KbdInputTitle) 23 .setTitle(R.string.KbdInputTitle)
24 .setView(addView) 24 .setView(addView)
25 .setIcon(R.drawable.icon) 25 .setIcon(R.drawable.icon)
26 .setCancelable(false)
26 .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() 27 .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener()
27 { 28 {
28 public void onClick(DialogInterface dialog, int whichButton) { 29 public void onClick(DialogInterface dialog, int whichButton) {
diff --git a/android/src/org/rockbox/RockboxYesno.java b/android/src/org/rockbox/RockboxYesno.java
new file mode 100644
index 0000000000..fd43fc6ab4
--- /dev/null
+++ b/android/src/org/rockbox/RockboxYesno.java
@@ -0,0 +1,73 @@
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
22package org.rockbox;
23
24import android.app.Activity;
25import android.content.Intent;
26import android.util.Log;
27
28public class RockboxYesno
29{
30 private boolean result;
31 private boolean have_result;
32
33 public RockboxYesno()
34 {
35 have_result = false;
36 }
37
38 public void yesno_display(String text)
39 {
40 RockboxActivity a = (RockboxActivity) RockboxService.get_instance().get_activity();
41 Intent kbd = new Intent(a, YesnoActivity.class);
42 kbd.putExtra("value", text);
43 a.waitForActivity(kbd, new HostCallback()
44 {
45 public void onComplete(int resultCode, Intent data)
46 {
47 if (resultCode == Activity.RESULT_OK)
48 {
49 result = true;
50 have_result = true;
51 }
52 else {
53 result = false;
54 have_result = true;
55 }
56 }
57 });
58 }
59
60 public boolean result_ready()
61 {
62 return have_result;
63 }
64 public boolean get_result()
65 {
66 return result;
67 }
68
69 public boolean is_usable()
70 {
71 return RockboxService.get_instance().get_activity() != null;
72 }
73}
diff --git a/android/src/org/rockbox/YesnoActivity.java b/android/src/org/rockbox/YesnoActivity.java
new file mode 100644
index 0000000000..5a67ec5ff7
--- /dev/null
+++ b/android/src/org/rockbox/YesnoActivity.java
@@ -0,0 +1,37 @@
1package org.rockbox;
2
3import android.app.Activity;
4import android.app.AlertDialog;
5import android.content.DialogInterface;
6import android.os.Bundle;
7import android.util.Log;
8
9public class YesnoActivity extends Activity
10{
11 public void onCreate(Bundle savedInstanceState)
12 {
13 super.onCreate(savedInstanceState);
14 new AlertDialog.Builder(this)
15 .setTitle(R.string.KbdInputTitle)
16 .setIcon(R.drawable.icon)
17 .setCancelable(false)
18 .setMessage(getIntent().getStringExtra("value"))
19 .setPositiveButton(R.string.Yes, new DialogInterface.OnClickListener()
20 {
21 public void onClick(DialogInterface dialog, int whichButton) {
22 setResult(RESULT_OK, getIntent());
23 finish();
24 }
25 })
26
27 .setNegativeButton(R.string.No, new DialogInterface.OnClickListener()
28 {
29 public void onClick(DialogInterface dialog, int whichButton)
30 {
31 setResult(RESULT_CANCELED, getIntent());
32 finish();
33 }
34 })
35 .show();
36 }
37}