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


Java CordovaWebViewImpl类代码示例

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


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

示例1: onCreate

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupSimplePreferencesScreen();

    Preference button = (Preference)findPreference("clearCache");
    button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            ConfigXmlParser parser = new ConfigXmlParser();
            parser.parse(SettingsActivity.this);
            CordovaPreferences preferences = parser.getPreferences();
            preferences.setPreferencesBundle(SettingsActivity.this.getIntent().getExtras());
            CordovaWebView webView = new CordovaWebViewImpl(CordovaWebViewImpl.createEngine(SettingsActivity.this, preferences));
            webView.clearCache();
            return true;
        }
    });
}
 
开发者ID:status-im,项目名称:syng-client,代码行数:21,代码来源:SettingsActivity.java

示例2: onCreate

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Set up the webview
    ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(this);

    SystemWebView webView = (SystemWebView) findViewById(R.id.cordovaWebView);
    webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView));
    webInterface.init(cordovaInterface, parser.getPluginEntries(), parser.getPreferences());

    webView.loadUrl(parser.getLaunchUrl());
}
 
开发者ID:alex-shpak,项目名称:keemob,代码行数:16,代码来源:EmbeddedWebViewActivity.java

示例3: testThatCachedCallbackIdIsValid

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
@Test
public void testThatCachedCallbackIdIsValid() throws Throwable {
    final CordovaWebView cordovaWebView = testActivity.getWebInterface();
    Class cordovaWebViewImpl = CordovaWebViewImpl.class;
    //send a test event - this initializes cordovaWebViewImpl.appPlugin (the cached instance of CoreAndroid)
    Method method = cordovaWebViewImpl.getDeclaredMethod("sendJavascriptEvent", String.class);
    method.setAccessible(true);
    method.invoke(cordovaWebView, "testEvent");
    sleep(1000);

    //load a page - this resets the plugin manager and nulls cordovaWebViewImpl.appPlugin
    //(previously this resets plugin manager but did not null cordovaWebViewImpl.appPlugin, leading to the issue)
    mActivityRule.runOnUiThread(new Runnable() {
        public void run() {
            cordovaWebView.loadUrl(START_URL);
        }
    });
    assertEquals(START_URL, testActivity.onPageFinishedUrl.take());

    //send a test event - this initializes cordovaWebViewImpl.appPlugin (the cached instance of CoreAndroid)
    method.invoke(cordovaWebView, "testEvent");
    sleep(1000);

    //get reference to package protected class CoreAndroid
    Class coreAndroid = Class.forName("org.apache.cordova.CoreAndroid");

    //get cached CoreAndroid
    Field appPluginField = cordovaWebViewImpl.getDeclaredField("appPlugin");
    appPluginField.setAccessible(true);
    Object cachedAppPlugin = appPluginField.get(cordovaWebView);
    //get cached CallbackContext
    Field messageChannelField = coreAndroid.getDeclaredField("messageChannel");
    messageChannelField.setAccessible(true);
    CallbackContext cachedCallbackContext = (CallbackContext) messageChannelField.get(cachedAppPlugin);

    //get live CoreAndroid
    PluginManager pluginManager = cordovaWebView.getPluginManager();
    Field coreAndroidPluginNameField = coreAndroid.getField("PLUGIN_NAME");
    String coreAndroidPluginName = (String) coreAndroidPluginNameField.get(null);
    Object liveAppPlugin = pluginManager.getPlugin(coreAndroidPluginName);
    //get live CallbackContext
    CallbackContext liveCallbackContext = (CallbackContext) messageChannelField.get(liveAppPlugin);

    //get callback id from live callbackcontext
    String liveCallbackId = (liveCallbackContext != null) ? liveCallbackContext.getCallbackId() : null;
    //get callback id from cached callbackcontext
    String cachedCallbackId = (cachedCallbackContext != null) ? cachedCallbackContext.getCallbackId() : null;

    //verify that the live message channel has been initialized
    assertNotNull(liveCallbackId);
    //verify that the cached message channel and the live message channel have the same id
    assertEquals(liveCallbackId, cachedCallbackId);
}
 
开发者ID:alex-shpak,项目名称:keemob,代码行数:54,代码来源:MessageChannelMultipageTest.java

示例4: makeWebViewEngine

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
protected CordovaWebViewEngine makeWebViewEngine() {
    return CordovaWebViewImpl.createEngine(dummyActivity, preferences);
}
 
开发者ID:cozy,项目名称:cordova-jsbackgroundservice,代码行数:4,代码来源:WebViewService.java

示例5: makeWebView

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
protected CordovaWebView makeWebView() {
    return new CordovaWebViewImpl(makeWebViewEngine());
}
 
开发者ID:status-im,项目名称:syng-client,代码行数:4,代码来源:WebViewFragment.java

示例6: makeWebViewEngine

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
protected CordovaWebViewEngine makeWebViewEngine() {
    return CordovaWebViewImpl.createEngine(getActivity(), preferences);
}
 
开发者ID:status-im,项目名称:syng-client,代码行数:4,代码来源:WebViewFragment.java

示例7: makeWebView

import org.apache.cordova.CordovaWebViewImpl; //导入依赖的package包/类
/**
 * Construct the default web view object.
 * <p/>
 * Override this to customize the webview that is used.
 */
protected CordovaWebView makeWebView() {
    return new CordovaWebViewImpl(makeWebViewEngine());
}
 
开发者ID:cozy,项目名称:cordova-jsbackgroundservice,代码行数:9,代码来源:WebViewService.java


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