mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-11 09:00:15 -07:00
Resolve error with keycodes
This commit is contained in:
parent
d5f9db0446
commit
1793c7c881
2 changed files with 13 additions and 13 deletions
|
|
@ -298,7 +298,7 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTou
|
|||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if(event.getAction() == KeyEvent.ACTION_DOWN){
|
||||
KeyEncoder.sendEncodedChar((char)event.getUnicodeChar());
|
||||
KeyEncoder.sendEncodedChar(event.getKeyCode(),(char)event.getUnicodeChar());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ public class KeyEncoder {
|
|||
static char backspaceAndroid = 67;
|
||||
static char backspaceUnicode = 8;
|
||||
|
||||
public static void sendEncodedChar(char in){
|
||||
if(in == backspaceAndroid){
|
||||
public static void sendEncodedChar(int inInt, char inChar){
|
||||
if(inInt == backspaceAndroid){
|
||||
AWTInputBridge.sendKey(backspaceUnicode,backspaceUnicode);
|
||||
} else if(specialChars.contains(""+in)){
|
||||
} else if(specialChars.contains(""+inChar)){
|
||||
// Send special character to client
|
||||
char c = in;
|
||||
char c = inChar;
|
||||
switch(c){
|
||||
case '!':
|
||||
c = '1';
|
||||
|
|
@ -89,21 +89,21 @@ public class KeyEncoder {
|
|||
c = '\\';
|
||||
break;
|
||||
}
|
||||
if(c != in){
|
||||
if(c != inChar){
|
||||
AWTInputBridge.sendKey(modifier,modifier);
|
||||
}
|
||||
AWTInputBridge.sendKey(c,c);
|
||||
} else if(Character.isDigit(in)){
|
||||
AWTInputBridge.sendKey(in,in);
|
||||
} else if (in == Character.toUpperCase(in)){
|
||||
} else if(Character.isDigit(inChar)){
|
||||
AWTInputBridge.sendKey(inChar,inChar);
|
||||
} else if (inChar == Character.toUpperCase(inChar)){
|
||||
// We send F12 as a modifier to avoid needing to worry about shift.
|
||||
// Client takes this modifier and does a toUpperCase().
|
||||
AWTInputBridge.sendKey(modifier,modifier);
|
||||
AWTInputBridge.sendKey(Character.toUpperCase(in),Character.toUpperCase(in));
|
||||
} else if(in == Character.toLowerCase(in)){
|
||||
AWTInputBridge.sendKey(Character.toUpperCase(in),Character.toUpperCase(in));
|
||||
AWTInputBridge.sendKey(Character.toUpperCase(inChar),Character.toUpperCase(inChar));
|
||||
} else if(inChar == Character.toLowerCase(inChar)){
|
||||
AWTInputBridge.sendKey(Character.toUpperCase(inChar),Character.toUpperCase(inChar));
|
||||
} else {
|
||||
AWTInputBridge.sendKey(in,in);
|
||||
AWTInputBridge.sendKey(inChar,inInt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue