mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Final fix on Russian character doubling; remove redundant debugging
This commit is contained in:
parent
882be4cbf8
commit
a40eff3fb1
Binary file not shown.
@ -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);
|
||||
}
|
||||
|
@ -60,9 +60,7 @@ class MinecraftInputConnection extends BaseInputConnection {
|
||||
}
|
||||
|
||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||
Log.d("EnhancedTextInput","Text committed: "+text);
|
||||
parent.sendKeyPress(text.charAt(0
|
||||
));
|
||||
parent.sendKeyPress(text.charAt(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class CallbackBridge {
|
||||
*/
|
||||
|
||||
//nativeSendKeycode(keycode, keychar, scancode, isDown ? 1 : 0, modifiers);
|
||||
nativeSendKey(keycode,scancode,isDown ? 1 : 0, modifiers);
|
||||
if(keycode != 0 || !isDown) nativeSendKey(keycode,scancode,isDown ? 1 : 0, modifiers);
|
||||
if(isDown && keychar != '\u0000') {
|
||||
nativeSendCharMods(keychar,modifiers);
|
||||
nativeSendChar(keychar);
|
||||
|
Loading…
x
Reference in New Issue
Block a user