mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 01:27:18 -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);
|
Tools.showError(this, e, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
@ -753,7 +753,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
|
|
||||||
return super.dispatchKeyEvent(event);
|
return super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//private Dialog menuDial;
|
//private Dialog menuDial;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1056,6 +1056,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
public void showKeyboard() {
|
public void showKeyboard() {
|
||||||
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||||
minecraftGLView.requestFocusFromTouch();
|
minecraftGLView.requestFocusFromTouch();
|
||||||
|
minecraftGLView.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRightOverride(boolean val) {
|
protected void setRightOverride(boolean val) {
|
||||||
|
@ -15,12 +15,12 @@ import org.lwjgl.glfw.CallbackBridge;
|
|||||||
|
|
||||||
public class MinecraftGLView extends TextureView
|
public class MinecraftGLView extends TextureView
|
||||||
{
|
{
|
||||||
volatile Context ctx;
|
volatile BaseMainActivity ctx;
|
||||||
// private View.OnTouchListener mTouchListener;
|
// private View.OnTouchListener mTouchListener;
|
||||||
public MinecraftGLView(Context context) {
|
public MinecraftGLView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
//setPreserveEGLContextOnPause(true);
|
//setPreserveEGLContextOnPause(true);
|
||||||
ctx = context;
|
ctx = (BaseMainActivity) context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinecraftGLView(Context context, AttributeSet attributeSet) {
|
public MinecraftGLView(Context context, AttributeSet attributeSet) {
|
||||||
@ -34,10 +34,22 @@ public class MinecraftGLView extends TextureView
|
|||||||
if(!isHardKB(this.getContext())) {
|
if(!isHardKB(this.getContext())) {
|
||||||
return new MyInputConnection(this, false);
|
return new MyInputConnection(this, false);
|
||||||
}else{
|
}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
|
@Override
|
||||||
public boolean onCheckIsTextEditor() {
|
public boolean onCheckIsTextEditor() {
|
||||||
return false;
|
return false;
|
||||||
@ -65,7 +77,9 @@ class MyInputConnection extends BaseInputConnection {
|
|||||||
|
|
||||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||||
Log.d("EnhancedTextInput","Text committed: "+text);
|
Log.d("EnhancedTextInput","Text committed: "+text);
|
||||||
parent.sendKeyPress(text.charAt(0));
|
parent.sendKeyPress(text.charAt(0
|
||||||
|
));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user