diff options
Diffstat (limited to 'android/src')
-rw-r--r-- | android/src/org/rockbox/KeyboardActivity.java | 1 | ||||
-rw-r--r-- | android/src/org/rockbox/RockboxYesno.java | 73 | ||||
-rw-r--r-- | android/src/org/rockbox/YesnoActivity.java | 37 |
3 files changed, 111 insertions, 0 deletions
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 | |||
22 | package org.rockbox; | ||
23 | |||
24 | import android.app.Activity; | ||
25 | import android.content.Intent; | ||
26 | import android.util.Log; | ||
27 | |||
28 | public 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 @@ | |||
1 | package org.rockbox; | ||
2 | |||
3 | import android.app.Activity; | ||
4 | import android.app.AlertDialog; | ||
5 | import android.content.DialogInterface; | ||
6 | import android.os.Bundle; | ||
7 | import android.util.Log; | ||
8 | |||
9 | public 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 | } | ||