Try to fix up FTE's android port.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5447 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-04-16 23:05:06 +00:00
parent 9f46ea14ff
commit dd92e6c9f2

View file

@ -5,13 +5,14 @@ import android.view.MotionEvent;
import android.view.InputDevice; import android.view.InputDevice;
import android.view.WindowManager; import android.view.WindowManager;
public class FTENativeActivity extends android.app.Activity public class FTENativeActivity extends android.app.NativeActivity
{ {
private static native void keypress(int devid, boolean down, int androidkey, int unicode); private static native void keypress(int devid, boolean down, int androidkey, int unicode);
private static native void mousepress(int devid, int buttonbits); private static native void mousepress(int devid, int buttonbits);
private static native void motion(int devid, int action, float x, float y, float z, float size); private static native void motion(int devid, int action, float x, float y, float z, float size);
private static native boolean wantrelative(); private static native boolean wantrelative();
private static native void axis(int devid, int axisid, float value); private static native void axis(int devid, int axisid, float value);
// private static native void oncreate(String basedir, byte[] savedstate);
static static
{ {
System.loadLibrary("ftedroid"); System.loadLibrary("ftedroid");
@ -134,8 +135,7 @@ public class FTENativeActivity extends android.app.Activity
@Override @Override
protected void onCreate(android.os.Bundle savedInstanceState) protected void onCreate(android.os.Bundle savedInstanceState)
{ {
mIMM = getSystemService(InputMethodManager.class); /* getWindow().takeSurface(this);
getWindow().takeSurface(this);
getWindow().setFormat(PixelFormat.RGB_565); getWindow().setFormat(PixelFormat.RGB_565);
getWindow().setSoftInputMode( getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED
@ -148,18 +148,18 @@ public class FTENativeActivity extends android.app.Activity
byte[] nativeSavedState = savedInstanceState != null byte[] nativeSavedState = savedInstanceState != null
? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE) : null; ? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE) : null;
mNativeHandle = loadNativeCode(path, funcname, Looper.myQueue(), mNativeHandle = oncreate(
getAbsolutePath(getFilesDir()), getAbsolutePath(getObbDir()), getAbsolutePath(getFilesDir()), getAbsolutePath(getObbDir()),
getAbsolutePath(getExternalFilesDir(null)), getAbsolutePath(getExternalFilesDir(null)),
Build.VERSION.SDK_INT, getAssets(), nativeSavedState, Build.VERSION.SDK_INT, getAssets(), nativeSavedState);
classLoader, classLoader.getLdLibraryPath()); */
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//Needed because the InputQueue stuff blocks dispatchKeyEvent
getWindow().takeInputQueue(null);
} }
@Override @Override
public boolean dispatchKeyEvent(KeyEvent event) public boolean dispatchKeyEvent(KeyEvent event)
{ { //needed because AKeyEvent_getUnicode is missing completely.
int act = event.getAction(); int act = event.getAction();
if (act == KeyEvent.ACTION_DOWN) if (act == KeyEvent.ACTION_DOWN)
{ {