Sha256: da9a71c2ed9dc8f2663764564276c0d0708f177e1af67aceb8f1d06fd1c7932a
Contents?: true
Size: 1.86 KB
Versions: 6
Compression:
Stored size: 1.86 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(); private boolean scriptLoaded = false; public ScriptInfo getScriptInfo() { return scriptInfo; } public THE_RUBOTO_CLASS() { this(null); } public THE_RUBOTO_CLASS(String name) { super(); if (name != null) { scriptInfo.setScriptName(name); if (JRubyAdapter.isInitialized()) { ScriptLoader.loadScript(this); scriptLoaded = true; } } } public void onReceive(android.content.Context context, android.content.Intent intent) { try { Log.d("onReceive: " + this); if (!scriptLoaded) { if (JRubyAdapter.setUpJRuby(context)) { ScriptLoader.loadScript(this); scriptLoaded = true; } else { // FIXME(uwe): What to do if the Ruboto Core platform is missing? } } // FIXME(uwe): Simplify when we stop supporting JRuby 1.6.x if (JRubyAdapter.isJRubyPreOneSeven()) { JRubyAdapter.put("$broadcast_receiver", this); JRubyAdapter.put("$context", context); JRubyAdapter.put("$intent", intent); JRubyAdapter.runScriptlet("$broadcast_receiver.on_receive($context, $intent)"); } else if (JRubyAdapter.isJRubyOneSeven()) { JRubyAdapter.runRubyMethod(this, "on_receive", new Object[]{context, intent}); } else { throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION")); } } catch(Exception e) { e.printStackTrace(); } } }
Version data entries
6 entries across 6 versions & 1 rubygems