mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 05:20:14 -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
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
if(event.getAction() == KeyEvent.ACTION_DOWN){
|
if(event.getAction() == KeyEvent.ACTION_DOWN){
|
||||||
KeyEncoder.sendEncodedChar((char)event.getUnicodeChar());
|
KeyEncoder.sendEncodedChar(event.getKeyCode(),(char)event.getUnicodeChar());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ public class KeyEncoder {
|
||||||
static char backspaceAndroid = 67;
|
static char backspaceAndroid = 67;
|
||||||
static char backspaceUnicode = 8;
|
static char backspaceUnicode = 8;
|
||||||
|
|
||||||
public static void sendEncodedChar(char in){
|
public static void sendEncodedChar(int inInt, char inChar){
|
||||||
if(in == backspaceAndroid){
|
if(inInt == backspaceAndroid){
|
||||||
AWTInputBridge.sendKey(backspaceUnicode,backspaceUnicode);
|
AWTInputBridge.sendKey(backspaceUnicode,backspaceUnicode);
|
||||||
} else if(specialChars.contains(""+in)){
|
} else if(specialChars.contains(""+inChar)){
|
||||||
// Send special character to client
|
// Send special character to client
|
||||||
char c = in;
|
char c = inChar;
|
||||||
switch(c){
|
switch(c){
|
||||||
case '!':
|
case '!':
|
||||||
c = '1';
|
c = '1';
|
||||||
|
|
@ -89,21 +89,21 @@ public class KeyEncoder {
|
||||||
c = '\\';
|
c = '\\';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c != in){
|
if(c != inChar){
|
||||||
AWTInputBridge.sendKey(modifier,modifier);
|
AWTInputBridge.sendKey(modifier,modifier);
|
||||||
}
|
}
|
||||||
AWTInputBridge.sendKey(c,c);
|
AWTInputBridge.sendKey(c,c);
|
||||||
} else if(Character.isDigit(in)){
|
} else if(Character.isDigit(inChar)){
|
||||||
AWTInputBridge.sendKey(in,in);
|
AWTInputBridge.sendKey(inChar,inChar);
|
||||||
} else if (in == Character.toUpperCase(in)){
|
} else if (inChar == Character.toUpperCase(inChar)){
|
||||||
// We send F12 as a modifier to avoid needing to worry about shift.
|
// We send F12 as a modifier to avoid needing to worry about shift.
|
||||||
// Client takes this modifier and does a toUpperCase().
|
// Client takes this modifier and does a toUpperCase().
|
||||||
AWTInputBridge.sendKey(modifier,modifier);
|
AWTInputBridge.sendKey(modifier,modifier);
|
||||||
AWTInputBridge.sendKey(Character.toUpperCase(in),Character.toUpperCase(in));
|
AWTInputBridge.sendKey(Character.toUpperCase(inChar),Character.toUpperCase(inChar));
|
||||||
} else if(in == Character.toLowerCase(in)){
|
} else if(inChar == Character.toLowerCase(inChar)){
|
||||||
AWTInputBridge.sendKey(Character.toUpperCase(in),Character.toUpperCase(in));
|
AWTInputBridge.sendKey(Character.toUpperCase(inChar),Character.toUpperCase(inChar));
|
||||||
} else {
|
} else {
|
||||||
AWTInputBridge.sendKey(in,in);
|
AWTInputBridge.sendKey(inChar,inInt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue