mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Reimplement the key pipe as Android docs suggest
This commit is contained in:
parent
5400f82323
commit
a17ba2170f
@ -738,7 +738,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
Tools.showError(this, e, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
switch (event.getAction()) {
|
||||
@ -753,7 +753,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
*/
|
||||
//private Dialog menuDial;
|
||||
|
||||
@Override
|
||||
@ -1056,6 +1056,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
public void showKeyboard() {
|
||||
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||
minecraftGLView.requestFocusFromTouch();
|
||||
minecraftGLView.requestFocus();
|
||||
}
|
||||
|
||||
protected void setRightOverride(boolean val) {
|
||||
|
@ -15,12 +15,12 @@ import org.lwjgl.glfw.CallbackBridge;
|
||||
|
||||
public class MinecraftGLView extends TextureView
|
||||
{
|
||||
volatile Context ctx;
|
||||
volatile BaseMainActivity ctx;
|
||||
// private View.OnTouchListener mTouchListener;
|
||||
public MinecraftGLView(Context context) {
|
||||
super(context);
|
||||
//setPreserveEGLContextOnPause(true);
|
||||
ctx = context;
|
||||
ctx = (BaseMainActivity) context;
|
||||
}
|
||||
|
||||
public MinecraftGLView(Context context, AttributeSet attributeSet) {
|
||||
@ -34,10 +34,22 @@ public class MinecraftGLView extends TextureView
|
||||
if(!isHardKB(this.getContext())) {
|
||||
return new MyInputConnection(this, false);
|
||||
}else{
|
||||
return null;
|
||||
return new BaseInputConnection(this,false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
AndroidLWJGLKeycode.execKey(event,keyCode,false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
AndroidLWJGLKeycode.execKey(event,keyCode,true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckIsTextEditor() {
|
||||
return false;
|
||||
@ -65,7 +77,9 @@ class MyInputConnection 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user