From dc3b496575c11ae8eeb18998f576866322ca19f1 Mon Sep 17 00:00:00 2001 From: kiroukou Date: Tue, 15 Apr 2014 15:00:03 +0200 Subject: [PATCH] Update GameActivity.java Added onNewIntent to broadcast to extensions (mainly) --- .../src/org/haxe/lime/GameActivity.java | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/templates/android/template/src/org/haxe/lime/GameActivity.java b/templates/android/template/src/org/haxe/lime/GameActivity.java index fa8a63f0b..4a484bc31 100644 --- a/templates/android/template/src/org/haxe/lime/GameActivity.java +++ b/templates/android/template/src/org/haxe/lime/GameActivity.java @@ -95,47 +95,29 @@ public class GameActivity extends Activity implements SensorEventListener { Extension.mainContext = this; _sound = new Sound (getApplication ()); - //getResources().getAssets(); requestWindowFeature (Window.FEATURE_NO_TITLE); + ::if WIN_FULLSCREEN:: - ::if (ANDROID_TARGET_SDK_VERSION < 19):: - getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN - | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - ::end:: - ::end:: + ::if (ANDROID_TARGET_SDK_VERSION < 19):: + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN + | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + ::end:: + ::end:: + metrics = new DisplayMetrics (); getWindowManager ().getDefaultDisplay ().getMetrics (metrics); - // Pre-load these, so the C++ knows where to find them + + Log.d ("lime", "mMainView is NULL"); + + ::foreach ndlls:: + System.loadLibrary ("::name::"); + ::end:: + HXCPP.run ("ApplicationMain"); - //if (mMainView == null) { - - Log.d ("lime", "mMainView is NULL"); - - ::foreach ndlls:: - System.loadLibrary ("::name::");::end:: - HXCPP.run ("ApplicationMain"); - - //mMainView = new MainView (getApplication (), this); - - /*} else { - - ViewGroup parent = (ViewGroup)mMainView.getParent (); - - if (parent != null) { - - parent.removeView (mMainView); - - } - - mMainView.onResume (); - - } - - mView = mMainView;*/ mView = new MainView (getApplication (), this); setContentView (mView); @@ -150,6 +132,8 @@ public class GameActivity extends Activity implements SensorEventListener { } + Extension.PACKAGE_NAME = getApplicationContext().getPackageName(); + if (extensions == null) { extensions = new ArrayList(); @@ -418,6 +402,19 @@ public class GameActivity extends Activity implements SensorEventListener { } + @Override + protected void onNewIntent(final Intent intent) { + for (Extension extension : extensions) { + extension.onNewIntent (intent); + } + super.onNewIntent (intent); + } + + @Override + public void onBackPressed() { + + } + @Override protected void onActivityResult (int requestCode, int resultCode, Intent data) { @@ -802,4 +799,4 @@ public class GameActivity extends Activity implements SensorEventListener { } -} \ No newline at end of file +}