Example usage for org.apache.cordova CordovaChromeClient CordovaChromeClient

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

Introduction

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

Prototype

public CordovaChromeClient(CordovaInterface ctx, CordovaWebView app) 

Source Link

Usage

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

License:Apache License

/**
 * Create and initialize web container with default web view objects.
 *//*  w  w  w.  j ava 2 s .c o m*/
public void init() {
    CordovaWebView webView = new CordovaWebView(CordovaActivity.this);
    CordovaWebViewClient webViewClient;
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        webViewClient = new CordovaWebViewClient(this, webView);
    } else {
        webViewClient = new IceCreamCordovaWebViewClient(this, webView);
    }
    this.init(webView, webViewClient, new CordovaChromeClient(this, webView));
}

From source file:com.catchoom.craftar.CraftARActivityAR.java

License:Apache License

@Override
public void onPostCreate() {

    // Initialize the UI      
    FakeR fakeR = new FakeR(this);

    int layoutId = fakeR.getId("layout", "craftar_camera");
    View layout = (View) getLayoutInflater().inflate(layoutId, null);

    int previewId = fakeR.getId("id", "craftar_preview");
    CraftARCameraView cameraView = (CraftARCameraView) layout.findViewById(previewId);
    super.setCameraView(cameraView);

    if (!TextUtils.isEmpty(hint)) {
        int hintId = fakeR.getId("id", "craftar_hint");
        TextView hintView = (TextView) layout.findViewById(hintId);
        hintView.setText(hint);/* ww w .  java2s  .  c  om*/
        hintView.setVisibility(View.VISIBLE);
    }

    int cwvId = fakeR.getId("id", "OverlayView");
    cwv = new CordovaWebView(this);

    CordovaWebViewClient cwvc;

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        cwvc = new CordovaWebViewClient(this, cwv);
    } else {
        cwvc = new IceCreamCordovaWebViewClient(this, cwv);
    }

    cwv.setWebViewClient(cwvc);
    cwv.setWebChromeClient(new CordovaChromeClient(this, cwv));

    FrameLayout wvLayout = (FrameLayout) layout.findViewById(cwvId);
    wvLayout.addView(cwv);
    Config.init(this);

    cwv.loadUrl("file:///android_asset/www/ar_overlay.html");
    cwv.setBackgroundColor(Color.TRANSPARENT);

    setContentView(layout);

    // Initialize the Cloud Image Recognition service
    cloudRecognition = CraftARSDK.getCloudRecognition();
    cloudRecognition.setResponseHandler(this);
    cloudRecognition.setCollectionToken(token);

    if (!TextUtils.isEmpty(connectUrl)) {
        cloudRecognition.setConnectUrl(connectUrl);
    }

    if (!TextUtils.isEmpty(searchUrl)) {
        cloudRecognition.setSearchUrl(searchUrl);
    }

    // Obtain camera
    mcamera = CraftARSDK.getCamera();
    mcamera.setImageHandler(this);

    // Obtain the Tracking module
    tracking = CraftARSDK.getTracking();

    // Start finder mode
    cloudRecognition.startFinding();

}

From source file:com.moodstocks.phonegap.demo.Demo.java

License:Open Source License

@Override
public void init() {
    MoodstocksWebView webView = new MoodstocksWebView(Demo.this);
    CordovaWebViewClient webViewClient;/*  w  w w  . j a va  2 s. co m*/

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        webViewClient = new CordovaWebViewClient(this, webView);
    } else {
        webViewClient = new IceCreamCordovaWebViewClient(this, webView);
    }

    this.init(webView, webViewClient, new CordovaChromeClient(this, webView));
}

From source file:com.virtualama.application.Virtualama.java

License:Apache License

@Override
public void init() {
    MoodstocksWebView webView = new MoodstocksWebView(this);
    webView.setBackgroundColor(0x00000000);
    CordovaWebViewClient webViewClient;//  w ww.j  a  va2s .com

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        webViewClient = new CordovaWebViewClient(this, webView);
    } else {
        webViewClient = new IceCreamCordovaWebViewClient(this, webView);
    }

    super.init(webView, webViewClient, new CordovaChromeClient(this, webView));
}

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

License:Apache License

/**
 * Create and initialize web container with default web view objects.
 *///from   w ww .j  av  a 2 s  .c  o  m
public void init() {
    CordovaWebView webView = new CordovaWebView(UniApp.this);
    CordovaWebViewClient webViewClient;
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
        webViewClient = new CordovaWebViewClient(this, webView);
    } else {
        webViewClient = new IceCreamCordovaWebViewClient(this, webView);
    }
    this.init(webView, webViewClient, new CordovaChromeClient(this, webView));
}

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   ww  w . j ava2s . co m*/
        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);
}