assets/src/org/ruboto/EntryPointActivity.java in ruboto-0.14.0 vs assets/src/org/ruboto/EntryPointActivity.java in ruboto-0.15.0

- old
+ new

@@ -4,80 +4,41 @@ import android.content.Intent; import android.os.Bundle; /** * This Activity acts as an entry point to the app. It must initialize the - * JRuby runtime before continuing its life cycle. - * While JRuby is initializing, a progress dialog is shown. - * If R.layout.splash is defined, by adding a res/layout/splash.xml file, - * this layout is displayed instead of the progress dialog. + * JRuby runtime before restarting its life cycle. While JRuby is initializing, + * a progress dialog is shown. If R.layout.splash is defined, by adding a + * res/layout/splash.xml file, this layout is displayed instead of the progress + * dialog. */ public class EntryPointActivity extends org.ruboto.RubotoActivity { public void onCreate(Bundle bundle) { Log.d("EntryPointActivity onCreate:"); - getScriptInfo().setRubyClassName(getClass().getSimpleName()); - if (!JRubyAdapter.isInitialized()) { - showSplash(); - finish(); - } - super.onCreate(bundle); - } - - public void onResume() { - Log.d("onResume: "); - - if(getScriptInfo().isLoaded()) { - Log.d("onResume: App already started!"); - super.onResume(); - return; - } - - Log.d("onResume: Checking JRuby"); if (JRubyAdapter.isInitialized()) { - Log.d("Already initialized"); - fireRubotoActivity(); + getScriptInfo().setRubyClassName(getClass().getSimpleName()); } else { - Log.d("Not initialized"); - showSplash(); - finish(); + showSplash(); + finish(); } - super.onResume(); - } - public void onPause() { - Log.d("onPause: "); - super.onPause(); + super.onCreate(bundle); } - public void onDestroy() { - Log.d("onDestroy: "); - super.onDestroy(); - } - - - protected void fireRubotoActivity() { - if(getScriptInfo().isLoaded()) return; - Log.i("Starting activity"); - ScriptLoader.loadScript(this); - runOnUiThread(new Runnable() { - public void run() { - ScriptLoader.callOnCreate(EntryPointActivity.this, args[0]); - onStart(); - onResume(); - } - }); - } - private void showSplash() { Intent splashIntent = new Intent(this, SplashActivity.class); splashIntent.putExtra(Intent.EXTRA_INTENT, futureIntent()); startActivity(splashIntent); } // The Intent to to call when done. Defaults to calling this Activity again. // Override to change. protected Intent futureIntent() { - return new Intent(this, this.getClass()); + if (getIntent().getAction().equals(Intent.ACTION_MAIN)) { + return new Intent(getIntent()).setAction(Intent.ACTION_VIEW); + } else { + return getIntent(); + } } }