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


Java NativeToJsMessageQueue.addBridgeMode方法代码示例

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


在下文中一共展示了NativeToJsMessageQueue.addBridgeMode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
   public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
             CordovaResourceApi resourceApi, PluginManager pluginManager,
             NativeToJsMessageQueue nativeToJsMessageQueue) {
       if (this.cordova != null) {
           throw new IllegalStateException();
       }
       // Needed when prefs are not passed by the constructor
       if (preferences == null) {
           preferences = parentWebView.getPreferences();
       }
       this.parentWebView = parentWebView;
       this.cordova = cordova;
       this.client = client;
       this.resourceApi = resourceApi;
       this.pluginManager = pluginManager;
       this.nativeToJsMessageQueue = nativeToJsMessageQueue;
       webView.init(this, cordova);

       initWebViewSettings();

       nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
           @Override
           public void setNetworkAvailable(boolean value) {
               webView.setNetworkAvailable(value);
           }
           @Override
           public void runOnUiThread(Runnable r) {
               SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
           }
       }));
       if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
           nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
       exposeJsInterface(webView, bridge);
   }
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:37,代码来源:SystemWebViewEngine.java

示例2: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client,
          CordovaResourceApi resourceApi, PluginManager pluginManager,
          NativeToJsMessageQueue nativeToJsMessageQueue) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }
    // Needed when prefs are not passed by the constructor
    if (preferences == null) {
        preferences = parentWebView.getPreferences();
    }
    this.parentWebView = parentWebView;
    this.cordova = cordova;
    this.client = client;
    this.resourceApi = resourceApi;
    this.pluginManager = pluginManager;
    this.nativeToJsMessageQueue = nativeToJsMessageQueue;
    webView.init(this, cordova);

    initWebViewSettings();

    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
        @Override
        public void setNetworkAvailable(boolean value) {
            webView.setNetworkAvailable(value);
        }
        @Override
        public void runOnUiThread(Runnable r) {
            X5WebViewEngine.this.cordova.getActivity().runOnUiThread(r);
        }
    }));
    bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
    exposeJsInterface(webView, bridge);
}
 
开发者ID:runner525,项目名称:x5webview-cordova-plugin,代码行数:35,代码来源:X5WebViewEngine.java

示例3: testMultipartPopAndEncodeAsJs

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Test
public void testMultipartPopAndEncodeAsJs()
{
    ArrayList<PluginResult> multiparts = new ArrayList<PluginResult>();
    for (int i=0; i<5; i++) {
        multiparts.add(new PluginResult(PluginResult.Status.OK, i));
    }
    PluginResult multipartresult = new PluginResult(PluginResult.Status.OK, multiparts);
    NativeToJsMessageQueue queue = new NativeToJsMessageQueue();
    queue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
    queue.setBridgeMode(0);
    queue.addPluginResult(multipartresult, "37");
    String result = queue.popAndEncodeAsJs();
    assertEquals(result, "cordova.callbackFromNative('37',true,1,[0,1,2,3,4],false);");
}
 
开发者ID:alex-shpak,项目名称:keemob,代码行数:16,代码来源:NativeToJsMessageQueueTest.java

示例4: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client,
                 CordovaResourceApi resourceApi, PluginManager pluginManager,
                 NativeToJsMessageQueue nativeToJsMessageQueue) {
  if (this.cordova != null) {
    throw new IllegalStateException();
  }
  // Needed when prefs are not passed by the constructor
  if (preferences == null) {
    preferences = parentWebView.getPreferences();
  }
  this.parentWebView = parentWebView;
  this.cordova = cordova;
  this.client = client;
  this.resourceApi = resourceApi;
  this.pluginManager = pluginManager;
  this.nativeToJsMessageQueue = nativeToJsMessageQueue;
  webView.init(this, cordova);

  initWebViewSettings();

  nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
    @Override
    public void setNetworkAvailable(boolean value) {
      webView.setNetworkAvailable(value);
    }

    @Override
    public void runOnUiThread(Runnable r) {
      X5WebViewEngine.this.cordova.getActivity().runOnUiThread(r);
    }
  }));
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
  bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
  exposeJsInterface(webView, bridge);
}
 
开发者ID:zsxsoft,项目名称:cordova-plugin-x5-tbs,代码行数:38,代码来源:X5WebViewEngine.java

