当前位置: 首页>>代码示例>>Java>>正文


Java JRubyAdapter.runScriptlet方法代码示例

本文整理汇总了Java中org.ruboto.JRubyAdapter.runScriptlet方法的典型用法代码示例。如果您正苦于以下问题:Java JRubyAdapter.runScriptlet方法的具体用法?Java JRubyAdapter.runScriptlet怎么用?Java JRubyAdapter.runScriptlet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ruboto.JRubyAdapter的用法示例。


在下文中一共展示了JRubyAdapter.runScriptlet方法的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);

    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");
}
 
开发者ID:jgretz,项目名称:Marvelous-Mobile-Ruby-Development,代码行数:21,代码来源:InstrumentationTestRunner.java

示例2: 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;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:41,代码来源:GraphicsView.java

示例3: 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");
}
 
开发者ID:pestrada,项目名称:tijuana,代码行数:29,代码来源:InstrumentationTestRunner.java

示例4: 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;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:39,代码来源:GraphicsView.java

示例5: onSetAlpha

import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public boolean onSetAlpha(int alpha) {
  if (ScriptLoader.isCalledFromJRuby()) return super.onSetAlpha(alpha);
  if (!JRubyAdapter.isInitialized()) {
    Log.i("Method called before JRuby runtime was initialized: GraphicsView#onSetAlpha");
    return super.onSetAlpha(alpha);
  }
  String rubyClassName = scriptInfo.getRubyClassName();
  if (rubyClassName == null) return super.onSetAlpha(alpha);
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_set_alpha}")) {
    // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
    if (JRubyAdapter.isJRubyPreOneSeven()) {
      JRubyAdapter.put("$arg_alpha", alpha);
      JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
      return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.on_set_alpha($arg_alpha)");
    } else {
      if (JRubyAdapter.isJRubyOneSeven()) {
        return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_set_alpha", alpha);
      } 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 == :onSetAlpha}")) {
      // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
      if (JRubyAdapter.isJRubyPreOneSeven()) {
        JRubyAdapter.put("$arg_alpha", alpha);
        JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
        return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.onSetAlpha($arg_alpha)");
      } else {
        if (JRubyAdapter.isJRubyOneSeven()) {
          return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onSetAlpha", alpha);
        } else {
          throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
        }
      }
    } else {
      return super.onSetAlpha(alpha);
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:41,代码来源:GraphicsView.java

示例6: 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;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:41,代码来源:GraphicsView.java

示例7: onSaveInstanceState

import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public android.os.Parcelable onSaveInstanceState() {
  if (ScriptLoader.isCalledFromJRuby()) return super.onSaveInstanceState();
  if (!JRubyAdapter.isInitialized()) {
    Log.i("Method called before JRuby runtime was initialized: GraphicsView#onSaveInstanceState");
    return super.onSaveInstanceState();
  }
  String rubyClassName = scriptInfo.getRubyClassName();
  if (rubyClassName == null) return super.onSaveInstanceState();
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_save_instance_state}")) {
    // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
    if (JRubyAdapter.isJRubyPreOneSeven()) {
      JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
      return (android.os.Parcelable) JRubyAdapter.runScriptlet("$ruby_instance.on_save_instance_state()");
    } else {
      if (JRubyAdapter.isJRubyOneSeven()) {
        return (android.os.Parcelable) JRubyAdapter.runRubyMethod(android.os.Parcelable.class, scriptInfo.getRubyInstance(), "on_save_instance_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 == :onSaveInstanceState}")) {
      // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
      if (JRubyAdapter.isJRubyPreOneSeven()) {
        JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
        return (android.os.Parcelable) JRubyAdapter.runScriptlet("$ruby_instance.onSaveInstanceState()");
      } else {
        if (JRubyAdapter.isJRubyOneSeven()) {
          return (android.os.Parcelable) JRubyAdapter.runRubyMethod(android.os.Parcelable.class, scriptInfo.getRubyInstance(), "onSaveInstanceState");
        } else {
          throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
        }
      }
    } else {
      return super.onSaveInstanceState();
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:39,代码来源:GraphicsView.java

示例8: 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;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:39,代码来源:GraphicsView.java

示例9: 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;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:41,代码来源:GraphicsView.java

示例10: onConfigurationChanged

import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
  if (ScriptLoader.isCalledFromJRuby()) {super.onConfigurationChanged(newConfig); return;}
  if (!JRubyAdapter.isInitialized()) {
    Log.i("Method called before JRuby runtime was initialized: GraphicsView#onConfigurationChanged");
    {super.onConfigurationChanged(newConfig); return;}
  }
  String rubyClassName = scriptInfo.getRubyClassName();
  if (rubyClassName == null) {super.onConfigurationChanged(newConfig); return;}
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_configuration_changed}")) {
    // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
    if (JRubyAdapter.isJRubyPreOneSeven()) {
      JRubyAdapter.put("$arg_newConfig", newConfig);
      JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
      JRubyAdapter.runScriptlet("$ruby_instance.on_configuration_changed($arg_newConfig)");
    } else {
      if (JRubyAdapter.isJRubyOneSeven()) {
        JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_configuration_changed", newConfig);
      } 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 == :onConfigurationChanged}")) {
      // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
      if (JRubyAdapter.isJRubyPreOneSeven()) {
        JRubyAdapter.put("$arg_newConfig", newConfig);
        JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
        JRubyAdapter.runScriptlet("$ruby_instance.onConfigurationChanged($arg_newConfig)");
      } else {
        if (JRubyAdapter.isJRubyOneSeven()) {
          JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onConfigurationChanged", newConfig);
        } else {
          throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
        }
      }
    } else {
      {super.onConfigurationChanged(newConfig); return;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:41,代码来源:GraphicsView.java

示例11: onFinishTemporaryDetach

import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public void onFinishTemporaryDetach() {
  if (ScriptLoader.isCalledFromJRuby()) {super.onFinishTemporaryDetach(); return;}
  if (!JRubyAdapter.isInitialized()) {
    Log.i("Method called before JRuby runtime was initialized: GraphicsView#onFinishTemporaryDetach");
    {super.onFinishTemporaryDetach(); return;}
  }
  String rubyClassName = scriptInfo.getRubyClassName();
  if (rubyClassName == null) {super.onFinishTemporaryDetach(); return;}
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_finish_temporary_detach}")) {
    // 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_finish_temporary_detach()");
    } else {
      if (JRubyAdapter.isJRubyOneSeven()) {
        JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "on_finish_temporary_detach");
      } 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 == :onFinishTemporaryDetach}")) {
      // 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.onFinishTemporaryDetach()");
      } else {
        if (JRubyAdapter.isJRubyOneSeven()) {
          JRubyAdapter.runRubyMethod(scriptInfo.getRubyInstance(), "onFinishTemporaryDetach");
        } else {
          throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
        }
      }
    } else {
      {super.onFinishTemporaryDetach(); return;}
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:39,代码来源:GraphicsView.java

示例12: 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();
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:39,代码来源:GraphicsView.java

示例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);
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:41,代码来源:GraphicsView.java

