Пример #1
0
 private Method getMethod(JSBridgeBase classIntance, String type, String name, JSONObject data) {
   Method thisMethod = null;
   try {
     String methodName = type + name.split("\\.")[1];
     if (type == JS_API_PREFIX_FOR_EVENT) {
       thisMethod =
           classIntance
               .getClass()
               .getMethod(methodName, JSONObject.class, JSBridgeCallback.class);
     } else if (type == JS_API_PREFIX_FOR_API) {
       if (data != null) {
         thisMethod = classIntance.getClass().getMethod(methodName, JSONObject.class);
       } else {
         thisMethod = classIntance.getClass().getMethod(methodName);
       }
     }
   } catch (NoSuchMethodException e) {
   }
   return thisMethod;
 }
Пример #2
0
 public void registerJavaScriptAPI(JSBridgeBase instance) {
   if (webView != null) {
     webView.addJavascriptInterface(instance, instance.getClass().getSimpleName());
   }
 }