|
|
|
|
@ -90,9 +90,7 @@ import android.os.Bundle;
|
|
|
|
|
import android.os.Messenger;
|
|
|
|
|
import android.os.SystemClock;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class Godot extends Activity implements SensorEventListener, IDownloaderClient
|
|
|
|
|
{
|
|
|
|
|
public class Godot extends Activity implements SensorEventListener, IDownloaderClient {
|
|
|
|
|
|
|
|
|
|
static final int MAX_SINGLETONS = 64;
|
|
|
|
|
private IStub mDownloaderClientStub;
|
|
|
|
|
@ -110,15 +108,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
private Button mPauseButton;
|
|
|
|
|
private Button mWiFiSettingsButton;
|
|
|
|
|
|
|
|
|
|
private boolean use_32_bits=false;
|
|
|
|
|
private boolean use_immersive=false;
|
|
|
|
|
private boolean use_32_bits = false;
|
|
|
|
|
private boolean use_immersive = false;
|
|
|
|
|
private boolean mStatePaused;
|
|
|
|
|
private int mState;
|
|
|
|
|
private boolean keep_screen_on=true;
|
|
|
|
|
private boolean keep_screen_on = true;
|
|
|
|
|
|
|
|
|
|
static private Intent mCurrentIntent;
|
|
|
|
|
|
|
|
|
|
@Override public void onNewIntent(Intent intent) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onNewIntent(Intent intent) {
|
|
|
|
|
mCurrentIntent = intent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -144,26 +143,26 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
protected void registerClass(String p_name, String[] p_methods) {
|
|
|
|
|
|
|
|
|
|
GodotLib.singleton(p_name,this);
|
|
|
|
|
GodotLib.singleton(p_name, this);
|
|
|
|
|
|
|
|
|
|
Class clazz = getClass();
|
|
|
|
|
Method[] methods = clazz.getDeclaredMethods();
|
|
|
|
|
for (Method method : methods) {
|
|
|
|
|
boolean found=false;
|
|
|
|
|
Log.d("XXX","METHOD: %s\n" + method.getName());
|
|
|
|
|
boolean found = false;
|
|
|
|
|
Log.d("XXX", "METHOD: %s\n" + method.getName());
|
|
|
|
|
|
|
|
|
|
for (String s : p_methods) {
|
|
|
|
|
Log.d("XXX", "METHOD CMP WITH: %s\n" + s);
|
|
|
|
|
if (s.equals(method.getName())) {
|
|
|
|
|
found=true;
|
|
|
|
|
Log.d("XXX","METHOD CMP VALID");
|
|
|
|
|
found = true;
|
|
|
|
|
Log.d("XXX", "METHOD CMP VALID");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
Log.d("XXX","METHOD FOUND: %s\n" + method.getName());
|
|
|
|
|
Log.d("XXX", "METHOD FOUND: %s\n" + method.getName());
|
|
|
|
|
|
|
|
|
|
List<String> ptr = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
@ -175,17 +174,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
String[] pt = new String[ptr.size()];
|
|
|
|
|
ptr.toArray(pt);
|
|
|
|
|
|
|
|
|
|
GodotLib.method(p_name,method.getName(),method.getReturnType().getName(),pt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GodotLib.method(p_name, method.getName(), method.getReturnType().getName(), pt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Godot.singletons[Godot.singleton_count++]=this;
|
|
|
|
|
Godot.singletons[Godot.singleton_count++] = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onMainPause() {}
|
|
|
|
|
@ -200,22 +195,20 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
public void registerMethods() {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
/*
|
|
|
|
|
protected List<SingletonBase> singletons = new ArrayList<SingletonBase>();
|
|
|
|
|
protected void instanceSingleton(SingletonBase s) {
|
|
|
|
|
|
|
|
|
|
s.registerMethods();
|
|
|
|
|
singletons.add(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
private String[] command_line;
|
|
|
|
|
private boolean use_apk_expansion;
|
|
|
|
|
|
|
|
|
|
public GodotView mView;
|
|
|
|
|
private boolean godot_initialized=false;
|
|
|
|
|
|
|
|
|
|
private boolean godot_initialized = false;
|
|
|
|
|
|
|
|
|
|
private SensorManager mSensorManager;
|
|
|
|
|
private Sensor mAccelerometer;
|
|
|
|
|
@ -226,36 +219,34 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
public FrameLayout layout;
|
|
|
|
|
public RelativeLayout adLayout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public GodotIO io;
|
|
|
|
|
|
|
|
|
|
public static void setWindowTitle(String title) {
|
|
|
|
|
//setTitle(title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static SingletonBase singletons[] = new SingletonBase[MAX_SINGLETONS];
|
|
|
|
|
static int singleton_count=0;
|
|
|
|
|
|
|
|
|
|
static int singleton_count = 0;
|
|
|
|
|
|
|
|
|
|
public interface ResultCallback {
|
|
|
|
|
public void callback(int requestCode, int resultCode, Intent data);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
public ResultCallback result_callback;
|
|
|
|
|
|
|
|
|
|
private PaymentsManager mPaymentsManager = null;
|
|
|
|
|
|
|
|
|
|
@Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {
|
|
|
|
|
if(requestCode == PaymentsManager.REQUEST_CODE_FOR_PURCHASE){
|
|
|
|
|
@Override
|
|
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
|
if (requestCode == PaymentsManager.REQUEST_CODE_FOR_PURCHASE) {
|
|
|
|
|
mPaymentsManager.processPurchaseResponse(resultCode, data);
|
|
|
|
|
}else if (result_callback != null) {
|
|
|
|
|
} else if (result_callback != null) {
|
|
|
|
|
result_callback.callback(requestCode, resultCode, data);
|
|
|
|
|
result_callback = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<singleton_count;i++) {
|
|
|
|
|
for (int i = 0; i < singleton_count; i++) {
|
|
|
|
|
|
|
|
|
|
singletons[i].onMainActivityResult(requestCode,resultCode,data);
|
|
|
|
|
singletons[i].onMainActivityResult(requestCode, resultCode, data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -265,17 +256,17 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
//setContentView(mView);
|
|
|
|
|
|
|
|
|
|
layout = new FrameLayout(this);
|
|
|
|
|
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
|
|
|
|
|
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
|
|
|
|
setContentView(layout);
|
|
|
|
|
|
|
|
|
|
// GodotEditText layout
|
|
|
|
|
GodotEditText edittext = new GodotEditText(this);
|
|
|
|
|
edittext.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
|
|
|
|
|
edittext.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
|
|
|
|
|
// ...add to FrameLayout
|
|
|
|
|
layout.addView(edittext);
|
|
|
|
|
|
|
|
|
|
mView = new GodotView(getApplication(),io,use_gl2,use_32_bits, this);
|
|
|
|
|
layout.addView(mView,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
|
|
|
|
|
mView = new GodotView(getApplication(), io, use_gl2, use_32_bits, this);
|
|
|
|
|
layout.addView(mView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
|
|
|
|
edittext.setView(mView);
|
|
|
|
|
io.setEdit(edittext);
|
|
|
|
|
|
|
|
|
|
@ -296,7 +287,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
// Ad layout
|
|
|
|
|
adLayout = new RelativeLayout(this);
|
|
|
|
|
adLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
|
|
|
|
|
adLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
|
|
|
|
layout.addView(adLayout);
|
|
|
|
|
|
|
|
|
|
final String[] current_command_line = command_line;
|
|
|
|
|
@ -313,12 +304,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setKeepScreenOn(final boolean p_enabled) {
|
|
|
|
|
keep_screen_on = p_enabled;
|
|
|
|
|
if (mView != null){
|
|
|
|
|
if (mView != null) {
|
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
@ -349,41 +339,40 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
private static Godot _self;
|
|
|
|
|
|
|
|
|
|
public static Godot getInstance(){
|
|
|
|
|
public static Godot getInstance() {
|
|
|
|
|
return Godot._self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String[] getCommandLine() {
|
|
|
|
|
InputStream is;
|
|
|
|
|
try {
|
|
|
|
|
is = getAssets().open("_cl_");
|
|
|
|
|
byte[] len = new byte[4];
|
|
|
|
|
int r = is.read(len);
|
|
|
|
|
if (r<4) {
|
|
|
|
|
Log.d("XXX","**ERROR** Wrong cmdline length.\n");
|
|
|
|
|
if (r < 4) {
|
|
|
|
|
Log.d("XXX", "**ERROR** Wrong cmdline length.\n");
|
|
|
|
|
Log.d("GODOT", "**ERROR** Wrong cmdline length.\n");
|
|
|
|
|
return new String[0];
|
|
|
|
|
}
|
|
|
|
|
int argc=((int)(len[3]&0xFF)<<24) | ((int)(len[2]&0xFF)<<16) | ((int)(len[1]&0xFF)<<8) | ((int)(len[0]&0xFF));
|
|
|
|
|
int argc = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
|
|
|
|
|
String[] cmdline = new String[argc];
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<argc;i++) {
|
|
|
|
|
for (int i = 0; i < argc; i++) {
|
|
|
|
|
r = is.read(len);
|
|
|
|
|
if (r<4) {
|
|
|
|
|
if (r < 4) {
|
|
|
|
|
|
|
|
|
|
Log.d("GODOT", "**ERROR** Wrong cmdline param length.\n");
|
|
|
|
|
return new String[0];
|
|
|
|
|
}
|
|
|
|
|
int strlen=((int)(len[3]&0xFF)<<24) | ((int)(len[2]&0xFF)<<16) | ((int)(len[1]&0xFF)<<8) | ((int)(len[0]&0xFF));
|
|
|
|
|
if (strlen>65535) {
|
|
|
|
|
int strlen = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
|
|
|
|
|
if (strlen > 65535) {
|
|
|
|
|
Log.d("GODOT", "**ERROR** Wrong command len\n");
|
|
|
|
|
return new String[0];
|
|
|
|
|
}
|
|
|
|
|
byte[] arg = new byte[strlen];
|
|
|
|
|
r = is.read(arg);
|
|
|
|
|
if (r==strlen) {
|
|
|
|
|
cmdline[i]=new String(arg,"UTF-8");
|
|
|
|
|
if (r == strlen) {
|
|
|
|
|
cmdline[i] = new String(arg, "UTF-8");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cmdline;
|
|
|
|
|
@ -392,48 +381,44 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
Log.d("GODOT", "**ERROR** Exception " + e.getClass().getName() + ":" + e.getMessage());
|
|
|
|
|
return new String[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String expansion_pack_path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initializeGodot() {
|
|
|
|
|
|
|
|
|
|
if (expansion_pack_path!=null) {
|
|
|
|
|
if (expansion_pack_path != null) {
|
|
|
|
|
|
|
|
|
|
String[] new_cmdline;
|
|
|
|
|
int cll=0;
|
|
|
|
|
if (command_line!=null) {
|
|
|
|
|
Log.d("GODOT", "initializeGodot: command_line: is not null" );
|
|
|
|
|
new_cmdline = new String[ command_line.length + 2 ];
|
|
|
|
|
cll=command_line.length;
|
|
|
|
|
for(int i=0;i<command_line.length;i++) {
|
|
|
|
|
new_cmdline[i]=command_line[i];
|
|
|
|
|
int cll = 0;
|
|
|
|
|
if (command_line != null) {
|
|
|
|
|
Log.d("GODOT", "initializeGodot: command_line: is not null");
|
|
|
|
|
new_cmdline = new String[command_line.length + 2];
|
|
|
|
|
cll = command_line.length;
|
|
|
|
|
for (int i = 0; i < command_line.length; i++) {
|
|
|
|
|
new_cmdline[i] = command_line[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Log.d("GODOT", "initializeGodot: command_line: is null" );
|
|
|
|
|
new_cmdline = new String[ 2 ];
|
|
|
|
|
Log.d("GODOT", "initializeGodot: command_line: is null");
|
|
|
|
|
new_cmdline = new String[2];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new_cmdline[cll]="--main_pack";
|
|
|
|
|
new_cmdline[cll+1]=expansion_pack_path;
|
|
|
|
|
command_line=new_cmdline;
|
|
|
|
|
new_cmdline[cll] = "--main_pack";
|
|
|
|
|
new_cmdline[cll + 1] = expansion_pack_path;
|
|
|
|
|
command_line = new_cmdline;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
io = new GodotIO(this);
|
|
|
|
|
io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
|
|
|
|
|
GodotLib.io=io;
|
|
|
|
|
Log.d("GODOT", "command_line is null? " + ((command_line == null)?"yes":"no"));
|
|
|
|
|
GodotLib.io = io;
|
|
|
|
|
Log.d("GODOT", "command_line is null? " + ((command_line == null) ? "yes" : "no"));
|
|
|
|
|
/*if(command_line != null){
|
|
|
|
|
Log.d("GODOT", "Command Line:");
|
|
|
|
|
for(int w=0;w <command_line.length;w++){
|
|
|
|
|
Log.d("GODOT"," " + command_line[w]);
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
|
|
|
|
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
|
|
|
|
|
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
|
|
|
|
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);
|
|
|
|
|
mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
|
|
|
|
|
@ -449,8 +434,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
mPaymentsManager = PaymentsManager.createManager(this).initService();
|
|
|
|
|
|
|
|
|
|
godot_initialized=true;
|
|
|
|
|
|
|
|
|
|
godot_initialized = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -459,8 +443,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle icicle) {
|
|
|
|
|
|
|
|
|
|
@ -476,57 +458,56 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
if (true) {
|
|
|
|
|
boolean md5mismatch = false;
|
|
|
|
|
command_line = getCommandLine();
|
|
|
|
|
String main_pack_md5=null;
|
|
|
|
|
String main_pack_key=null;
|
|
|
|
|
String main_pack_md5 = null;
|
|
|
|
|
String main_pack_key = null;
|
|
|
|
|
|
|
|
|
|
List<String> new_args = new LinkedList<String>();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < command_line.length; i++) {
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<command_line.length;i++) {
|
|
|
|
|
|
|
|
|
|
boolean has_extra = i< command_line.length -1;
|
|
|
|
|
boolean has_extra = i < command_line.length - 1;
|
|
|
|
|
if (command_line[i].equals("--use_depth_32")) {
|
|
|
|
|
use_32_bits=true;
|
|
|
|
|
use_32_bits = true;
|
|
|
|
|
} else if (command_line[i].equals("--use_immersive")) {
|
|
|
|
|
use_immersive=true;
|
|
|
|
|
if(Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+
|
|
|
|
|
use_immersive = true;
|
|
|
|
|
if (Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+
|
|
|
|
|
window.getDecorView().setSystemUiVisibility(
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
|
|
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
|
|
|
|
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
|
|
|
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
|
|
|
|
|
View.SYSTEM_UI_FLAG_FULLSCREEN | // hide status bar
|
|
|
|
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
|
|
|
|
|
|
|
|
|
UiChangeListener();
|
|
|
|
|
}
|
|
|
|
|
} else if (command_line[i].equals("--use_apk_expansion")) {
|
|
|
|
|
use_apk_expansion=true;
|
|
|
|
|
use_apk_expansion = true;
|
|
|
|
|
} else if (has_extra && command_line[i].equals("--apk_expansion_md5")) {
|
|
|
|
|
main_pack_md5=command_line[i+1];
|
|
|
|
|
main_pack_md5 = command_line[i + 1];
|
|
|
|
|
i++;
|
|
|
|
|
} else if (has_extra && command_line[i].equals("--apk_expansion_key")) {
|
|
|
|
|
main_pack_key=command_line[i+1];
|
|
|
|
|
main_pack_key = command_line[i + 1];
|
|
|
|
|
SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE);
|
|
|
|
|
Editor editor = prefs.edit();
|
|
|
|
|
editor.putString("store_public_key", main_pack_key);
|
|
|
|
|
|
|
|
|
|
editor.commit();
|
|
|
|
|
i++;
|
|
|
|
|
} else if (command_line[i].trim().length()!=0){
|
|
|
|
|
} else if (command_line[i].trim().length() != 0) {
|
|
|
|
|
new_args.add(command_line[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (new_args.isEmpty()){
|
|
|
|
|
command_line=null;
|
|
|
|
|
}else{
|
|
|
|
|
if (new_args.isEmpty()) {
|
|
|
|
|
command_line = null;
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
command_line = new_args.toArray(new String[new_args.size()]);
|
|
|
|
|
}
|
|
|
|
|
if (use_apk_expansion && main_pack_md5!=null && main_pack_key!=null) {
|
|
|
|
|
if (use_apk_expansion && main_pack_md5 != null && main_pack_key != null) {
|
|
|
|
|
//check that environment is ok!
|
|
|
|
|
if (!Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED )) {
|
|
|
|
|
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
|
|
|
|
Log.d("GODOT", "**ERROR! No media mounted!");
|
|
|
|
|
//show popup and die
|
|
|
|
|
}
|
|
|
|
|
@ -534,7 +515,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
// Build the full path to the app's expansion files
|
|
|
|
|
try {
|
|
|
|
|
expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext());
|
|
|
|
|
expansion_pack_path+="/"+"main."+getPackageManager().getPackageInfo(getPackageName(), 0).versionCode+"."+this.getPackageName()+".obb";
|
|
|
|
|
expansion_pack_path += "/main." + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + "." + this.getPackageName() + ".obb";
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
@ -542,19 +523,19 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
File f = new File(expansion_pack_path);
|
|
|
|
|
|
|
|
|
|
boolean pack_valid = true;
|
|
|
|
|
Log.d("GODOT","**PACK** - Path "+expansion_pack_path);
|
|
|
|
|
Log.d("GODOT", "**PACK** - Path " + expansion_pack_path);
|
|
|
|
|
|
|
|
|
|
if (!f.exists()) {
|
|
|
|
|
|
|
|
|
|
pack_valid=false;
|
|
|
|
|
Log.d("GODOT","**PACK** - File does not exist");
|
|
|
|
|
pack_valid = false;
|
|
|
|
|
Log.d("GODOT", "**PACK** - File does not exist");
|
|
|
|
|
|
|
|
|
|
} else if( obbIsCorrupted(expansion_pack_path, main_pack_md5)){
|
|
|
|
|
} else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
|
|
|
|
|
Log.d("GODOT", "**PACK** - Expansion pack (obb) is corrupted");
|
|
|
|
|
pack_valid = false;
|
|
|
|
|
try{
|
|
|
|
|
try {
|
|
|
|
|
f.delete();
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Log.d("GODOT", "**PACK** - Error deleting corrupted expansion pack (obb)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -586,28 +567,26 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
GodotDownloaderService.class);
|
|
|
|
|
|
|
|
|
|
setContentView(com.godot.game.R.layout.downloading_expansion);
|
|
|
|
|
mPB = (ProgressBar) findViewById(com.godot.game.R.id.progressBar);
|
|
|
|
|
mStatusText = (TextView) findViewById(com.godot.game.R.id.statusText);
|
|
|
|
|
mProgressFraction = (TextView) findViewById(com.godot.game.R.id.progressAsFraction);
|
|
|
|
|
mProgressPercent = (TextView) findViewById(com.godot.game.R.id.progressAsPercentage);
|
|
|
|
|
mAverageSpeed = (TextView) findViewById(com.godot.game.R.id.progressAverageSpeed);
|
|
|
|
|
mTimeRemaining = (TextView) findViewById(com.godot.game.R.id.progressTimeRemaining);
|
|
|
|
|
mPB = (ProgressBar)findViewById(com.godot.game.R.id.progressBar);
|
|
|
|
|
mStatusText = (TextView)findViewById(com.godot.game.R.id.statusText);
|
|
|
|
|
mProgressFraction = (TextView)findViewById(com.godot.game.R.id.progressAsFraction);
|
|
|
|
|
mProgressPercent = (TextView)findViewById(com.godot.game.R.id.progressAsPercentage);
|
|
|
|
|
mAverageSpeed = (TextView)findViewById(com.godot.game.R.id.progressAverageSpeed);
|
|
|
|
|
mTimeRemaining = (TextView)findViewById(com.godot.game.R.id.progressTimeRemaining);
|
|
|
|
|
mDashboard = findViewById(com.godot.game.R.id.downloaderDashboard);
|
|
|
|
|
mCellMessage = findViewById(com.godot.game.R.id.approveCellular);
|
|
|
|
|
mPauseButton = (Button) findViewById(com.godot.game.R.id.pauseButton);
|
|
|
|
|
mWiFiSettingsButton = (Button) findViewById(com.godot.game.R.id.wifiSettingsButton);
|
|
|
|
|
mPauseButton = (Button)findViewById(com.godot.game.R.id.pauseButton);
|
|
|
|
|
mWiFiSettingsButton = (Button)findViewById(com.godot.game.R.id.wifiSettingsButton);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
} else{
|
|
|
|
|
} else {
|
|
|
|
|
Log.d("GODOT", "NO DOWNLOAD REQUIRED");
|
|
|
|
|
}
|
|
|
|
|
} catch (NameNotFoundException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -615,25 +594,23 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
initializeGodot();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//instanceSingleton( new GodotFacebook(this) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onDestroy() {
|
|
|
|
|
|
|
|
|
|
@Override protected void onDestroy(){
|
|
|
|
|
|
|
|
|
|
if(mPaymentsManager != null ) mPaymentsManager.destroy();
|
|
|
|
|
for(int i=0;i<singleton_count;i++) {
|
|
|
|
|
if (mPaymentsManager != null) mPaymentsManager.destroy();
|
|
|
|
|
for (int i = 0; i < singleton_count; i++) {
|
|
|
|
|
singletons[i].onMainDestroy();
|
|
|
|
|
}
|
|
|
|
|
super.onDestroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override protected void onPause() {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onPause() {
|
|
|
|
|
super.onPause();
|
|
|
|
|
if (!godot_initialized){
|
|
|
|
|
if (!godot_initialized) {
|
|
|
|
|
if (null != mDownloaderClientStub) {
|
|
|
|
|
mDownloaderClientStub.disconnect(this);
|
|
|
|
|
}
|
|
|
|
|
@ -648,14 +625,15 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
});
|
|
|
|
|
mSensorManager.unregisterListener(this);
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<singleton_count;i++) {
|
|
|
|
|
for (int i = 0; i < singleton_count; i++) {
|
|
|
|
|
singletons[i].onMainPause();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override protected void onResume() {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onResume() {
|
|
|
|
|
super.onResume();
|
|
|
|
|
if (!godot_initialized){
|
|
|
|
|
if (!godot_initialized) {
|
|
|
|
|
if (null != mDownloaderClientStub) {
|
|
|
|
|
mDownloaderClientStub.connect(this);
|
|
|
|
|
}
|
|
|
|
|
@ -674,58 +652,57 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME);
|
|
|
|
|
mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_GAME);
|
|
|
|
|
|
|
|
|
|
if(use_immersive && Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+
|
|
|
|
|
if (use_immersive && Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+
|
|
|
|
|
Window window = getWindow();
|
|
|
|
|
window.getDecorView().setSystemUiVisibility(
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
|
|
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
|
|
|
|
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
|
|
|
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
|
|
|
|
|
View.SYSTEM_UI_FLAG_FULLSCREEN | // hide status bar
|
|
|
|
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<singleton_count;i++) {
|
|
|
|
|
for (int i = 0; i < singleton_count; i++) {
|
|
|
|
|
|
|
|
|
|
singletons[i].onMainResume();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UiChangeListener() {
|
|
|
|
|
final View decorView = getWindow().getDecorView();
|
|
|
|
|
decorView.setOnSystemUiVisibilityChangeListener (new View.OnSystemUiVisibilityChangeListener() {
|
|
|
|
|
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSystemUiVisibilityChange(int visibility) {
|
|
|
|
|
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
|
|
|
|
decorView.setSystemUiVisibility(
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
|
|
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
|
|
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
|
|
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
|
|
|
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
|
|
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
|
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override public void onSensorChanged(SensorEvent event) {
|
|
|
|
|
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
|
|
|
|
@Override
|
|
|
|
|
public void onSensorChanged(SensorEvent event) {
|
|
|
|
|
Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
|
|
|
|
int displayRotation = display.getRotation();
|
|
|
|
|
|
|
|
|
|
float[] adjustedValues = new float[3];
|
|
|
|
|
final int axisSwap[][] = {
|
|
|
|
|
{ 1, -1, 0, 1 }, // ROTATION_0
|
|
|
|
|
{-1, -1, 1, 0 }, // ROTATION_90
|
|
|
|
|
{-1, 1, 0, 1 }, // ROTATION_180
|
|
|
|
|
{ 1, 1, 1, 0 } }; // ROTATION_270
|
|
|
|
|
{ -1, -1, 1, 0 }, // ROTATION_90
|
|
|
|
|
{ -1, 1, 0, 1 }, // ROTATION_180
|
|
|
|
|
{ 1, 1, 1, 0 }
|
|
|
|
|
}; // ROTATION_270
|
|
|
|
|
|
|
|
|
|
final int[] as = axisSwap[displayRotation];
|
|
|
|
|
adjustedValues[0] = (float)as[0] * event.values[ as[2] ];
|
|
|
|
|
adjustedValues[1] = (float)as[1] * event.values[ as[3] ];
|
|
|
|
|
adjustedValues[0] = (float)as[0] * event.values[as[2]];
|
|
|
|
|
adjustedValues[1] = (float)as[1] * event.values[as[3]];
|
|
|
|
|
adjustedValues[2] = event.values[2];
|
|
|
|
|
|
|
|
|
|
final float x = adjustedValues[0];
|
|
|
|
|
@ -738,27 +715,28 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
if (typeOfSensor == Sensor.TYPE_ACCELEROMETER) {
|
|
|
|
|
GodotLib.accelerometer(-x,y,-z);
|
|
|
|
|
GodotLib.accelerometer(-x, y, -z);
|
|
|
|
|
}
|
|
|
|
|
if (typeOfSensor == Sensor.TYPE_GRAVITY) {
|
|
|
|
|
GodotLib.gravity(-x,y,-z);
|
|
|
|
|
GodotLib.gravity(-x, y, -z);
|
|
|
|
|
}
|
|
|
|
|
if (typeOfSensor == Sensor.TYPE_MAGNETIC_FIELD) {
|
|
|
|
|
GodotLib.magnetometer(-x,y,-z);
|
|
|
|
|
GodotLib.magnetometer(-x, y, -z);
|
|
|
|
|
}
|
|
|
|
|
if (typeOfSensor == Sensor.TYPE_GYROSCOPE) {
|
|
|
|
|
GodotLib.gyroscope(x,-y,z);
|
|
|
|
|
GodotLib.gyroscope(x, -y, z);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override public final void onAccuracyChanged(Sensor sensor, int accuracy) {
|
|
|
|
|
@Override
|
|
|
|
|
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
|
|
|
|
|
// Do something here if sensor accuracy changes.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
/*
|
|
|
|
|
@Override public boolean dispatchKeyEvent(KeyEvent event) {
|
|
|
|
|
|
|
|
|
|
if (event.getKeyCode()==KeyEvent.KEYCODE_BACK) {
|
|
|
|
|
@ -772,12 +750,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override public void onBackPressed() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
boolean shouldQuit = true;
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<singleton_count;i++) {
|
|
|
|
|
for (int i = 0; i < singleton_count; i++) {
|
|
|
|
|
if (singletons[i].onMainBackPressed()) {
|
|
|
|
|
shouldQuit = false;
|
|
|
|
|
}
|
|
|
|
|
@ -799,9 +778,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
System.exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean obbIsCorrupted(String f, String main_pack_md5){
|
|
|
|
|
private boolean obbIsCorrupted(String f, String main_pack_md5) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
@ -819,17 +796,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
}
|
|
|
|
|
} while (numRead != -1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fis.close();
|
|
|
|
|
byte[] messageDigest = complete.digest();
|
|
|
|
|
|
|
|
|
|
// Create Hex String
|
|
|
|
|
StringBuffer hexString = new StringBuffer();
|
|
|
|
|
for (int i=0; i<messageDigest.length; i++) {
|
|
|
|
|
for (int i = 0; i < messageDigest.length; i++) {
|
|
|
|
|
String s = Integer.toHexString(0xFF & messageDigest[i]);
|
|
|
|
|
|
|
|
|
|
if (s.length()==1) {
|
|
|
|
|
s="0"+s;
|
|
|
|
|
if (s.length() == 1) {
|
|
|
|
|
s = "0" + s;
|
|
|
|
|
}
|
|
|
|
|
hexString.append(s);
|
|
|
|
|
}
|
|
|
|
|
@ -837,13 +813,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
//Log.d("GODOT","**PACK** - My MD5: "+hexString+" - APK md5: "+main_pack_md5);
|
|
|
|
|
if (!md5str.equals(main_pack_md5)) {
|
|
|
|
|
Log.d("GODOT","**PACK MD5 MISMATCH???** - MD5 Found: "+md5str+" "+Integer.toString(md5str.length())+" - MD5 Expected: "+main_pack_md5+" "+Integer.toString(main_pack_md5.length()));
|
|
|
|
|
Log.d("GODOT", "**PACK MD5 MISMATCH???** - MD5 Found: " + md5str + " " + Integer.toString(md5str.length()) + " - MD5 Expected: " + main_pack_md5 + " " + Integer.toString(main_pack_md5.length()));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
Log.d("GODOT","**PACK FAIL**");
|
|
|
|
|
Log.d("GODOT", "**PACK FAIL**");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -852,18 +828,18 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
public boolean gotTouchEvent(final MotionEvent event) {
|
|
|
|
|
|
|
|
|
|
super.onTouchEvent(event);
|
|
|
|
|
final int evcount=event.getPointerCount();
|
|
|
|
|
if (evcount==0)
|
|
|
|
|
final int evcount = event.getPointerCount();
|
|
|
|
|
if (evcount == 0)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (mView != null) {
|
|
|
|
|
final int[] arr = new int[event.getPointerCount()*3];
|
|
|
|
|
final int[] arr = new int[event.getPointerCount() * 3];
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<event.getPointerCount();i++) {
|
|
|
|
|
for (int i = 0; i < event.getPointerCount(); i++) {
|
|
|
|
|
|
|
|
|
|
arr[i*3+0]=(int)event.getPointerId(i);
|
|
|
|
|
arr[i*3+1]=(int)event.getX(i);
|
|
|
|
|
arr[i*3+2]=(int)event.getY(i);
|
|
|
|
|
arr[i * 3 + 0] = (int)event.getPointerId(i);
|
|
|
|
|
arr[i * 3 + 1] = (int)event.getX(i);
|
|
|
|
|
arr[i * 3 + 2] = (int)event.getY(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//System.out.printf("gaction: %d\n",event.getAction());
|
|
|
|
|
@ -871,13 +847,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
mView.queueEvent(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
switch(action) {
|
|
|
|
|
switch (action) {
|
|
|
|
|
case MotionEvent.ACTION_DOWN: {
|
|
|
|
|
GodotLib.touch(0,0,evcount,arr);
|
|
|
|
|
GodotLib.touch(0, 0, evcount, arr);
|
|
|
|
|
//System.out.printf("action down at: %f,%f\n", event.getX(),event.getY());
|
|
|
|
|
} break;
|
|
|
|
|
case MotionEvent.ACTION_MOVE: {
|
|
|
|
|
GodotLib.touch(1,0,evcount,arr);
|
|
|
|
|
GodotLib.touch(1, 0, evcount, arr);
|
|
|
|
|
/*
|
|
|
|
|
for(int i=0;i<event.getPointerCount();i++) {
|
|
|
|
|
System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
|
|
|
|
|
@ -887,17 +863,17 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
case MotionEvent.ACTION_POINTER_UP: {
|
|
|
|
|
final int indexPointUp = event.getActionIndex();
|
|
|
|
|
final int pointer_idx = event.getPointerId(indexPointUp);
|
|
|
|
|
GodotLib.touch(4,pointer_idx,evcount,arr);
|
|
|
|
|
GodotLib.touch(4, pointer_idx, evcount, arr);
|
|
|
|
|
//System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
|
|
|
|
|
} break;
|
|
|
|
|
case MotionEvent.ACTION_POINTER_DOWN: {
|
|
|
|
|
int pointer_idx = event.getActionIndex();
|
|
|
|
|
GodotLib.touch(3,pointer_idx,evcount,arr);
|
|
|
|
|
GodotLib.touch(3, pointer_idx, evcount, arr);
|
|
|
|
|
//System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
|
|
|
|
|
} break;
|
|
|
|
|
case MotionEvent.ACTION_CANCEL:
|
|
|
|
|
case MotionEvent.ACTION_UP: {
|
|
|
|
|
GodotLib.touch(2,0,evcount,arr);
|
|
|
|
|
GodotLib.touch(2, 0, evcount, arr);
|
|
|
|
|
/*
|
|
|
|
|
for(int i=0;i<event.getPointerCount();i++) {
|
|
|
|
|
System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
|
|
|
|
|
@ -911,14 +887,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
|
|
|
|
|
String s = event.getCharacters();
|
|
|
|
|
if (s == null || s.length() == 0)
|
|
|
|
|
return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
|
|
|
|
|
|
|
|
|
final char[] cc = s.toCharArray();
|
|
|
|
|
int cnt = 0;
|
|
|
|
|
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);
|
|
|
|
|
final Activity me = this;
|
|
|
|
|
queueEvent(new Runnable() {
|
|
|
|
|
@ -939,7 +917,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
|
|
|
|
|
private void queueEvent(Runnable runnable) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PaymentsManager getPaymentsManager() {
|
|
|
|
|
@ -952,7 +929,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Audio
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -1024,7 +1000,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
showDashboard = false;
|
|
|
|
|
paused = false;
|
|
|
|
|
indeterminate = false;
|
|
|
|
|
// validateXAPKZipFiles();
|
|
|
|
|
// validateXAPKZipFiles();
|
|
|
|
|
initializeGodot();
|
|
|
|
|
return;
|
|
|
|
|
default:
|
|
|
|
|
@ -1046,7 +1022,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
setButtonPausedState(paused);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onDownloadProgress(DownloadProgressInfo progress) {
|
|
|
|
|
mAverageSpeed.setText(getString(com.godot.game.R.string.kilobytes_per_second,
|
|
|
|
|
@ -1055,15 +1030,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|
|
|
|
Helpers.getTimeRemaining(progress.mTimeRemaining)));
|
|
|
|
|
|
|
|
|
|
progress.mOverallTotal = progress.mOverallTotal;
|
|
|
|
|
mPB.setMax((int) (progress.mOverallTotal >> 8));
|
|
|
|
|
mPB.setProgress((int) (progress.mOverallProgress >> 8));
|
|
|
|
|
mProgressPercent.setText(Long.toString(progress.mOverallProgress
|
|
|
|
|
* 100 /
|
|
|
|
|
progress.mOverallTotal) + "%");
|
|
|
|
|
mProgressFraction.setText(Helpers.getDownloadProgressString
|
|
|
|
|
(progress.mOverallProgress,
|
|
|
|
|
mPB.setMax((int)(progress.mOverallTotal >> 8));
|
|
|
|
|
mPB.setProgress((int)(progress.mOverallProgress >> 8));
|
|
|
|
|
mProgressPercent.setText(Long.toString(progress.mOverallProgress * 100 /
|
|
|
|
|
progress.mOverallTotal) +
|
|
|
|
|
"%");
|
|
|
|
|
mProgressFraction.setText(Helpers.getDownloadProgressString(progress.mOverallProgress,
|
|
|
|
|
progress.mOverallTotal));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|