java类org.apache.cordova.CordovaWebView的实例源码

CordovaCall.java 文件源码 项目:CordovaCall 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    cordovaInterface = cordova;
    super.initialize(cordova, webView);
    appName = getApplicationName(this.cordova.getActivity().getApplicationContext());
    handle = new PhoneAccountHandle(new ComponentName(this.cordova.getActivity().getApplicationContext(),MyConnectionService.class),appName);
    tm = (TelecomManager)this.cordova.getActivity().getApplicationContext().getSystemService(this.cordova.getActivity().getApplicationContext().TELECOM_SERVICE);
    phoneAccount = new PhoneAccount.Builder(handle, appName)
            .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
            .build();
    callbackContextMap.put("answer",new ArrayList<CallbackContext>());
    callbackContextMap.put("reject",new ArrayList<CallbackContext>());
    callbackContextMap.put("hangup",new ArrayList<CallbackContext>());
    callbackContextMap.put("sendCall",new ArrayList<CallbackContext>());
    callbackContextMap.put("receiveCall",new ArrayList<CallbackContext>());
}
BackgroundExt.java 文件源码 项目:localcloud_fe 阅读 36 收藏 0 点赞 0 评论 0
/**
 * Executes the request.
 *
 * @param action  The action to execute.
 * @param cordova The cordova interface.
 * @param webView The cordova web view.
 */
static void execute(String action, CordovaInterface cordova,
                    CordovaWebView webView) {

    BackgroundExt ext = new BackgroundExt(cordova, webView);

    if (action.equalsIgnoreCase("optimizations")) {
        ext.disableWebViewOptimizations();
    }

    if (action.equalsIgnoreCase("background")) {
        ext.moveToBackground();
    }

    if (action.equalsIgnoreCase("foreground")) {
        ext.moveToForeground();
    }

    if (action.equalsIgnoreCase("tasklist")) {
        ext.excludeFromTaskList();
    }
}
BackgroundExt.java 文件源码 项目:localcloud_fe 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Executes the request.
 *
 * @param action  The action to execute.
 * @param cordova The cordova interface.
 * @param webView The cordova web view.
 */
static void execute(String action, CordovaInterface cordova,
                    CordovaWebView webView) {

    BackgroundExt ext = new BackgroundExt(cordova, webView);

    if (action.equalsIgnoreCase("optimizations")) {
        ext.disableWebViewOptimizations();
    }

    if (action.equalsIgnoreCase("background")) {
        ext.moveToBackground();
    }

    if (action.equalsIgnoreCase("foreground")) {
        ext.moveToForeground();
    }

    if (action.equalsIgnoreCase("tasklist")) {
        ext.excludeFromTaskList();
    }
}
NetworkManager.java 文件源码 项目:siiMobilityAppKit 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 */
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    this.connectionCallbackContext = null;

    // We need to listen to connectivity events to update navigator.connection
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                // (The null check is for the ARM Emulator, please use Intel Emulator for better results)
                if(NetworkManager.this.webView != null)
                    updateConnectionInfo(sockMan.getActiveNetworkInfo());
            }
        };
        webView.getContext().registerReceiver(this.receiver, intentFilter);
    }

}
StatusBar.java 文件源码 项目:siiMobilityAppKit 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 */
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    LOG.v(TAG, "StatusBar: initialization");
    super.initialize(cordova, webView);

    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially
            // by the Cordova.
            Window window = cordova.getActivity().getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

            // Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
            setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000"));

            // Read 'StatusBarStyle' from config.xml, default is 'lightcontent'.
            setStatusBarStyle(preferences.getString("StatusBarStyle", "lightcontent"));
        }
    });
}
NetworkManager.java 文件源码 项目:localcloud_fe 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 */
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    this.connectionCallbackContext = null;

    // We need to listen to connectivity events to update navigator.connection
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                // (The null check is for the ARM Emulator, please use Intel Emulator for better results)
                if(NetworkManager.this.webView != null)
                    updateConnectionInfo(sockMan.getActiveNetworkInfo());
            }
        };
        webView.getContext().registerReceiver(this.receiver, intentFilter);
    }

}
HotCodePushPlugin.java 文件源码 项目:localcloud_fe 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView webView) {
    super.initialize(cordova, webView);

    parseCordovaConfigXml();
    loadPluginInternalPreferences();

    Log.d("CHCP", "Currently running release version " + pluginInternalPrefs.getCurrentReleaseVersionName());

    // clean up file system
    cleanupFileSystemFromOldReleases();

    handler = new Handler();
    fileStructure = new PluginFilesStructure(cordova.getActivity(), pluginInternalPrefs.getCurrentReleaseVersionName());
    appConfigStorage = new ApplicationConfigStorage();
    defaultCallbackStoredResults = new ArrayList<PluginResult>();
}
CordovaPlugin.java 文件源码 项目:localcloud_fe 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Call this after constructing to initialize the plugin.
 * Final because we want to be able to change args without breaking plugins.
 */