示例5: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
   public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
             CordovaResourceApi resourceApi, PluginManager pluginManager,
             NativeToJsMessageQueue nativeToJsMessageQueue) {
       if (this.cordova != null) {
           throw new IllegalStateException();
       }
       // Needed when prefs are not passed by the constructor
       if (preferences == null) {
           preferences = parentWebView.getPreferences();
       }
       this.parentWebView = parentWebView;
       this.cordova = cordova;
       this.client = client;
       this.resourceApi = resourceApi;
       this.pluginManager = pluginManager;
       this.nativeToJsMessageQueue = nativeToJsMessageQueue;
       webView.init(this, cordova);

       initWebViewSettings();

       nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
           @Override
           public void setNetworkAvailable(boolean value) {
               //sometimes this can be called after calling webview.destroy() on destroy()
               //thus resulting in a NullPointerException
               if(webView!=null) {
                  webView.setNetworkAvailable(value); 
               }
           }
           @Override
           public void runOnUiThread(Runnable r) {
               SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
           }
       }));
       if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
           nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
       exposeJsInterface(webView, bridge);
   }
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:41,代码来源:SystemWebViewEngine.java

示例6: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
   public void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client,
             CordovaResourceApi resourceApi, PluginManager pluginManager,
             NativeToJsMessageQueue nativeToJsMessageQueue) {
       if (this.cordova != null) {
           throw new IllegalStateException();
       }
       // Needed when prefs are not passed by the constructor
       if (preferences == null) {
           preferences = parentWebView.getPreferences();
       }
       this.parentWebView = parentWebView;
       this.cordova = cordova;
       this.client = client;
       this.resourceApi = resourceApi;
       this.pluginManager = pluginManager;
       this.nativeToJsMessageQueue = nativeToJsMessageQueue;
       webView.init(this, cordova);

       initWebViewSettings();

       nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
           @Override
           public void setNetworkAvailable(boolean value) {
               webView.setNetworkAvailable(value);
           }
           @Override
           public void runOnUiThread(Runnable r) {
             X5WebViewEngine.this.cordova.getActivity().runOnUiThread(r);
           }
       }));
       if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
           nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
       exposeJsInterface(webView, bridge);
   }
 
开发者ID:Im-Kevin,项目名称:cordova.plugins.X5WebView,代码行数:37,代码来源:X5WebViewEngine.java

示例7: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
          CordovaResourceApi resourceApi, PluginManager pluginManager,
          NativeToJsMessageQueue nativeToJsMessageQueue) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }
    // Needed when prefs are not passed by the constructor
    if (preferences == null) {
        preferences = parentWebView.getPreferences();
    }
    this.parentWebView = parentWebView;
    this.cordova = cordova;
    this.client = client;
    this.resourceApi = resourceApi;
    this.pluginManager = pluginManager;
    this.nativeToJsMessageQueue = nativeToJsMessageQueue;
    webView.init(this, cordova);

    initWebViewSettings();

    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
        @Override
        public void setNetworkAvailable(boolean value) {
            webView.setNetworkAvailable(value);
        }
        @Override
        public void runOnUiThread(Runnable r) {
            SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
        }
    }));
    bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
    exposeJsInterface(webView, bridge);
}
 
开发者ID:resin-io-playground,项目名称:resin-configurator-client,代码行数:35,代码来源:SystemWebViewEngine.java

示例8: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
                 CordovaResourceApi resourceApi, PluginManager pluginManager,
                 NativeToJsMessageQueue nativeToJsMessageQueue) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }
    this.parentWebView = parentWebView;
    this.cordova = cordova;
    this.client = client;
    this.resourceApi = resourceApi;
    this.pluginManager = pluginManager;
    this.nativeToJsMessageQueue = nativeToJsMessageQueue;

    CordovaPlugin activityDelegatePlugin = new CordovaPlugin() {
        @Override
        public void onResume(boolean multitasking) {
            activityDelegate.onResume();
        }
    };
    pluginManager.addService(new PluginEntry("XWalkActivityDelegate", activityDelegatePlugin));

    webView.init(this);

    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(
            new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
        @Override
        public void setNetworkAvailable(boolean value) {
            webView.setNetworkAvailable(value);
        }
        @Override
        public void runOnUiThread(Runnable r) {
            XWalkWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
        }
    }));
    bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
}
 
开发者ID:infil00p,项目名称:cordova-plugin-crosswalk-webview,代码行数:38,代码来源:XWalkWebViewEngine.java

