mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-05-18 23:14:40 -04:00
[Text input] remove CapturedEditText and supports "dead chars"
This commit is contained in:
@@ -195,8 +195,12 @@ public class AndroidLWJGLKeycode {
|
||||
}
|
||||
|
||||
try {
|
||||
if ((int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing()) {
|
||||
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getUnicodeChar(), keyEvent.getScanCode(), mods, isDown);
|
||||
if (!CallbackBridge.isGrabbing()) {
|
||||
if ((int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN) {
|
||||
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getDisplayLabel(), keyEvent.getScanCode(), mods, isDown);
|
||||
} else if ((int) keyEvent.getUnicodeChar() != KeyEvent.KEYCODE_UNKNOWN) {
|
||||
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getUnicodeChar(), keyEvent.getScanCode(), mods, isDown);
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
private DrawerLayout drawerLayout;
|
||||
private NavigationView navDrawer;
|
||||
|
||||
protected CapturedEditText mKeyHandlerView;
|
||||
// protected CapturedEditText mKeyHandlerView;
|
||||
|
||||
private LinearLayout contentLog;
|
||||
private TextView textLog;
|
||||
@@ -197,13 +197,13 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
// toggleGui(null);
|
||||
this.drawerLayout.closeDrawers();
|
||||
|
||||
/*
|
||||
mKeyHandlerView = findViewById(R.id.main_key_handler);
|
||||
mKeyHandlerView.setSingleLine(false);
|
||||
mKeyHandlerView.clearFocus();
|
||||
|
||||
AndroidLWJGLKeycode.isBackspaceAfterChar = true; // mVersionInfo.minimumLauncherVersion >= 18;
|
||||
|
||||
*/
|
||||
placeMouseAt(CallbackBridge.windowWidth / 2, CallbackBridge.windowHeight / 2);
|
||||
new Thread(new Runnable(){
|
||||
|
||||
@@ -719,7 +719,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
Tools.showError(this, e, true);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
AndroidLWJGLKeycode.execKey(event, keyCode, false);
|
||||
@@ -731,7 +731,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
AndroidLWJGLKeycode.execKey(event, keyCode, true);
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
*/
|
||||
|
||||
//private Dialog menuDial;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import android.content.*;
|
||||
import android.util.*;
|
||||
import android.widget.*;
|
||||
import android.view.*;
|
||||
|
||||
public class CapturedEditText extends EditText
|
||||
{
|
||||
public CapturedEditText(Context ctx) {
|
||||
this(ctx, null);
|
||||
}
|
||||
|
||||
public CapturedEditText(Context ctx, AttributeSet attrs) {
|
||||
super(ctx, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event){
|
||||
switch (event.getAction()) {
|
||||
case KeyEvent.ACTION_DOWN:
|
||||
AndroidLWJGLKeycode.execKey(event, keyCode, true);
|
||||
break;
|
||||
|
||||
case KeyEvent.ACTION_UP:
|
||||
AndroidLWJGLKeycode.execKey(event, keyCode, false);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user