summaryrefslogtreecommitdiffstats
path: root/src/net/hoopajoo/android/SoftKeys/SendInput.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/hoopajoo/android/SoftKeys/SendInput.java')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/SendInput.java42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/SendInput.java b/src/net/hoopajoo/android/SoftKeys/SendInput.java
index aa30d62..32d3a92 100644
--- a/src/net/hoopajoo/android/SoftKeys/SendInput.java
+++ b/src/net/hoopajoo/android/SoftKeys/SendInput.java
@@ -60,6 +60,10 @@ import android.widget.Toast;
// this is just a stub to handle intent calls
public class SendInput extends Activity {
public static String ACTION_CODE = "net.hoopajoo.android.SoftKeys.KEY_CODE";
+ public static String ACTION_HOME = "net.hoopajoo.android.SoftKeys.KEY_HOME";
+ public static String ACTION_MENU = "net.hoopajoo.android.SoftKeys.KEY_MENU";
+ public static String ACTION_SEARCH = "net.hoopajoo.android.SoftKeys.KEY_SEARCH";
+ public static String ACTION_BACK = "net.hoopajoo.android.SoftKeys.KEY_BACK";
/** Called when the activity is first created. */
@Override
@@ -73,15 +77,17 @@ public class SendInput extends Activity {
Globals app = (Globals)getApplication();
String action = i.getAction();
+ int keyid = 0;
if( action.equals( ACTION_CODE ) ) {
// by key name?
- int keyid = 0;
Bundle e = i.getExtras();
boolean longClick = e.getBoolean( "longclick", false );
if( e.getString( "keyname" ) != null ) {
String key = e.getString( "keyname" );
+ //Log.d( "SoftKeys.SendInput", "resolving: " + key );
if( key.equals( "home" ) ) {
((Globals)getApplication()).doHomeAction( longClick );
+ this.finish();
return;
}else{
// run through resolver
@@ -90,14 +96,34 @@ public class SendInput extends Activity {
}else if( e.getInt( "keyid", 0 ) != 0 ) {
keyid = e.getInt( "keyid", 0 );
}
+ }
- if( keyid != 0 ) {
- ((Globals)getApplication()).sendKeys( new int[] { keyid } );
- }
-
- // todo: make me a broadcast receiver.. or maybe this should be removed all together?
- // any good reasons to allow other apps to call hw keys?
- this.finish();
+ if( action.equals( ACTION_HOME ) ) {
+ ((Globals)getApplication()).doHomeAction( false );
+ this.finish();
+ return;
+ }
+
+ if( action.equals( ACTION_BACK ) ) {
+ keyid = K.KEYID_BACK;
+ }
+
+ if( action.equals( ACTION_MENU ) ) {
+ keyid = K.KEYID_MENU;
}
+
+ if( action.equals( ACTION_SEARCH ) ) {
+ keyid = K.KEYID_SEARCH;
+ }
+
+ if( keyid != 0 ) {
+ Log.d( "SoftKeys.SendInput", "resolved key: " + keyid );
+ ((Globals)getApplication()).sendKeys( new int[] { keyid } );
+ }
+
+ // todo: make me a broadcast receiver.. or maybe this should be removed all together?
+ // any good reasons to allow other apps to call hw keys?
+ this.finish();
+
}
}