summaryrefslogtreecommitdiffstats
path: root/android/src
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-11-06 01:01:01 +0000
committerThomas Martitz <kugel@rockbox.org>2010-11-06 01:01:01 +0000
commit988bdc1cc4d4cbe88da848de80d79aeac195464e (patch)
tree123bbcdd00fbe1ed9d43b304ccb13e8346980564 /android/src
parentbe51be6a9917574db9cf8fe69089cdb44d5b1eb3 (diff)
downloadrockbox-988bdc1cc4d4cbe88da848de80d79aeac195464e.tar.gz
rockbox-988bdc1cc4d4cbe88da848de80d79aeac195464e.tar.bz2
rockbox-988bdc1cc4d4cbe88da848de80d79aeac195464e.zip
Android: Use wakeup objects instead of polling for the dialog results in the keyboard and yesno dialog, allowing a lot of code to be removed.
First part of FS#11708 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28512 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android/src')
-rw-r--r--android/src/org/rockbox/RockboxKeyboardInput.java14
-rw-r--r--android/src/org/rockbox/RockboxYesno.java35
2 files changed, 10 insertions, 39 deletions
diff --git a/android/src/org/rockbox/RockboxKeyboardInput.java b/android/src/org/rockbox/RockboxKeyboardInput.java
index 3024b6b685..210cbbd258 100644
--- a/android/src/org/rockbox/RockboxKeyboardInput.java
+++ b/android/src/org/rockbox/RockboxKeyboardInput.java
@@ -43,21 +43,13 @@ public class RockboxKeyboardInput
{
public void onComplete(int resultCode, Intent data)
{
- if (resultCode == Activity.RESULT_OK)
- {
- result = data.getStringExtra("value");
- }
- else {
- result = "";
- }
+ put_result(resultCode == Activity.RESULT_OK,
+ data.getStringExtra("value"));
}
});
}
- public String get_result()
- {
- return result;
- }
+ private native void put_result(boolean accepted, String new_string);
public boolean is_usable()
{
return RockboxService.get_instance().get_activity() != null;
diff --git a/android/src/org/rockbox/RockboxYesno.java b/android/src/org/rockbox/RockboxYesno.java
index f6554715be..aa5e83d749 100644
--- a/android/src/org/rockbox/RockboxYesno.java
+++ b/android/src/org/rockbox/RockboxYesno.java
@@ -26,15 +26,8 @@ import android.content.Intent;
public class RockboxYesno
{
- private boolean result;
- private boolean have_result;
-
- public RockboxYesno()
- {
- have_result = false;
- }
-
- public void yesno_display(String text)
+ @SuppressWarnings("unused")
+ private void yesno_display(String text)
{
RockboxActivity a = (RockboxActivity) RockboxService.get_instance().get_activity();
Intent kbd = new Intent(a, YesnoActivity.class);
@@ -43,30 +36,16 @@ public class RockboxYesno
{
public void onComplete(int resultCode, Intent data)
{
- if (resultCode == Activity.RESULT_OK)
- {
- result = true;
- have_result = true;
- }
- else {
- result = false;
- have_result = true;
- }
+ put_result(resultCode == Activity.RESULT_OK);
}
});
}
- public boolean result_ready()
- {
- return have_result;
- }
- public boolean get_result()
- {
- return result;
- }
-
- public boolean is_usable()
+ @SuppressWarnings("unused")
+ private boolean is_usable()
{
return RockboxService.get_instance().get_activity() != null;
}
+
+ private native void put_result(boolean result);
}