mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-18 04:20:11 -07:00
Reimplement the key pipe as Android docs suggest
This commit is contained in:
parent
5400f82323
commit
a17ba2170f
2 changed files with 21 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue