本文整理汇总了Java中org.ruboto.JRubyAdapter.put方法的典型用法代码示例。如果您正苦于以下问题:Java JRubyAdapter.put方法的具体用法?Java JRubyAdapter.put怎么用?Java JRubyAdapter.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ruboto.JRubyAdapter
的用法示例。
在下文中一共展示了JRubyAdapter.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadScript
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
private void loadScript(String f) throws IOException {
Log.d(getClass().getName(), "Loading test script: " + f);
InputStream is = getClass().getClassLoader().getResourceAsStream(f);
BufferedReader buffer = new BufferedReader(new InputStreamReader(is));
StringBuilder source = new StringBuilder();
while (true) {
String line = buffer.readLine();
if (line == null) break;
source.append(line).append("\n");
}
buffer.close();
JRubyAdapter.setScriptFilename(f);
// FIXME(uwe): Simplify when we stop supporting JRuby < 1.7.0
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$test", this);
JRubyAdapter.put("$script_code", source.toString());
JRubyAdapter.put("$filename", f);
JRubyAdapter.runScriptlet("$test.instance_eval($script_code, $filename)");
} else {
if (f.equals("test_helper.rb")) {
JRubyAdapter.runScriptlet(source.toString());
} else {
JRubyAdapter.runRubyMethod(this, "instance_eval", source.toString(), f);
}
}
Log.d(getClass().getName(), "Test script " + f + " loaded");
}
示例2: onAnimationEnd
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onAnimationEnd() {
if (ScriptLoader.isCalledFromJRuby()) {super.onAnimationEnd(); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onAnimationEnd");
{super.onAnimationEnd(); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onAnimationEnd(); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_animation_end}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_animation_end()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_animation_end");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onAnimationEnd}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onAnimationEnd()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onAnimationEnd");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onAnimationEnd(); return;}
}
}
}
示例3: onTrackballEvent
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public boolean onTrackballEvent(android.view.MotionEvent event) {
if (ScriptLoader.isCalledFromJRuby()) return super.onTrackballEvent(event);
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onTrackballEvent");
return super.onTrackballEvent(event);
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) return super.onTrackballEvent(event);
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_trackball_event}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_event", event);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.on_trackball_event($arg_event)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_trackball_event", event);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onTrackballEvent}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_event", event);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.onTrackballEvent($arg_event)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onTrackballEvent", event);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
return super.onTrackballEvent(event);
}
}
}
示例4: onAttachedToWindow
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onAttachedToWindow() {
if (ScriptLoader.isCalledFromJRuby()) {super.onAttachedToWindow(); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onAttachedToWindow");
{super.onAttachedToWindow(); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onAttachedToWindow(); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_attached_to_window}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_attached_to_window()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_attached_to_window");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onAttachedToWindow}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onAttachedToWindow()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onAttachedToWindow");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onAttachedToWindow(); return;}
}
}
}
示例5: onCreateContextMenu
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onCreateContextMenu(android.view.ContextMenu menu) {
if (ScriptLoader.isCalledFromJRuby()) {super.onCreateContextMenu(menu); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onCreateContextMenu");
{super.onCreateContextMenu(menu); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onCreateContextMenu(menu); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_create_context_menu}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_menu", menu);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_create_context_menu($arg_menu)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_create_context_menu", menu);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onCreateContextMenu}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_menu", menu);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onCreateContextMenu($arg_menu)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onCreateContextMenu", menu);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onCreateContextMenu(menu); return;}
}
}
}
示例6: onCreateDrawableState
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public int[] onCreateDrawableState(int extraSpace) {
if (ScriptLoader.isCalledFromJRuby()) return super.onCreateDrawableState(extraSpace);
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onCreateDrawableState");
return super.onCreateDrawableState(extraSpace);
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) return super.onCreateDrawableState(extraSpace);
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_create_drawable_state}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_extraSpace", extraSpace);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (int[]) JRubyAdapter.runScriptlet("$ruby_instance.on_create_drawable_state($arg_extraSpace)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (int[]) JRubyAdapter.runRubyMethod(int[].class, scriptInfo.getRubyInstance(), "on_create_drawable_state", extraSpace);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onCreateDrawableState}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_extraSpace", extraSpace);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (int[]) JRubyAdapter.runScriptlet("$ruby_instance.onCreateDrawableState($arg_extraSpace)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (int[]) JRubyAdapter.runRubyMethod(int[].class, scriptInfo.getRubyInstance(), "onCreateDrawableState", extraSpace);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
return super.onCreateDrawableState(extraSpace);
}
}
}
示例7: onDetachedFromWindow
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onDetachedFromWindow() {
if (ScriptLoader.isCalledFromJRuby()) {super.onDetachedFromWindow(); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onDetachedFromWindow");
{super.onDetachedFromWindow(); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onDetachedFromWindow(); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_detached_from_window}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_detached_from_window()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_detached_from_window");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onDetachedFromWindow}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onDetachedFromWindow()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onDetachedFromWindow");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onDetachedFromWindow(); return;}
}
}
}
示例8: onDraw
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onDraw(android.graphics.Canvas canvas) {
if (ScriptLoader.isCalledFromJRuby()) {super.onDraw(canvas); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onDraw");
{super.onDraw(canvas); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onDraw(canvas); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_draw}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_canvas", canvas);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_draw($arg_canvas)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_draw", canvas);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onDraw}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_canvas", canvas);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onDraw($arg_canvas)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onDraw", canvas);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onDraw(canvas); return;}
}
}
}
示例9: onDisplayHint
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onDisplayHint(int hint) {
if (ScriptLoader.isCalledFromJRuby()) {super.onDisplayHint(hint); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onDisplayHint");
{super.onDisplayHint(hint); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onDisplayHint(hint); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_display_hint}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_hint", hint);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_display_hint($arg_hint)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_display_hint", hint);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onDisplayHint}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_hint", hint);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onDisplayHint($arg_hint)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onDisplayHint", hint);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onDisplayHint(hint); return;}
}
}
}
示例10: onCheckIsTextEditor
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public boolean onCheckIsTextEditor() {
if (ScriptLoader.isCalledFromJRuby()) return super.onCheckIsTextEditor();
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onCheckIsTextEditor");
return super.onCheckIsTextEditor();
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) return super.onCheckIsTextEditor();
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_check_is_text_editor}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.on_check_is_text_editor()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_check_is_text_editor");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onCheckIsTextEditor}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.onCheckIsTextEditor()");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onCheckIsTextEditor");
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
return super.onCheckIsTextEditor();
}
}
}
示例11: onRestoreInstanceState
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onRestoreInstanceState(android.os.Parcelable state) {
if (ScriptLoader.isCalledFromJRuby()) {super.onRestoreInstanceState(state); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onRestoreInstanceState");
{super.onRestoreInstanceState(state); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onRestoreInstanceState(state); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_restore_instance_state}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_state", state);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_restore_instance_state($arg_state)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_restore_instance_state", state);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onRestoreInstanceState}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_state", state);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onRestoreInstanceState($arg_state)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onRestoreInstanceState", state);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onRestoreInstanceState(state); return;}
}
}
}
示例12: onWindowVisibilityChanged
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onWindowVisibilityChanged(int visibility) {
if (ScriptLoader.isCalledFromJRuby()) {super.onWindowVisibilityChanged(visibility); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onWindowVisibilityChanged");
{super.onWindowVisibilityChanged(visibility); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onWindowVisibilityChanged(visibility); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_window_visibility_changed}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_visibility", visibility);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_window_visibility_changed($arg_visibility)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_window_visibility_changed", visibility);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onWindowVisibilityChanged}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_visibility", visibility);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onWindowVisibilityChanged($arg_visibility)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onWindowVisibilityChanged", visibility);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onWindowVisibilityChanged(visibility); return;}
}
}
}
示例13: onCreateInputConnection
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.EditorInfo outAttrs) {
if (ScriptLoader.isCalledFromJRuby()) return super.onCreateInputConnection(outAttrs);
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onCreateInputConnection");
return super.onCreateInputConnection(outAttrs);
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) return super.onCreateInputConnection(outAttrs);
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_create_input_connection}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_outAttrs", outAttrs);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (android.view.inputmethod.InputConnection) JRubyAdapter.runScriptlet("$ruby_instance.on_create_input_connection($arg_outAttrs)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (android.view.inputmethod.InputConnection) JRubyAdapter.runRubyMethod(android.view.inputmethod.InputConnection.class, scriptInfo.getRubyInstance(), "on_create_input_connection", outAttrs);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onCreateInputConnection}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_outAttrs", outAttrs);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (android.view.inputmethod.InputConnection) JRubyAdapter.runScriptlet("$ruby_instance.onCreateInputConnection($arg_outAttrs)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (android.view.inputmethod.InputConnection) JRubyAdapter.runRubyMethod(android.view.inputmethod.InputConnection.class, scriptInfo.getRubyInstance(), "onCreateInputConnection", outAttrs);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
return super.onCreateInputConnection(outAttrs);
}
}
}
示例14: onTouchEvent
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public boolean onTouchEvent(android.view.MotionEvent event) {
if (ScriptLoader.isCalledFromJRuby()) return super.onTouchEvent(event);
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onTouchEvent");
return super.onTouchEvent(event);
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) return super.onTouchEvent(event);
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_touch_event}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_event", event);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.on_touch_event($arg_event)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_touch_event", event);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onTouchEvent}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_event", event);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.onTouchEvent($arg_event)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onTouchEvent", event);
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
return super.onTouchEvent(event);
}
}
}
示例15: onFocusChanged
import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onFocusChanged(boolean gainFocus, int direction, android.graphics.Rect previouslyFocusedRect) {
if (ScriptLoader.isCalledFromJRuby()) {super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); return;}
if (!JRubyAdapter.isInitialized()) {
Log.i("Method called before JRuby runtime was initialized: GraphicsView#onFocusChanged");
{super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); return;}
}
String rubyClassName = scriptInfo.getRubyClassName();
if (rubyClassName == null) {super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); return;}
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_focus_changed}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_gainFocus", gainFocus);
JRubyAdapter.put("$arg_direction", direction);
JRubyAdapter.put("$arg_previouslyFocusedRect", previouslyFocusedRect);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.on_focus_changed($arg_gainFocus, $arg_direction, $arg_previouslyFocusedRect)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_focus_changed", new Object[]{gainFocus, direction, previouslyFocusedRect});
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onFocusChanged}")) {
// FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
if (JRubyAdapter.isJRubyPreOneSeven()) {
JRubyAdapter.put("$arg_gainFocus", gainFocus);
JRubyAdapter.put("$arg_direction", direction);
JRubyAdapter.put("$arg_previouslyFocusedRect", previouslyFocusedRect);
JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
JRubyAdapter.runScriptlet("$ruby_instance.onFocusChanged($arg_gainFocus, $arg_direction, $arg_previouslyFocusedRect)");
} else {
if (JRubyAdapter.isJRubyOneSeven()) {
JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onFocusChanged", new Object[]{gainFocus, direction, previouslyFocusedRect});
} else {
throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
}
}
} else {
{super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); return;}
}
}
}