Example usage for org.apache.cordova CordovaResourceApi CordovaResourceApi

List of usage examples for org.apache.cordova CordovaResourceApi CordovaResourceApi

Introduction

In this page you can find the example usage for org.apache.cordova CordovaResourceApi CordovaResourceApi.

Prototype

public CordovaResourceApi(Context context, PluginManager pluginManager) 

Source Link

Usage

From source file:org.crosswalk.engine.XWalkCordovaWebView.java

License:Apache License

@Override
public void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, Whitelist internalWhitelist,
        Whitelist externalWhitelist, CordovaPreferences preferences) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }//from   ww  w  .j av a2  s .  c  o m
    this.cordova = cordova;
    this.internalWhitelist = internalWhitelist;
    this.externalWhitelist = externalWhitelist;
    this.preferences = preferences;

    pluginManager = new PluginManager(this, this.cordova, pluginEntries);
    resourceApi = new CordovaResourceApi(webview.getContext(), pluginManager);
    bridge = new CordovaBridge(pluginManager, new NativeToJsMessageQueue(this, cordova),
            this.cordova.getActivity().getPackageName());
    pluginManager.addService("CoreAndroid", "org.apache.cordova.CoreAndroid");
    initWebViewSettings();

    webview.init(this);
    exposeJsInterface();

    if (preferences.getBoolean("DisallowOverscroll", false)) {
        webview.setOverScrollMode(View.OVER_SCROLL_NEVER);
    }
}

From source file:org.crosswalk.engine.XWalkCordovaWebViewImpl.java

License:Apache License

@Override
public void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences) {
    if (this.cordova != null) {
        throw new IllegalStateException();
    }/*from w w  w .  j  ava 2  s.c  om*/
    this.cordova = cordova;
    this.preferences = preferences;
    pluginManager = new PluginManager(this, this.cordova, pluginEntries);
    resourceApi = new CordovaResourceApi(engine.getView().getContext(), pluginManager);
    nativeToJsMessageQueue = new NativeToJsMessageQueue();
    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
    nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(engine, cordova));

    if (preferences.getBoolean("DisallowOverscroll", false)) {
        engine.getView().setOverScrollMode(View.OVER_SCROLL_NEVER);
    }
    engine.init(this, cordova, engineClient, resourceApi, pluginManager, nativeToJsMessageQueue);
    // This isn't enforced by the compiler, so assert here.
    assert engine.getView() instanceof CordovaWebViewEngine.EngineView;

    pluginManager.addService(CoreAndroid.PLUGIN_NAME, "org.apache.cordova.CoreAndroid");
    pluginManager.init();

}