Example usage for org.apache.cordova CordovaChromeClient setWebView

List of usage examples for org.apache.cordova CordovaChromeClient setWebView

Introduction

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

Prototype

@Deprecated
    public void setWebView(CordovaWebView view) 

Source Link

Usage

From source file:com.AlcaldiaSucre.App.CordovaActivity.java

License:Apache License

/**
 * Initialize web container with web view objects.
 *
 * @param webView/* ww w . j  av  a  2  s.  c  o  m*/
 * @param webViewClient
 * @param webChromeClient
 */
@SuppressLint("NewApi")
public void init(CordovaWebView webView, CordovaWebViewClient webViewClient,
        CordovaChromeClient webChromeClient) {
    LOG.d(TAG, "CordovaActivity.init()");

    // Set up web container
    this.appView = webView;
    this.appView.setId(100);

    this.appView.setWebViewClient(webViewClient);
    this.appView.setWebChromeClient(webChromeClient);
    webViewClient.setWebView(this.appView);
    webChromeClient.setWebView(this.appView);

    this.appView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, 1.0F));

    if (this.getBooleanProperty("DisallowOverscroll", false)) {
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
            this.appView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER);
        }
    }

    // Add web view but make it invisible while loading URL
    this.appView.setVisibility(View.INVISIBLE);
    this.root.addView(this.appView);
    setContentView(this.root);

    // Clear cancel flag
    this.cancelLoadUrl = false;

}

From source file:com.djoin.parking.parking.java

License:Apache License

@SuppressLint("NewApi")
@Override/*  w w  w .j a  v a  2 s  .c om*/
public void init(CordovaWebView webView, CordovaWebViewClient webViewClient,
        CordovaChromeClient webChromeClient) {
    LOG.d(TAG, "CordovaActivity.init()");

    // Set up web container
    this.appView = webView;
    this.appView.setId(100);

    //js?
    this.appView.addJavascriptInterface(new JsInterface(), "jsinterface");

    this.appView.setWebViewClient(webViewClient);
    this.appView.setWebChromeClient(webChromeClient);
    webViewClient.setWebView(this.appView);
    webChromeClient.setWebView(this.appView);

    this.appView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, 1.0F));

    if (this.getBooleanProperty("disallowOverscroll", false)) {
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
            this.appView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER);
        }
    }

    // Add web view but make it invisible while loading URL
    this.appView.setVisibility(View.INVISIBLE);

    View v = getLayoutInflater().inflate(R.layout.main, null);

    mDrawerLayout = (DrawerLayout) v.findViewById(R.id.drawer_layout);
    myroot = (LinearLayout) v.findViewById(R.id.content_frame);
    mLeftNav = (ListView) v.findViewById(R.id.left_nav);

    mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

    myroot.setBackgroundColor(Color.BLACK);

    setTheme(R.style.gray);

    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    myroot.addView(this.appView);

    setContentView(mDrawerLayout);
    // Clear cancel flag
    this.cancelLoadUrl = false;

}

From source file:edu.pitt.gis.uniapp.UniApp.java

License:Apache License

/**
 * Initialize web container with web view objects.
 *
 * @param webView/*from  www . ja v  a2  s  .c  o m*/
 * @param webViewClient
 * @param webChromeClient
 */
public void init(CordovaWebView webView, CordovaWebViewClient webViewClient,
        CordovaChromeClient webChromeClient) {
    LOG.d(TAG, "UniApp.init()");

    // Set up web container
    this.appView = webView;
    this.appView.setId(100);

    this.appView.setWebViewClient(webViewClient);
    this.appView.setWebChromeClient(webChromeClient);

    this.webViewClient = webViewClient;
    this.webViewClient.setWebView(this.appView);
    webChromeClient.setWebView(this.appView);

    this.appView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, 1.0F));

    // Add web view but make it invisible while loading URL
    this.appView.setVisibility(View.INVISIBLE);
    this.root.addView(this.appView);

    // About dialog & Custom title for UniApp
    about = new AboutDialog(this);
    about.setCanceledOnTouchOutside(true);

    this.createCustomTitleBar();

    // Clear cancel flag
    this.cancelLoadUrl = false;
}

From source file:me.ncu.quickgap.QuickGap.java

License:Apache License

private void createCordovaWebview(String id, String url) {

    CordovaWebView webview = new CordovaWebView(this);

    CordovaWebViewClient webviewc = null;

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        webviewc = new CordovaWebViewClient(this, webview);
    } else {//from www.  j  av  a  2 s . com
        webviewc = new IceCreamCordovaWebViewClient(this, webview);
    }

    webview.setWebViewClient(webviewc);
    webviewc.setWebView(webview);

    CordovaChromeClient webviewcc = null;
    webviewcc = new CordovaChromeClient(this, webview);
    webview.setWebChromeClient(webviewcc);
    webviewcc.setWebView(webview);

    RelativeLayout.LayoutParams webviewLayout = new RelativeLayout.LayoutParams(display.getWidth(),
            display.getHeight());
    webviewLayout.alignWithParent = true;
    webview.setLayoutParams(webviewLayout);

    //this.root.addView(webview);
    webview.loadUrl(url);
    webview.addJavascriptInterface(new QGJavaScriptInterface(this), "quickgap");

    webviewPool.put(id, webview);

    final String viewId = id;

    Animation animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left);
    animation.setFillAfter(true);
    animation.setFillEnabled(true);
    animation.setDuration(animationDuration);
    animation.setAnimationListener(new AnimationListener() {

        public void onAnimationEnd(Animation animation) {

        }

        public void onAnimationRepeat(Animation animation) {

        }

        public void onAnimationStart(Animation animation) {

        }

    });

    webviewPool.get(viewId).startAnimation(animation);
}