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


Java Config类代码示例

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


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

示例1: onCreateView

import org.apache.cordova.Config; //导入依赖的package包/类
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

      LayoutInflater localInflater = inflater.cloneInContext(new CordovaContext(getActivity(), this));
      View rootView = localInflater.inflate(R.layout.fragment_cordova, container, false);        
      myWebView = (CordovaWebView) rootView.findViewById(R.id.myWebView);
      myWebView.setBackgroundColor(Color.argb(1, 0, 0, 0));
      
// fixes a bug in android 3.0 - 4.0.3 that causes an issue with transparent webviews.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB
		&& android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
	myWebView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
}
      
      
      Config.init(getActivity());
      myWebView.loadUrl(Config.getStartUrl());
      return rootView;
  }
 
开发者ID:thomasforth,项目名称:MS4Plugin,代码行数:20,代码来源:CordovaFragment.java

示例2: onReady

import org.apache.cordova.Config; //导入依赖的package包/类
public void onReady(GeckoView view) {
    Log.i(LOGTAG, "Gecko is ready");

    PrefsHelper.setPref("devtools.debugger.remote-enabled", true);

    /* Load URL does nothing, we have to wait unitl things are ready before loading */
    view.addBrowser(Config.getStartUrl());
    //Make sure this is visible regardless of what Cordova does.
    view.setVisibility(View.VISIBLE);
}
 
开发者ID:infil00p,项目名称:cordova-mozillaview-engine,代码行数:11,代码来源:CordovaGeckoViewChrome.java

示例3: onCreate

import org.apache.cordova.Config; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    //CB-7238: This has to be added now, because it got removed from somewhere else
    Config.init(this);
    
    cordovaWebView = (CordovaWebView) findViewById(R.id.cordovaWebView);
    cordovaWebView.init(this, new CordovaWebViewClient(this, cordovaWebView), new CordovaChromeClient(this, cordovaWebView),
            Config.getPluginEntries(), Config.getWhitelist(), Config.getExternalWhitelist(), Config.getPreferences());

    cordovaWebView.loadUrl("file:///android_asset/www/index.html");

}
 
开发者ID:crosswalk-project,项目名称:crosswalk-cordova-android,代码行数:18,代码来源:CordovaWebViewTestActivity.java

示例4: shouldInterceptLoadRequest

import org.apache.cordova.Config; //导入依赖的package包/类
@Override
public WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url) {
    try {
        // Check the against the white-list.
        if ((url.startsWith("http:") || url.startsWith("https:")) && !Config.isUrlWhiteListed(url)) {
            LOG.w(TAG, "URL blocked by whitelist: " + url);
            // Results in a 404.
            return new WebResourceResponse("text/plain", "UTF-8", null);
        }

        CordovaResourceApi resourceApi = appView.getResourceApi();
        Uri origUri = Uri.parse(url);
        // Allow plugins to intercept WebView requests.
        Uri remappedUri = resourceApi.remapUri(origUri);

        if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) {
            OpenForReadResult result = resourceApi.openForRead(remappedUri, true);
            return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream);
        }
        // If we don't need to special-case the request, let the browser load it.
        return null;
    } catch (IOException e) {
        if (!(e instanceof FileNotFoundException)) {
            LOG.e("IceCreamCordovaWebViewClient", "Error occurred while loading a file (returning a 404).", e);
        }
        // Results in a 404.
        return new WebResourceResponse("text/plain", "UTF-8", null);
    }
}
 
开发者ID:ZachMoreno,项目名称:krakn,代码行数:30,代码来源:XWalkCordovaWebViewClient.java

示例5: loadUrlNow

import org.apache.cordova.Config; //导入依赖的package包/类
/**
 * Load URL in webview.
 *
 * @param url
 */
void loadUrlNow(String url) {
    if (LOG.isLoggable(LOG.DEBUG) && !url.startsWith("javascript:")) {
        LOG.d(TAG, ">>> loadUrlNow()");
    }
    if (url.startsWith("file://") || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) {
        super.loadUrl(url);
    }
}
 
开发者ID:ZachMoreno,项目名称:krakn,代码行数:14,代码来源:CordovaWebView.java

示例6: showWebPage

import org.apache.cordova.Config; //导入依赖的package包/类
/**
 * Load the specified URL in the Cordova webview or a new browser instance.
 *
 * NOTE: If openExternal is false, only URLs listed in whitelist can be loaded.
 *
 * @param url           The url to load.
 * @param openExternal  Load url in browser instead of Cordova webview.
 * @param clearHistory  Clear the history stack, so new page becomes top of history
 * @param params        Parameters for new app
 */
public void showWebPage(String url, boolean openExternal, boolean clearHistory, HashMap<String, Object> params) {
    LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap", url, openExternal, clearHistory);

    // If clearing history
    if (clearHistory) {
        this.clearHistory();
    }

    // If loading into our webview
    if (!openExternal) {

        // Make sure url is in whitelist
        if (url.startsWith("file://") || Config.isUrlWhiteListed(url)) {
            // TODO: What about params?
            // Load new URL
            this.loadUrl(url);
            return;
        }
        // Load in default viewer if not
        LOG.w(TAG, "showWebPage: Cannot load URL into webview since it is not in white list.  Loading into browser instead. (URL=" + url + ")");
    }
    try {
        // Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".
        // Adding the MIME type to http: URLs causes them to not be handled by the downloader.
        Intent intent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.parse(url);
        if ("file".equals(uri.getScheme())) {
            intent.setDataAndType(uri, resourceApi.getMimeType(uri));
        } else {
            intent.setData(uri);
        }
        cordova.getActivity().startActivity(intent);
    } catch (android.content.ActivityNotFoundException e) {
        LOG.e(TAG, "Error loading url " + url, e);
    }
}
 
开发者ID:ZachMoreno,项目名称:krakn,代码行数:47,代码来源:CordovaWebView.java

示例7: loadUrl

import org.apache.cordova.Config; //导入依赖的package包/类
/**
 * Load the url into the webview after waiting for period of time.
 * This is used to display the splashscreen for certain amount of time.
 *
 * @param url
 * @param time              The number of ms to wait before loading webview
 */
@Deprecated
public void loadUrl(final String url, int time) {
    if(url == null)
    {
        this.loadUrlIntoView(Config.getStartUrl());
    }
    else
    {
        this.loadUrlIntoView(url);
    }
}
 
开发者ID:trujunzhang,项目名称:CrossWalkAndroidStudio,代码行数:19,代码来源:CordovaWebView.java

示例8: loadConfig

import org.apache.cordova.Config; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void loadConfig() {
    ConfigXmlParser parser = new ConfigXmlParser();
    parser.parse(getActivity());
    preferences = parser.getPreferences();
    preferences.setPreferencesBundle(getActivity().getIntent().getExtras());
    //preferences.set("webview", "io.syng.cordova.plugin.WebViewEngine");
    pluginEntries = parser.getPluginEntries();
    Config.init(getActivity());
}
 
开发者ID:status-im,项目名称:syng-client,代码行数:11,代码来源:WebViewFragment.java


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