mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 13:30:15 -07:00
Final fix on Russian character doubling; remove redundant debugging
This commit is contained in:
parent
882be4cbf8
commit
a40eff3fb1
4 changed files with 19 additions and 10 deletions
|
|
@ -1085,13 +1085,24 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
public static void sendKeyPress(int keyCode, char keyChar, int scancode, int modifiers, boolean status) {
|
||||
CallbackBridge.sendKeycode(keyCode, keyChar, scancode, modifiers, status);
|
||||
}
|
||||
|
||||
public static boolean doesObjectContainField(Class objectClass, String fieldName) {
|
||||
for (Field field : objectClass.getFields()) {
|
||||
if (field.getName().equals(fieldName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void sendKeyPress(char keyChar) {
|
||||
try {
|
||||
int keyCode = KeyEvent.class.getField("KEYCODE_" + Character.toUpperCase(keyChar)).getInt(null);
|
||||
sendKeyPress(AndroidLWJGLKeycode.androidToLwjglMap.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(AndroidLWJGLKeycode.androidToLwjglMap.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
if(doesObjectContainField(KeyEvent.class,"KEYCODE_" + Character.toUpperCase(keyChar))) {
|
||||
try {
|
||||
int keyCode = KeyEvent.class.getField("KEYCODE_" + Character.toUpperCase(keyChar)).getInt(null);
|
||||
sendKeyPress(AndroidLWJGLKeycode.androidToLwjglMap.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(AndroidLWJGLKeycode.androidToLwjglMap.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
|
||||
}
|
||||
}else{
|
||||
sendKeyPress(0, keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(0, keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue