Example #1
0
 public static HtmlActivityTask launchHtmlScript(
     File script, Service service, Intent intent, InterpreterConfiguration config) {
   if (!script.exists()) {
     throw new RuntimeException("No such script to launch.");
   }
   HtmlInterpreter interpreter =
       (HtmlInterpreter) config.getInterpreterByName(HtmlInterpreter.HTML);
   if (interpreter == null) {
     throw new RuntimeException("HtmlInterpreter is not available.");
   }
   final FacadeManager manager =
       new FacadeManager(
           FacadeConfiguration.getSdkLevel(),
           service,
           intent,
           FacadeConfiguration.getFacadeClasses());
   FutureActivityTaskExecutor executor =
       ((BaseApplication) service.getApplication()).getTaskExecutor();
   final HtmlActivityTask task =
       new HtmlActivityTask(
           manager,
           interpreter.getAndroidJsSource(),
           interpreter.getJsonSource(),
           script.getAbsolutePath(),
           true);
   executor.execute(task);
   return task;
 }
Example #2
0
 public static InterpreterProcess launchInterpreter(
     final AndroidProxy proxy,
     Intent intent,
     InterpreterConfiguration config,
     Runnable shutdownHook) {
   Interpreter interpreter;
   String interpreterName;
   interpreterName = intent.getStringExtra(Constants.EXTRA_INTERPRETER_NAME);
   interpreter = config.getInterpreterByName(interpreterName);
   InterpreterProcess process = new InterpreterProcess(interpreter, proxy);
   if (shutdownHook == null) {
     process.start(
         new Runnable() {
           @Override
           public void run() {
             proxy.shutdown();
           }
         });
   } else {
     process.start(shutdownHook);
   }
   return process;
 }