Permalink
Browse files

Merge pull request #11545 from Florin9doi/MOGA_STUB

F-droid lite version - create stubs for Moga Controller
  • Loading branch information...
hrydgard committed Nov 8, 2018
2 parents 99867ad + 8694c33 commit 31660291e64fc0db7bfb957b6d81ad787d463811
View
@@ -144,6 +144,12 @@ android {
afterEvaluate {
android.sourceSets.main.assets.getSrcDirs().each { println it }
}
dependencies {
implementation files('libs/com.bda.controller.jar')
// 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')
}
}
@@ -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;
}
}
@@ -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);
}
@@ -0,0 +1,4 @@
package com.bda.controller;
public class IControllerService {
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -18,7 +18,11 @@
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";
@@ -16,7 +16,11 @@
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";

0 comments on commit 3166029

Please sign in to comment.