|
@@ -39,6 +39,7 @@ import com.edufound.mobile.R;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
|
|
|
import org.cocos2dx.javascript.presenter.MainPresenter;
|
|
import org.cocos2dx.javascript.presenter.MainPresenter;
|
|
|
|
+import org.cocos2dx.javascript.util.Consts;
|
|
import org.cocos2dx.javascript.util.Logger;
|
|
import org.cocos2dx.javascript.util.Logger;
|
|
import org.cocos2dx.lib.Cocos2dxActivity;
|
|
import org.cocos2dx.lib.Cocos2dxActivity;
|
|
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
|
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
|
@@ -59,25 +60,19 @@ public class AppActivity extends Cocos2dxActivity {
|
|
// Workaround in
|
|
// Workaround in
|
|
// https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
|
// https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
|
if (!isTaskRoot()) {
|
|
if (!isTaskRoot()) {
|
|
- // Android launched another instance of the root activity into an existing task
|
|
|
|
- // so just quietly finish and go away, dropping the user back into the activity
|
|
|
|
- // at the top of the stack (ie: the last state of this task)
|
|
|
|
- // Don't need to finish it again since it's finished in super.onCreate .
|
|
|
|
|
|
+ Intent mainIntent = getIntent();
|
|
|
|
+ String action = mainIntent.getAction();
|
|
|
|
+ if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
|
|
|
|
+ finish();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// DO OTHER INITIALIZATION BELOW
|
|
// DO OTHER INITIALIZATION BELOW
|
|
-
|
|
|
|
|
|
+ sendBroadcast(new Intent("android.intent.action.STATUSBAR_DISABLE"));
|
|
SDKWrapper.getInstance().init(this);
|
|
SDKWrapper.getInstance().init(this);
|
|
showSplash();
|
|
showSplash();
|
|
mPresenter = new MainPresenter(this);
|
|
mPresenter = new MainPresenter(this);
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("sd", "1");
|
|
|
|
- map.put("sd1", "11");
|
|
|
|
- map.put("sd11", "111");
|
|
|
|
- map.put("sd111", "1111");
|
|
|
|
- Gson gson = new Gson();
|
|
|
|
- String json = gson.toJson(map);
|
|
|
|
- Logger.e("测试json:" + json);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressLint("ResourceType")
|
|
@SuppressLint("ResourceType")
|
|
@@ -114,6 +109,7 @@ public class AppActivity extends Cocos2dxActivity {
|
|
protected void onResume() {
|
|
protected void onResume() {
|
|
super.onResume();
|
|
super.onResume();
|
|
SDKWrapper.getInstance().onResume();
|
|
SDKWrapper.getInstance().onResume();
|
|
|
|
+ Logger.e("onResume");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -121,6 +117,7 @@ public class AppActivity extends Cocos2dxActivity {
|
|
protected void onPause() {
|
|
protected void onPause() {
|
|
super.onPause();
|
|
super.onPause();
|
|
SDKWrapper.getInstance().onPause();
|
|
SDKWrapper.getInstance().onPause();
|
|
|
|
+ Logger.e("onPause");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -134,6 +131,7 @@ public class AppActivity extends Cocos2dxActivity {
|
|
}
|
|
}
|
|
|
|
|
|
SDKWrapper.getInstance().onDestroy();
|
|
SDKWrapper.getInstance().onDestroy();
|
|
|
|
+ Logger.e("onDestroy");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -147,48 +145,71 @@ public class AppActivity extends Cocos2dxActivity {
|
|
protected void onNewIntent(Intent intent) {
|
|
protected void onNewIntent(Intent intent) {
|
|
super.onNewIntent(intent);
|
|
super.onNewIntent(intent);
|
|
SDKWrapper.getInstance().onNewIntent(intent);
|
|
SDKWrapper.getInstance().onNewIntent(intent);
|
|
|
|
+ Logger.e("onNewIntent");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onRestart() {
|
|
protected void onRestart() {
|
|
super.onRestart();
|
|
super.onRestart();
|
|
SDKWrapper.getInstance().onRestart();
|
|
SDKWrapper.getInstance().onRestart();
|
|
|
|
+ Logger.e("onRestart");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onStop() {
|
|
protected void onStop() {
|
|
super.onStop();
|
|
super.onStop();
|
|
SDKWrapper.getInstance().onStop();
|
|
SDKWrapper.getInstance().onStop();
|
|
|
|
+ Logger.e("onStop");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onBackPressed() {
|
|
public void onBackPressed() {
|
|
SDKWrapper.getInstance().onBackPressed();
|
|
SDKWrapper.getInstance().onBackPressed();
|
|
super.onBackPressed();
|
|
super.onBackPressed();
|
|
|
|
+ Logger.e("onBackPressed");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
SDKWrapper.getInstance().onConfigurationChanged(newConfig);
|
|
SDKWrapper.getInstance().onConfigurationChanged(newConfig);
|
|
super.onConfigurationChanged(newConfig);
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
+ Logger.e("onConfigurationChanged");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
SDKWrapper.getInstance().onRestoreInstanceState(savedInstanceState);
|
|
SDKWrapper.getInstance().onRestoreInstanceState(savedInstanceState);
|
|
super.onRestoreInstanceState(savedInstanceState);
|
|
super.onRestoreInstanceState(savedInstanceState);
|
|
|
|
+ Logger.e("onRestoreInstanceState");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
SDKWrapper.getInstance().onSaveInstanceState(outState);
|
|
SDKWrapper.getInstance().onSaveInstanceState(outState);
|
|
super.onSaveInstanceState(outState);
|
|
super.onSaveInstanceState(outState);
|
|
|
|
+ Logger.e("onSaveInstanceState");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onStart() {
|
|
protected void onStart() {
|
|
SDKWrapper.getInstance().onStart();
|
|
SDKWrapper.getInstance().onStart();
|
|
super.onStart();
|
|
super.onStart();
|
|
|
|
+ Logger.e("onStart");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onWindowFocusChanged(boolean hasFocus) {
|
|
|
|
+ super.onWindowFocusChanged(hasFocus);
|
|
|
|
+// Intent mHomeIntent = new Intent(Intent.ACTION_MAIN);
|
|
|
|
+// mHomeIntent.addCategory(Intent.CATEGORY_HOME);
|
|
|
|
+// mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
|
|
|
+// Consts.mApplicatonContext.startActivity(mHomeIntent);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|