summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2011-01-10 17:51:03 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2011-01-10 17:51:03 (GMT)
commit3ff2145d884799c8556c058bd6b8eb4a7afde7c5 (patch)
treeb22f14394b66f3325f64de6521e2dc7ddbdfb0bc /src
parent181e3c33ef385221072cb7acd5ccc24ad480260e (diff)
downloadSoftKeys-3ff2145d884799c8556c058bd6b8eb4a7afde7c5.zip
SoftKeys-3ff2145d884799c8556c058bd6b8eb4a7afde7c5.tar.gz
SoftKeys-3ff2145d884799c8556c058bd6b8eb4a7afde7c5.tar.bz2
Adds front-back mapping
Diffstat (limited to 'src')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/K.java94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/K.java b/src/net/hoopajoo/android/SoftKeys/K.java
index c5de741..b8538c5 100644
--- a/src/net/hoopajoo/android/SoftKeys/K.java
+++ b/src/net/hoopajoo/android/SoftKeys/K.java
@@ -197,95 +197,182 @@ public class K {
public static int KEYID_TAG_LAST_KEYCODE = 85;
private static final Map<String,Integer> mKeymap;
+ private static final Map<Integer,String> mNamemap;
static {
Map<String,Integer> t = new HashMap<String,Integer>();
+ Map<Integer,String> s = new HashMap<Integer,String>();
+ s.put( KEYID_SOFT_RIGHT, KEY_SOFT_RIGHT );
t.put( KEY_SOFT_RIGHT, KEYID_SOFT_RIGHT );
+ s.put( KEYID_HOME, KEY_HOME );
t.put( KEY_HOME, KEYID_HOME );
+ s.put( KEYID_BACK, KEY_BACK );
t.put( KEY_BACK, KEYID_BACK );
+ s.put( KEYID_CALL, KEY_CALL );
t.put( KEY_CALL, KEYID_CALL );
+ s.put( KEYID_ENDCALL, KEY_ENDCALL );
t.put( KEY_ENDCALL, KEYID_ENDCALL );
+ s.put( KEYID_0, KEY_0 );
t.put( KEY_0, KEYID_0 );
+ s.put( KEYID_1, KEY_1 );
t.put( KEY_1, KEYID_1 );
+ s.put( KEYID_2, KEY_2 );
t.put( KEY_2, KEYID_2 );
+ s.put( KEYID_3, KEY_3 );
t.put( KEY_3, KEYID_3 );
+ s.put( KEYID_4, KEY_4 );
t.put( KEY_4, KEYID_4 );
+ s.put( KEYID_5, KEY_5 );
t.put( KEY_5, KEYID_5 );
+ s.put( KEYID_6, KEY_6 );
t.put( KEY_6, KEYID_6 );
+ s.put( KEYID_7, KEY_7 );
t.put( KEY_7, KEYID_7 );
+ s.put( KEYID_8, KEY_8 );
t.put( KEY_8, KEYID_8 );
+ s.put( KEYID_9, KEY_9 );
t.put( KEY_9, KEYID_9 );
+ s.put( KEYID_STAR, KEY_STAR );
t.put( KEY_STAR, KEYID_STAR );
+ s.put( KEYID_POUND, KEY_POUND );
t.put( KEY_POUND, KEYID_POUND );
+ s.put( KEYID_DPAD_UP, KEY_DPAD_UP );
t.put( KEY_DPAD_UP, KEYID_DPAD_UP );
+ s.put( KEYID_DPAD_DOWN, KEY_DPAD_DOWN );
t.put( KEY_DPAD_DOWN, KEYID_DPAD_DOWN );
+ s.put( KEYID_DPAD_LEFT, KEY_DPAD_LEFT );
t.put( KEY_DPAD_LEFT, KEYID_DPAD_LEFT );
+ s.put( KEYID_DPAD_RIGHT, KEY_DPAD_RIGHT );
t.put( KEY_DPAD_RIGHT, KEYID_DPAD_RIGHT );
+ s.put( KEYID_DPAD_CENTER, KEY_DPAD_CENTER );
t.put( KEY_DPAD_CENTER, KEYID_DPAD_CENTER );
+ s.put( KEYID_VOLUME_UP, KEY_VOLUME_UP );
t.put( KEY_VOLUME_UP, KEYID_VOLUME_UP );
+ s.put( KEYID_VOLUME_DOWN, KEY_VOLUME_DOWN );
t.put( KEY_VOLUME_DOWN, KEYID_VOLUME_DOWN );
+ s.put( KEYID_POWER, KEY_POWER );
t.put( KEY_POWER, KEYID_POWER );
+ s.put( KEYID_CAMERA, KEY_CAMERA );
t.put( KEY_CAMERA, KEYID_CAMERA );
+ s.put( KEYID_CLEAR, KEY_CLEAR );
t.put( KEY_CLEAR, KEYID_CLEAR );
+ s.put( KEYID_A, KEY_A );
t.put( KEY_A, KEYID_A );
+ s.put( KEYID_B, KEY_B );
t.put( KEY_B, KEYID_B );
+ s.put( KEYID_C, KEY_C );
t.put( KEY_C, KEYID_C );
+ s.put( KEYID_D, KEY_D );
t.put( KEY_D, KEYID_D );
+ s.put( KEYID_E, KEY_E );
t.put( KEY_E, KEYID_E );
+ s.put( KEYID_F, KEY_F );
t.put( KEY_F, KEYID_F );
+ s.put( KEYID_G, KEY_G );
t.put( KEY_G, KEYID_G );
+ s.put( KEYID_H, KEY_H );
t.put( KEY_H, KEYID_H );
+ s.put( KEYID_I, KEY_I );
t.put( KEY_I, KEYID_I );
+ s.put( KEYID_J, KEY_J );
t.put( KEY_J, KEYID_J );
+ s.put( KEYID_K, KEY_K );
t.put( KEY_K, KEYID_K );
+ s.put( KEYID_L, KEY_L );
t.put( KEY_L, KEYID_L );
+ s.put( KEYID_M, KEY_M );
t.put( KEY_M, KEYID_M );
+ s.put( KEYID_N, KEY_N );
t.put( KEY_N, KEYID_N );
+ s.put( KEYID_O, KEY_O );
t.put( KEY_O, KEYID_O );
+ s.put( KEYID_P, KEY_P );
t.put( KEY_P, KEYID_P );
+ s.put( KEYID_Q, KEY_Q );
t.put( KEY_Q, KEYID_Q );
+ s.put( KEYID_R, KEY_R );
t.put( KEY_R, KEYID_R );
+ s.put( KEYID_S, KEY_S );
t.put( KEY_S, KEYID_S );
+ s.put( KEYID_T, KEY_T );
t.put( KEY_T, KEYID_T );
+ s.put( KEYID_U, KEY_U );
t.put( KEY_U, KEYID_U );
+ s.put( KEYID_V, KEY_V );
t.put( KEY_V, KEYID_V );
+ s.put( KEYID_W, KEY_W );
t.put( KEY_W, KEYID_W );
+ s.put( KEYID_X, KEY_X );
t.put( KEY_X, KEYID_X );
+ s.put( KEYID_Y, KEY_Y );
t.put( KEY_Y, KEYID_Y );
+ s.put( KEYID_Z, KEY_Z );
t.put( KEY_Z, KEYID_Z );
+ s.put( KEYID_COMMA, KEY_COMMA );
t.put( KEY_COMMA, KEYID_COMMA );
+ s.put( KEYID_PERIOD, KEY_PERIOD );
t.put( KEY_PERIOD, KEYID_PERIOD );
+ s.put( KEYID_ALT_LEFT, KEY_ALT_LEFT );
t.put( KEY_ALT_LEFT, KEYID_ALT_LEFT );
+ s.put( KEYID_ALT_RIGHT, KEY_ALT_RIGHT );
t.put( KEY_ALT_RIGHT, KEYID_ALT_RIGHT );
+ s.put( KEYID_SHIFT_LEFT, KEY_SHIFT_LEFT );
t.put( KEY_SHIFT_LEFT, KEYID_SHIFT_LEFT );
+ s.put( KEYID_SHIFT_RIGHT, KEY_SHIFT_RIGHT );
t.put( KEY_SHIFT_RIGHT, KEYID_SHIFT_RIGHT );
+ s.put( KEYID_TAB, KEY_TAB );
t.put( KEY_TAB, KEYID_TAB );
+ s.put( KEYID_SPACE, KEY_SPACE );
t.put( KEY_SPACE, KEYID_SPACE );
+ s.put( KEYID_SYM, KEY_SYM );
t.put( KEY_SYM, KEYID_SYM );
+ s.put( KEYID_EXPLORER, KEY_EXPLORER );
t.put( KEY_EXPLORER, KEYID_EXPLORER );
+ s.put( KEYID_ENVELOPE, KEY_ENVELOPE );
t.put( KEY_ENVELOPE, KEYID_ENVELOPE );
+ s.put( KEYID_ENTER, KEY_ENTER );
t.put( KEY_ENTER, KEYID_ENTER );
+ s.put( KEYID_DEL, KEY_DEL );
t.put( KEY_DEL, KEYID_DEL );
+ s.put( KEYID_GRAVE, KEY_GRAVE );
t.put( KEY_GRAVE, KEYID_GRAVE );
+ s.put( KEYID_MINUS, KEY_MINUS );
t.put( KEY_MINUS, KEYID_MINUS );
+ s.put( KEYID_EQUALS, KEY_EQUALS );
t.put( KEY_EQUALS, KEYID_EQUALS );
+ s.put( KEYID_LEFT_BRACKET, KEY_LEFT_BRACKET );
t.put( KEY_LEFT_BRACKET, KEYID_LEFT_BRACKET );
+ s.put( KEYID_RIGHT_BRACKET, KEY_RIGHT_BRACKET );
t.put( KEY_RIGHT_BRACKET, KEYID_RIGHT_BRACKET );
+ s.put( KEYID_BACKSLASH, KEY_BACKSLASH );
t.put( KEY_BACKSLASH, KEYID_BACKSLASH );
+ s.put( KEYID_SEMICOLON, KEY_SEMICOLON );
t.put( KEY_SEMICOLON, KEYID_SEMICOLON );
+ s.put( KEYID_APOSTROPHE, KEY_APOSTROPHE );
t.put( KEY_APOSTROPHE, KEYID_APOSTROPHE );
+ s.put( KEYID_SLASH, KEY_SLASH );
t.put( KEY_SLASH, KEYID_SLASH );
+ s.put( KEYID_AT, KEY_AT );
t.put( KEY_AT, KEYID_AT );
+ s.put( KEYID_NUM, KEY_NUM );
t.put( KEY_NUM, KEYID_NUM );
+ s.put( KEYID_HEADSETHOOK, KEY_HEADSETHOOK );
t.put( KEY_HEADSETHOOK, KEYID_HEADSETHOOK );
+ s.put( KEYID_FOCUS, KEY_FOCUS );
t.put( KEY_FOCUS, KEYID_FOCUS );
+ s.put( KEYID_PLUS, KEY_PLUS );
t.put( KEY_PLUS, KEYID_PLUS );
+ s.put( KEYID_MENU, KEY_MENU );
t.put( KEY_MENU, KEYID_MENU );
+ s.put( KEYID_NOTIFICATION, KEY_NOTIFICATION );
t.put( KEY_NOTIFICATION, KEYID_NOTIFICATION );
+ s.put( KEYID_SEARCH, KEY_SEARCH );
t.put( KEY_SEARCH, KEYID_SEARCH );
+ s.put( KEYID_TAG_LAST_KEYCODE, KEY_TAG_LAST_KEYCODE );
t.put( KEY_TAG_LAST_KEYCODE, KEYID_TAG_LAST_KEYCODE );
mKeymap = Collections.unmodifiableMap( t );
+ mNamemap = Collections.unmodifiableMap( s );
}
public static int keyNameToId( String n ) {
@@ -294,4 +381,11 @@ public class K {
}
return mKeymap.get( n );
}
+
+ public static String keyIdToName( int id ) {
+ if( ! mNamemap.containsKey( id ) ) {
+ return null;
+ }
+ return mNamemap.get( id );
+ }
}