public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) {
    assert this.cordova == null;
    this.serviceName = serviceName;
    this.cordova = cordova;
    this.webView = webView;
    this.preferences = preferences;
    initialize(cordova, webView);
    pluginInitialize();
}
StatusBar.java 文件源码 项目:siiMobilityAppKit 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 */
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    LOG.v(TAG, "StatusBar: initialization");
    super.initialize(cordova, webView);

    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially
            // by the Cordova.
            Window window = cordova.getActivity().getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

            // Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
            setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000"));

            // Read 'StatusBarStyle' from config.xml, default is 'lightcontent'.
            setStatusBarStyle(preferences.getString("StatusBarStyle", "lightcontent"));
        }
    });
}
CordovaPlugin.java 文件源码 项目:COB 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Call this after constructing to initialize the plugin.
 * Final because we want to be able to change args without breaking plugins.
 */
public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) {
    assert this.cordova == null;
    this.serviceName = serviceName;
    this.cordova = cordova;
    this.webView = webView;
    this.preferences = preferences;
    initialize(cordova, webView);
    pluginInitialize();
}
SystemWebViewEngine.java 文件源码 项目:localcloud_fe 阅读 28 收藏 0 点赞 0 评论 0
@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);
   }
HotCodePushLocalDevPlugin.java 文件源码 项目:localcloud_fe 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView webView) {
    super.initialize(cordova, webView);

    // parse config only if main plugin is installed
    isChcpPluginInstalled = isHotCodePushPluginIsInstalled();
    if (isChcpPluginInstalled) {
        parseCordovaConfigXml();
    }
}
SystemWebViewEngine.java 文件源码 项目:COB 阅读 37 收藏 0 点赞 0 评论 0
@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);
   }
IronSourceAdsPlugin.java 文件源码 项目:cordova-plugin-ironsource-ads 阅读 22 收藏 0 点赞 0 评论 0
private void emitWindowEvent(final String event, final JSONObject data) {
    final CordovaWebView view = this.webView;
    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            view.loadUrl(String.format("javascript:cordova.fireWindowEvent('%s', %s);", event, data.toString()));
        }
    });
}
CordovaPlugin.java 文件源码 项目:cordova-vuetify 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Call this after constructing to initialize the plugin.
 * Final because we want to be able to change args without breaking plugins.
 */
public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) {
    assert this.cordova == null;
    this.serviceName = serviceName;
    this.cordova = cordova;
    this.webView = webView;
    this.preferences = preferences;
    initialize(cordova, webView);
    pluginInitialize();
}
SystemWebViewEngine.java 文件源码 项目:DinningShare 阅读 40 收藏 0 点赞 0 评论 0
@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);
   }
BackButtonMultipageTest.java 文件源码 项目:localcloud_fe 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void testViaLoadUrl() throws Throwable {
    final CordovaWebView webInterface = mActivity.getWebInterface();
    assertEquals(START_URL, mActivity.onPageFinishedUrl.take());

    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
        }
    });
    assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
        }
    });
    assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            assertTrue(webInterface.backHistory());
        }
    });
    assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            assertTrue(webInterface.backHistory());
        }
    });
    assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            assertFalse(webInterface.backHistory());
        }
    });
}
AdvancedGeolocation.java 文件源码 项目:localcloud_fe 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    _cordova = cordova;
    _cordovaActivity = cordova.getActivity();
    _sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_cordovaActivity);
    _permissionsController = new PermissionsController(_cordovaActivity, _cordova);
    _permissionsController.handleOnInitialize();
    removeActionPreferences();
    Log.d(TAG, "Initialized");
}
StandardActivityTest.java 文件源码 项目:localcloud_fe 阅读 51 收藏 0 点赞 0 评论 0
@Test
public void checkBackgroundIntentCheck() {
    StandardActivity activity = (StandardActivity) mActivityRule.getActivity();
    final SystemWebView webView = (SystemWebView) activity.getWindow().getCurrentFocus();
    CordovaWebView webInterface = webView.getCordovaWebView();
    CordovaPreferences prefs = webInterface.getPreferences();
    assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN);
}
SystemWebViewEngine.java 文件源码 项目:keemob 阅读 33 收藏 0 点赞 0 评论 0
@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);
   }
BackButtonMultipageTest.java 文件源码 项目:keemob 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void testViaLoadUrl() throws Throwable {
    final CordovaWebView webInterface = mActivity.getWebInterface();
    assertEquals(START_URL, mActivity.onPageFinishedUrl.take());

    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
        }
    });
    assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
        }
    });
    assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            assertTrue(webInterface.backHistory());
        }
    });
    assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            assertTrue(webInterface.backHistory());
        }
    });
    assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            assertFalse(webInterface.backHistory());
        }
    });
}
AdvancedGeolocation.java 文件源码 项目:localcloud_fe 阅读 33 收藏 0 点赞 0 评论 0
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    _cordova = cordova;
    _cordovaActivity = cordova.getActivity();
    _sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_cordovaActivity);
    _permissionsController = new PermissionsController(_cordovaActivity, _cordova);
    _permissionsController.handleOnInitialize();
    removeActionPreferences();
    Log.d(TAG, "Initialized");
}
CordovaPlugin.java 文件源码 项目:DinningShare 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Call this after constructing to initialize the plugin.
 * Final because we want to be able to change args without breaking plugins.
 */
public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) {
    assert this.cordova == null;
    this.serviceName = serviceName;
    this.cordova = cordova;
    this.webView = webView;
    this.preferences = preferences;
    initialize(cordova, webView);
    pluginInitialize();
}
CordovaHuaweiPush.java 文件源码 项目:cordova-huawei-push 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    activity = cordova.getActivity();
    //如果是首次启动,并且点击的通知消息,则处理消息
    if (openNotificationId != 0) {
        notificationOpened(openNotificationId, openNotificationExtras);
    }
}
X5WebViewEngine.java 文件源码 项目:cordova-plugin-x5-tbs 阅读 28 收藏 0 点赞 0 评论 0
@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);
}
SystemWebViewEngine.java 文件源码 项目:alerta-fraude 阅读 35 收藏 0 点赞 0 评论 0
@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);
   }
CordovaPlugin.java 文件源码 项目:localcloud_fe 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Call this after constructing to initialize the plugin.
 * Final because we want to be able to change args without breaking plugins.
 */
public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) {
    assert this.cordova == null;
    this.serviceName = serviceName;
    this.cordova = cordova;
    this.webView = webView;
    this.preferences = preferences;
    initialize(cordova, webView);
    pluginInitialize();
}
FyberPlugin.java 文件源码 项目:cordova-plugin-fyber 阅读 24 收藏 0 点赞 0 评论 0
private void fireEvent(final String event) {
    final CordovaWebView view = this.webView;
    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            view.loadUrl("javascript:cordova.fireDocumentEvent('" + event + "');");
        }
    });
}
FyberPlugin.java 文件源码 项目:cordova-plugin-fyber 阅读 27 收藏 0 点赞 0 评论 0
private void fireEvent(final String event, final JSONObject data) {
    final CordovaWebView view = this.webView;
    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            view.loadUrl(String.format("javascript:cordova.fireDocumentEvent('%s', %s);", event, data.toString()));
        }
    });
}
HotCodePushLocalDevPlugin.java 文件源码 项目:localcloud_fe 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView webView) {
    super.initialize(cordova, webView);

    // parse config only if main plugin is installed
    isChcpPluginInstalled = isHotCodePushPluginIsInstalled();
    if (isChcpPluginInstalled) {
        parseCordovaConfigXml();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号