Sha256: cdaa1923ba7615958dc8ba45367c10dd85d2885d493cbf329b59ac6e24d2c684

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

package org.ruboto;

import android.content.Context;
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 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:");

        if (JRubyAdapter.isInitialized()) {
            getScriptInfo().setRubyClassName(getClass().getSimpleName());
        } else {
            showSplash();
            finish();
        }

        super.onCreate(bundle);
    }

    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() {
        if (!getIntent().getAction().equals(Intent.ACTION_VIEW)) {
            return new Intent(getIntent()).setAction(Intent.ACTION_VIEW);
        } else {
            return getIntent();
        }
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruboto-1.1.0 assets/src/org/ruboto/EntryPointActivity.java
ruboto-1.0.3 assets/src/org/ruboto/EntryPointActivity.java
ruboto-1.0.2 assets/src/org/ruboto/EntryPointActivity.java
ruboto-1.0.1 assets/src/org/ruboto/EntryPointActivity.java
ruboto-1.0.0 assets/src/org/ruboto/EntryPointActivity.java
ruboto-0.16.0 assets/src/org/ruboto/EntryPointActivity.java