• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JRubyAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



JRubyAdapter类属于org.ruboto包,在下文中一共展示了JRubyAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: runTest

import org.ruboto.JRubyAdapter; //导入依赖的package包/类
public void runTest() throws Exception {
    try {
        Log.i(getClass().getName(), "runTest: " + getName());
        final Activity activity = getActivity();
        Log.i(getClass().getName(), "Activity OK");
        Runnable testRunnable = new Runnable() {
            public void run() {
                if (setup != null) {
                    Log.i(getClass().getName(), "calling setup");
                    JRubyAdapter.setScriptFilename(filename);
                    JRubyAdapter.runRubyMethod(setup, "call", activity);
                    Log.i(getClass().getName(), "setup ok");
                }

                JRubyAdapter.setScriptFilename(filename);
                JRubyAdapter.runRubyMethod(block, "call", activity);

                if (teardown != null) {
                    Log.i(getClass().getName(), "calling teardown");
                    JRubyAdapter.runRubyMethod(teardown, "call", activity);
                    Log.i(getClass().getName(), "teardown ok");
                }
            }
        };
        if (onUiThread) {
            runTestOnUiThread(testRunnable);
        } else {
            testRunnable.run();
        }
        Log.i(getClass().getName(), "runTest ok");
    } catch (Throwable t) {
        AssertionFailedError afe = new AssertionFailedError("Exception running test.");
        afe.initCause(t);
        throw afe;
    }
}
 
开发者ID:jgretz,项目名称:Marvelous-Mobile-Ruby-Development,代码行数:37,代码来源:ActivityTest.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: onAnimationStart

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


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


示例7: 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


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


示例9: 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


示例10: 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


示例11: onFinishInflate

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


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


示例13: 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


示例14: 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


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


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


示例17: onWindowFocusChanged

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


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


示例19: 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 RuntimeExceptio 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ASN1Integer类代码示例发布时间:2022-05-23
下一篇:
Java StyledTextArea类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap