|
@@ -58,6 +58,7 @@ import android.os.Environment;
|
|
import android.os.Messenger;
|
|
import android.os.Messenger;
|
|
import android.os.Vibrator;
|
|
import android.os.Vibrator;
|
|
import android.provider.Settings.Secure;
|
|
import android.provider.Settings.Secure;
|
|
|
|
+import android.support.annotation.Keep;
|
|
import android.support.v4.content.ContextCompat;
|
|
import android.support.v4.content.ContextCompat;
|
|
import android.view.Display;
|
|
import android.view.Display;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
@@ -101,7 +102,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
static final int REQUEST_CAMERA_PERMISSION = 2;
|
|
static final int REQUEST_CAMERA_PERMISSION = 2;
|
|
static final int REQUEST_VIBRATE_PERMISSION = 3;
|
|
static final int REQUEST_VIBRATE_PERMISSION = 3;
|
|
private IStub mDownloaderClientStub;
|
|
private IStub mDownloaderClientStub;
|
|
- private IDownloaderService mRemoteService;
|
|
|
|
private TextView mStatusText;
|
|
private TextView mStatusText;
|
|
private TextView mProgressFraction;
|
|
private TextView mProgressFraction;
|
|
private TextView mProgressPercent;
|
|
private TextView mProgressPercent;
|
|
@@ -224,15 +224,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
private Sensor mMagnetometer;
|
|
private Sensor mMagnetometer;
|
|
private Sensor mGyroscope;
|
|
private Sensor mGyroscope;
|
|
|
|
|
|
- public FrameLayout layout;
|
|
|
|
-
|
|
|
|
public static GodotIO io;
|
|
public static GodotIO io;
|
|
|
|
|
|
- public static void setWindowTitle(String title) {
|
|
|
|
- //setTitle(title);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- static SingletonBase singletons[] = new SingletonBase[MAX_SINGLETONS];
|
|
|
|
|
|
+ static SingletonBase[] singletons = new SingletonBase[MAX_SINGLETONS];
|
|
static int singleton_count = 0;
|
|
static int singleton_count = 0;
|
|
|
|
|
|
public interface ResultCallback {
|
|
public interface ResultCallback {
|
|
@@ -268,13 +262,14 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- public void onVideoInit() {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Used by the native code (java_godot_lib_jni.cpp) to complete initialization of the GLSurfaceView view and renderer.
|
|
|
|
+ */
|
|
|
|
+ @Keep
|
|
|
|
+ private void onVideoInit() {
|
|
boolean use_gl3 = getGLESVersionCode() >= 0x00030000;
|
|
boolean use_gl3 = getGLESVersionCode() >= 0x00030000;
|
|
|
|
|
|
- //mView = new GodotView(getApplication(),io,use_gl3);
|
|
|
|
- //setContentView(mView);
|
|
|
|
-
|
|
|
|
- layout = new FrameLayout(this);
|
|
|
|
|
|
+ final FrameLayout layout = new FrameLayout(this);
|
|
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
|
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
|
setContentView(layout);
|
|
setContentView(layout);
|
|
|
|
|
|
@@ -326,11 +321,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- public void vibrate(int p_duration_ms) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Used by the native code (java_godot_wrapper.h) to vibrate the device.
|
|
|
|
+ * @param durationMs
|
|
|
|
+ */
|
|
|
|
+ @Keep
|
|
|
|
+ private void vibrate(int durationMs) {
|
|
if (requestPermission("VIBRATE")) {
|
|
if (requestPermission("VIBRATE")) {
|
|
Vibrator v = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
|
|
Vibrator v = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
|
|
if (v != null) {
|
|
if (v != null) {
|
|
- v.vibrate(p_duration_ms);
|
|
|
|
|
|
+ v.vibrate(durationMs);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -416,6 +416,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
/**
|
|
/**
|
|
* Used by the native code (java_godot_wrapper.h) to check whether the activity is resumed or paused.
|
|
* Used by the native code (java_godot_wrapper.h) to check whether the activity is resumed or paused.
|
|
*/
|
|
*/
|
|
|
|
+ @Keep
|
|
private boolean isActivityResumed() {
|
|
private boolean isActivityResumed() {
|
|
return activityResumed;
|
|
return activityResumed;
|
|
}
|
|
}
|
|
@@ -423,10 +424,20 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
/**
|
|
/**
|
|
* Used by the native code (java_godot_wrapper.h) to access the Android surface.
|
|
* Used by the native code (java_godot_wrapper.h) to access the Android surface.
|
|
*/
|
|
*/
|
|
|
|
+ @Keep
|
|
private Surface getSurface() {
|
|
private Surface getSurface() {
|
|
return mView.getHolder().getSurface();
|
|
return mView.getHolder().getSurface();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Used by the native code (java_godot_wrapper.h) to access the input fallback mapping.
|
|
|
|
+ * @return The input fallback mapping for the current XR mode.
|
|
|
|
+ */
|
|
|
|
+ @Keep
|
|
|
|
+ private String getInputFallbackMapping() {
|
|
|
|
+ return xrMode.inputFallbackMapping;
|
|
|
|
+ }
|
|
|
|
+
|
|
String expansion_pack_path;
|
|
String expansion_pack_path;
|
|
|
|
|
|
private void initializeGodot() {
|
|
private void initializeGodot() {
|
|
@@ -474,8 +485,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onServiceConnected(Messenger m) {
|
|
public void onServiceConnected(Messenger m) {
|
|
- mRemoteService = DownloaderServiceMarshaller.CreateProxy(m);
|
|
|
|
- mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
|
|
|
|
|
+ IDownloaderService remoteService = DownloaderServiceMarshaller.CreateProxy(m);
|
|
|
|
+ remoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -483,7 +494,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
super.onCreate(icicle);
|
|
super.onCreate(icicle);
|
|
Window window = getWindow();
|
|
Window window = getWindow();
|
|
- //window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
|
|
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
|
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
|
mClipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
|
|
mClipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
|
|
|
|
|
|
@@ -609,7 +619,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
mWiFiSettingsButton = (Button)findViewById(com.godot.game.R.id.wifiSettingsButton);
|
|
mWiFiSettingsButton = (Button)findViewById(com.godot.game.R.id.wifiSettingsButton);
|
|
|
|
|
|
return;
|
|
return;
|
|
- } else {
|
|
|
|
}
|
|
}
|
|
} catch (NameNotFoundException e) {
|
|
} catch (NameNotFoundException e) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
@@ -621,8 +630,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
mCurrentIntent = getIntent();
|
|
mCurrentIntent = getIntent();
|
|
|
|
|
|
initializeGodot();
|
|
initializeGodot();
|
|
-
|
|
|
|
- //instanceSingleton( new GodotFacebook(this) );
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -831,8 +838,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void forceQuit() {
|
|
|
|
-
|
|
|
|
|
|
+ private void forceQuit() {
|
|
System.exit(0);
|
|
System.exit(0);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -879,7 +885,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //@Override public boolean dispatchTouchEvent (MotionEvent event) {
|
|
|
|
public boolean gotTouchEvent(final MotionEvent event) {
|
|
public boolean gotTouchEvent(final MotionEvent event) {
|
|
|
|
|
|
final int evcount = event.getPointerCount();
|
|
final int evcount = event.getPointerCount();
|
|
@@ -950,8 +955,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0)
|
|
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0)
|
|
;
|
|
;
|
|
if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
|
if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
|
- final Activity me = this;
|
|
|
|
- queueEvent(new Runnable() {
|
|
|
|
|
|
+ mView.queueEvent(new Runnable() {
|
|
// This method will be called on the rendering thread:
|
|
// This method will be called on the rendering thread:
|
|
public void run() {
|
|
public void run() {
|
|
for (int i = 0, n = cc.length; i < n; i++) {
|
|
for (int i = 0, n = cc.length; i < n; i++) {
|
|
@@ -967,20 +971,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- private void queueEvent(Runnable runnable) {
|
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public PaymentsManager getPaymentsManager() {
|
|
public PaymentsManager getPaymentsManager() {
|
|
return mPaymentsManager;
|
|
return mPaymentsManager;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- public void setPaymentsManager(PaymentsManager mPaymentsManager) {
|
|
|
|
- this.mPaymentsManager = mPaymentsManager;
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
public boolean requestPermission(String p_name) {
|
|
public boolean requestPermission(String p_name) {
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
// Not necessary, asked on install already
|
|
// Not necessary, asked on install already
|
|
@@ -1025,7 +1019,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
switch (newState) {
|
|
switch (newState) {
|
|
case IDownloaderClient.STATE_IDLE:
|
|
case IDownloaderClient.STATE_IDLE:
|
|
// STATE_IDLE means the service is listening, so it's
|
|
// STATE_IDLE means the service is listening, so it's
|
|
- // safe to start making calls via mRemoteService.
|
|
|
|
|
|
+ // safe to start making remote service calls.
|
|
paused = false;
|
|
paused = false;
|
|
indeterminate = true;
|
|
indeterminate = true;
|
|
break;
|
|
break;
|