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


Java JRubyAdapter类代码示例

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


JRubyAdapter类属于org.ruboto包,在下文中一共展示了JRubyAdapter类的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: 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


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