示例9: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
                 CordovaResourceApi resourceApi, PluginManager pluginManager,
                 NativeToJsMessageQueue nativeToJsMessageQueue) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }
    this.parentWebView = parentWebView;
    this.cordova = cordova;
    this.client = client;
    this.resourceApi = resourceApi;
    this.pluginManager = pluginManager;
    this.nativeToJsMessageQueue = nativeToJsMessageQueue;

    webView.init(this);

    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(
            new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
        @Override
        public void setNetworkAvailable(boolean value) {
            webView.setNetworkAvailable(value);
        }
        @Override
        public void runOnUiThread(Runnable r) {
            XWalkWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
        }
    }));
    bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
}
 
开发者ID:infil00p,项目名称:cordova-photosphere-example,代码行数:30,代码来源:XWalkWebViewEngine.java

示例10: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
          CordovaResourceApi resourceApi, PluginManager pluginManager,
          NativeToJsMessageQueue nativeToJsMessageQueue) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }
    this.parentWebView = parentWebView;
    this.cordova = cordova;
    this.client = client;
    this.resourceApi = resourceApi;
    this.pluginManager = pluginManager;
    this.nativeToJsMessageQueue = nativeToJsMessageQueue;
    webView.init(this, cordova);

    initWebViewSettings();

    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
        @Override
        public void setNetworkAvailable(boolean value) {
            webView.setNetworkAvailable(value);
        }
        @Override
        public void runOnUiThread(Runnable r) {
            SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
        }
    }));
    bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
    exposeJsInterface(webView, bridge);
}
 
开发者ID:son-link,项目名称:killallradioapp,代码行数:31,代码来源:SystemWebViewEngine.java

示例11: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
                 CordovaResourceApi resourceApi, PluginManager pluginManager,
                 NativeToJsMessageQueue nativeToJsMessageQueue) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }
    this.parentWebView = parentWebView;
    this.cordova = cordova;
    this.client = client;
    this.resourceApi = resourceApi;
    this.pluginManager = pluginManager;
    this.nativeToJsMessageQueue = nativeToJsMessageQueue;

    CordovaPlugin activityDelegatePlugin = new CordovaPlugin() {
        @Override
        public void onResume(boolean multitasking) {
            activityDelegate.onResume();
        }
    };
    pluginManager.addService(new PluginEntry("XWalkActivityDelegate", activityDelegatePlugin));

    webView.init(this);

    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(
            new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
        @Override
        public void setNetworkAvailable(boolean value) {
            webView.setNetworkAvailable(value);
        }
        @Override
        public void runOnUiThread(Runnable r) {
            XWalkWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
        }
    }));
    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
    bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
}
 
开发者ID:infil00p,项目名称:cordova-crosswalk-engine,代码行数:39,代码来源:XWalkWebViewEngine.java

示例12: init

import org.apache.cordova.NativeToJsMessageQueue; //导入方法依赖的package包/类
@Override
   public void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client,
             CordovaResourceApi resourceApi, PluginManager pluginManager,
             NativeToJsMessageQueue nativeToJsMessageQueue) {
       if (this.cordova != null) {
           throw new IllegalStateException();
       }
       // Needed when prefs are not passed by the constructor
       if (preferences == null) {
           preferences = parentWebView.getPreferences();
       }
       this.parentWebView = parentWebView;
       this.cordova = cordova;
       this.client = client;
       this.resourceApi = resourceApi;
       this.pluginManager = pluginManager;
       this.nativeToJsMessageQueue = nativeToJsMessageQueue;
       webView.init(this, cordova);

       initWebViewSettings();

       nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
           @Override
           public void setNetworkAvailable(boolean value) {
               webView.setNetworkAvailable(value);
           }
           @Override
           public void runOnUiThread(Runnable r) {
               X5WebViewEngine.this.cordova.getActivity().runOnUiThread(r);
           }
       }));
       /* Pay attention:
        * Error maybe occur here!!!
        * If your cordova-android version below 6+,this method about EvalBridgeMode() may be not existed.
        * Please comment out below the lines 126-127.
       */
       if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
           nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
       exposeJsInterface(webView, bridge);
   }
 
开发者ID:jeremyup,项目名称:cordova-plugin-x5-webview,代码行数:42,代码来源:X5WebViewEngine.java


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