F-droid lite version - create stubs for Moga Controller

This commit is contained in:
Florin9doi 2018-10-31 23:36:38 +02:00
parent 4c3f168211
commit 8694c33119
9 changed files with 123 additions and 4 deletions

View File

@ -144,6 +144,12 @@ android {
afterEvaluate {
android.sourceSets.main.assets.getSrcDirs().each { println it }
}
dependencies {
// F-Droid lite version can be created with : ./gradlew assembleOptimized -Pf_droid
if (project.hasProperty("f_droid")) {
project.android.sourceSets.main.java.srcDirs += 'libs/MogaStubs'
} else {
project.dependencies {
implementation files('libs/com.bda.controller.jar')
}
}

View File

@ -0,0 +1,39 @@
package com.bda.controller;
import android.app.Activity;
import android.os.Handler;
import android.view.SurfaceView;
public class Controller {
public static final int ACTION_VERSION_MOGA = 0;
public static final int STATE_CURRENT_PRODUCT_VERSION = 1;
static Controller sInstance;
private Controller() {}
public static Controller getInstance(Activity activity) {
if (sInstance == null) {
sInstance = new Controller();
}
return sInstance;
}
public int getState(int val) {
return 0;
}
public int setListener(SurfaceView view, Handler handler) {
return 0;
}
public int init() {
return 0;
}
public int onPause() {
return 0;
}
public int onResume() {
return 0;
}
public int exit() {
return 0;
}
}

View File

@ -0,0 +1,9 @@
package com.bda.controller;
public interface ControllerListener {
public abstract void onKeyEvent(KeyEvent event);
public abstract void onMotionEvent(MotionEvent event);
public abstract void onStateEvent(StateEvent state);
}

View File

@ -0,0 +1,4 @@
package com.bda.controller;
public class IControllerService {
}

View File

@ -0,0 +1,20 @@
package com.bda.controller;
public class KeyEvent {
public static final int ACTION_DOWN = 0;
public static final int ACTION_UP = 1;
public static final int KEYCODE_DPAD_UP = 2;
public static final int KEYCODE_DPAD_DOWN = 3;
public static final int KEYCODE_DPAD_LEFT = 4;
public static final int KEYCODE_DPAD_RIGHT = 5;
public int getAction() {
return 0;
}
public int getState(int val) {
return 0;
}
public int getKeyCode() {
return 0;
}
}

View File

@ -0,0 +1,14 @@
package com.bda.controller;
public class MotionEvent {
public static final int AXIS_X = 0;
public static final int AXIS_Y = 1;
public static final int AXIS_Z = 2;
public static final int AXIS_RZ = 3;
public static final int AXIS_LTRIGGER = 4;
public static final int AXIS_RTRIGGER = 5;
public int getAxisValue(int val) {
return 0;
}
}

View File

@ -0,0 +1,19 @@
package com.bda.controller;
public class StateEvent {
public static final int STATE_POWER_LOW = 0;
public static final int STATE_CONNECTION = 1;
public static final int ACTION_FALSE = 0;
public static final int ACTION_TRUE = 1;
public static final int ACTION_DISCONNECTED = 2;
public static final int ACTION_CONNECTING = 3;
public static final int ACTION_CONNECTED = 4;
public int getAction() {
return 0;
}
public int getState() {
return 0;
}
}

View File

@ -18,7 +18,11 @@ import android.os.Build;
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import com.bda.controller.*;
import com.bda.controller.Controller;
import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.StateEvent;
public class NativeGLView extends GLSurfaceView implements SensorEventListener, ControllerListener {
private static String TAG = "NativeGLView";

View File

@ -16,7 +16,11 @@ import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceView;
import com.bda.controller.*;
import com.bda.controller.Controller;
import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.StateEvent;
public class NativeSurfaceView extends SurfaceView implements SensorEventListener, ControllerListener {
private static String TAG = "NativeSurfaceView";