示例14: onKeyPreIme

import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public boolean onKeyPreIme(int keyCode, android.view.KeyEvent event) {
  if (ScriptLoader.isCalledFromJRuby()) return super.onKeyPreIme(keyCode, event);
  if (!JRubyAdapter.isInitialized()) {
    Log.i("Method called before JRuby runtime was initialized: GraphicsView#onKeyPreIme");
    return super.onKeyPreIme(keyCode, event);
  }
  String rubyClassName = scriptInfo.getRubyClassName();
  if (rubyClassName == null) return super.onKeyPreIme(keyCode, event);
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_key_pre_ime}")) {
    // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
    if (JRubyAdapter.isJRubyPreOneSeven()) {
      JRubyAdapter.put("$arg_keyCode", keyCode);
      JRubyAdapter.put("$arg_event", event);
      JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
      return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.on_key_pre_ime($arg_keyCode, $arg_event)");
    } else {
      if (JRubyAdapter.isJRubyOneSeven()) {
        return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_key_pre_ime", new Object[]{keyCode, 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 == :onKeyPreIme}")) {
      // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
      if (JRubyAdapter.isJRubyPreOneSeven()) {
        JRubyAdapter.put("$arg_keyCode", keyCode);
        JRubyAdapter.put("$arg_event", event);
        JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
        return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.onKeyPreIme($arg_keyCode, $arg_event)");
      } else {
        if (JRubyAdapter.isJRubyOneSeven()) {
          return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onKeyPreIme", new Object[]{keyCode, event});
        } else {
          throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
        }
      }
    } else {
      return super.onKeyPreIme(keyCode, event);
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:43,代码来源:GraphicsView.java

示例15: onKeyLongPress

import org.ruboto.JRubyAdapter; //导入方法依赖的package包/类
public boolean onKeyLongPress(int keyCode, android.view.KeyEvent event) {
  if (ScriptLoader.isCalledFromJRuby()) return super.onKeyLongPress(keyCode, event);
  if (!JRubyAdapter.isInitialized()) {
    Log.i("Method called before JRuby runtime was initialized: GraphicsView#onKeyLongPress");
    return super.onKeyLongPress(keyCode, event);
  }
  String rubyClassName = scriptInfo.getRubyClassName();
  if (rubyClassName == null) return super.onKeyLongPress(keyCode, event);
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_key_long_press}")) {
    // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
    if (JRubyAdapter.isJRubyPreOneSeven()) {
      JRubyAdapter.put("$arg_keyCode", keyCode);
      JRubyAdapter.put("$arg_event", event);
      JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
      return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.on_key_long_press($arg_keyCode, $arg_event)");
    } else {
      if (JRubyAdapter.isJRubyOneSeven()) {
        return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_key_long_press", new Object[]{keyCode, 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 == :onKeyLongPress}")) {
      // FIXME(uwe): Simplify when we stop support for RubotoCore 0.4.7
      if (JRubyAdapter.isJRubyPreOneSeven()) {
        JRubyAdapter.put("$arg_keyCode", keyCode);
        JRubyAdapter.put("$arg_event", event);
        JRubyAdapter.put("$ruby_instance", scriptInfo.getRubyInstance());
        return (Boolean) JRubyAdapter.runScriptlet("$ruby_instance.onKeyLongPress($arg_keyCode, $arg_event)");
      } else {
        if (JRubyAdapter.isJRubyOneSeven()) {
          return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onKeyLongPress", new Object[]{keyCode, event});
        } else {
          throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
        }
      }
    } else {
      return super.onKeyLongPress(keyCode, event);
    }
  }
}
 
开发者ID:Nitrino,项目名称:ruboto_audio,代码行数:43,代码来源:GraphicsView.java


注:本文中的org.ruboto.JRubyAdapter.runScriptlet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。