Sha256: 50b3021d6fd361838b7082832158e1fd022b2bfe05251006b049731ce03bb5cd

Contents?: true

Size: 1.79 KB

Versions: 14

Compression:

Stored size: 1.79 KB

Contents

package THE_PACKAGE;

import java.io.IOException;

import org.ruboto.ScriptLoader;

public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
    private final ScriptInfo scriptInfo = new ScriptInfo();

    public ScriptInfo getScriptInfo() {
        return scriptInfo;
    }

    public THE_RUBOTO_CLASS() {
        super();
        scriptInfo.setRubyClassName(getClass().getSimpleName());
        if (JRubyAdapter.isInitialized()) {
            ScriptLoader.loadScript(this);
        }
    }

    public void onReceive(android.content.Context context, android.content.Intent intent) {
        try {
            Log.d("onReceive: " + this + " " + ScriptLoader.isCalledFromJRuby());
            if (ScriptLoader.isCalledFromJRuby()) {
                return;
            }
            if (!scriptInfo.isLoaded()) {
                if (JRubyAdapter.setUpJRuby(context)) {
                    ScriptLoader.loadScript(this);
                } else {
                    // FIXME(uwe): What to do if the Ruboto Core platform is missing?
                }
            }

            // FIXME(uwe):  Simplify when we stop support for snake case aliasing interface callback methods.
            if ((Boolean)JRubyAdapter.runScriptlet(scriptInfo.getRubyClassName() + ".instance_methods(false).any?{|m| m.to_sym == :onReceive}")) {
                Log.d("onReceive: call method");
    	        JRubyAdapter.runRubyMethod(this, "onReceive", new Object[]{context, intent});
            } else if ((Boolean)JRubyAdapter.runScriptlet(scriptInfo.getRubyClassName() + ".instance_methods(false).any?{|m| m.to_sym == :on_receive}")) {
    	        JRubyAdapter.runRubyMethod(this, "on_receive", new Object[]{context, intent});
            }
            // EMXIF
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruboto-1.6.1 assets/src/RubotoBroadcastReceiver.java
ruboto-1.6.0 assets/src/RubotoBroadcastReceiver.java
ruboto-1.5.0 assets/src/RubotoBroadcastReceiver.java
ruboto-1.4.1 assets/src/RubotoBroadcastReceiver.java
ruboto-1.4.0 assets/src/RubotoBroadcastReceiver.java
ruboto-1.3.1 assets/src/RubotoBroadcastReceiver.java
ruboto-1.3.0 assets/src/RubotoBroadcastReceiver.java
ruboto-1.2.0 assets/src/RubotoBroadcastReceiver.java
ruboto-1.1.2 assets/src/RubotoBroadcastReceiver.java
ruboto-1.1.1 assets/src/RubotoBroadcastReceiver.java
ruboto-1.1.0 assets/src/RubotoBroadcastReceiver.java
ruboto-1.0.3 assets/src/RubotoBroadcastReceiver.java
ruboto-1.0.2 assets/src/RubotoBroadcastReceiver.java
ruboto-1.0.1 assets/src/RubotoBroadcastReceiver.java