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


Java AmazonWebView类代码示例

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


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

示例1: putLayoutDirectionIntoMap

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
private static void putLayoutDirectionIntoMap(AmazonWebView webView, Map<String, String> substitutionMap) {
    ViewCompat.setLayoutDirection(webView, View.LAYOUT_DIRECTION_LOCALE);
    final int layoutDirection = ViewCompat.getLayoutDirection(webView);

    final String direction;

    if (layoutDirection == View.LAYOUT_DIRECTION_LTR) {
        direction = "ltr";
    } else if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
        direction = "rtl";
    } else {
        direction = "auto";
    }

    substitutionMap.put("%dir%", direction);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:17,代码来源:LocalizedContent.java

示例2: onLoadResource

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
@Override
    public void onLoadResource(AmazonWebView view, String url) {
        // We can't access the webview during shouldInterceptRequest(), however onLoadResource()
        // is called on the UI thread so we're allowed to do this now:
//        evaluateJavascript(view,
//                "(function() {" +
//
//                "function cleanupVisited() {" +
//                CLEAR_VISITED_CSS +
//                "}" +
//
//                // Add an onLoad() listener so that we run the cleanup script every time
//                // a <link>'d css stylesheet is loaded:
//                "var links = document.getElementsByTagName('link');" +
//                "for (i = 0; i < links.length; i++) {" +
//                "  link = links[i];" +
//                "  if (link.rel == 'stylesheet') {" +
//                "    link.addEventListener('load', cleanupVisited, false);" +
//                "  }" +
//                "}" +
//
//                "})();");

        super.onLoadResource(view, url);
    }
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:26,代码来源:FocusWebViewClient.java

示例3: onPageStarted

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
@Override
public void onPageStarted(AmazonWebView view, String url, Bitmap favicon) {
    if (errorReceived) {
        // When dealing with error pages, WebView sometimes sends onPageStarted()
        // without a matching onPageFinished(). We hack around that by using
        // a flag to ignore the first onPageStarted() after onReceivedError() has
        // been called. (The usual chain is: onPageStarted(url), onReceivedError(url),
        // onPageFinished(url), onPageStarted(url), finally and only sometimes: onPageFinished().
        // Since the final onPageFinished isn't guaranteed (and we know we're showing an error
        // page already), we don't need to send the onPageStarted() callback a second time anyway.
        errorReceived = false;
    } else if (callback != null) {
        callback.onPageStarted(url);
    }

    super.onPageStarted(view, url, favicon);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:18,代码来源:FocusWebViewClient.java

示例4: onReceivedSslError

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
@Override
public void onReceivedSslError(AmazonWebView view, AmazonSslErrorHandler handler, SslError error) {
    handler.cancel();

    // WebView can try to load the favicon for a bad page when you set a new URL. If we then
    // loadErrorPage() again, WebView tries to load the favicon again. We end up in onReceivedSSlError()
    // again, and we get an infinite loop of reloads (we also erroneously show the favicon URL
    // in the toolbar, but that's less noticeable). Hence we check whether this error is from
    // the desired page, or a page resource:
    if (error.getUrl().equals(currentPageURL)) {
        TelemetryWrapper.sslErrorEvent(true, error);
        ErrorPage.loadErrorPage(view, error.getUrl(), WebViewClient.ERROR_FAILED_SSL_HANDSHAKE);
    } else {
        TelemetryWrapper.sslErrorEvent(false, error);
    }
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:17,代码来源:FocusWebViewClient.java

示例5: onPageStarted

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
/**
 * Notify the host application that a page has started loading.
 * This method is called once for each main frame load so a page with iframes or framesets will call onPageStarted
 * one time for the main frame. This also means that onPageStarted will not be called when the contents of an
 * embedded frame changes, i.e. clicking a link whose target is an iframe.
 *
 * @param view          The webview initiating the callback.
 * @param url           The url of the page.
 */
@Override
public void onPageStarted(AmazonWebView view, String url, Bitmap favicon) {
    super.onPageStarted(view, url, favicon);
    isCurrentlyLoading = true;
    LOG.d(TAG, "onPageStarted(" + url + ")");
    // Flush stale messages.
    this.appView.bridge.reset(url);

    // Broadcast message that page has loaded
    this.appView.postMessage("onPageStarted", url);

    // Notify all plugins of the navigation, so they can clean up if necessary.
    if (this.appView.pluginManager != null) {
        this.appView.pluginManager.onReset();
    }
}
 
开发者ID:chrisuehlinger,项目名称:smart-mirror-app,代码行数:26,代码来源:CordovaWebViewClient.java

示例6: onReceivedSslError

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The AmazonWebView that is initiating the callback.
 * @param handler       An AmazonSslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(AmazonWebView view, AmazonSslErrorHandler handler, SslError error) {

    final String packageName = this.cordova.getActivity().getPackageName();
    final PackageManager pm = this.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
 
开发者ID:chrisuehlinger,项目名称:smart-mirror-app,代码行数:34,代码来源:CordovaWebViewClient.java

示例7: onReceivedError

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
public void onReceivedError(AmazonWebView view, int errorCode, String description, String failingUrl) {
    super.onReceivedError(view, errorCode, description, failingUrl);
    
    try {
        JSONObject obj = new JSONObject();
        obj.put("type", LOAD_ERROR_EVENT);
        obj.put("url", failingUrl);
        obj.put("code", errorCode);
        obj.put("message", description);
    
        sendUpdate(obj, true, PluginResult.Status.ERROR);
    } catch (JSONException ex) {
        Log.d(LOG_TAG, "Should never happen");
    }
	
}
 
开发者ID:ZachMoreno,项目名称:krakn,代码行数:17,代码来源:InAppBrowser.java

示例8: checkRenderView

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
public boolean checkRenderView(AmazonWebView view)
{
    if(state == null)
    {
        setBitmap(view);
        return false;
    }
    else
    {
        Picture p = view.capturePicture();
        Bitmap newState = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
        boolean result = newState.equals(state);
        newState.recycle();
        return result;
    }
}
 
开发者ID:apache,项目名称:cordova-amazon-fireos,代码行数:17,代码来源:Purity.java

示例9: closeDialog

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
/**
 * Closes the dialog
 */
public void closeDialog() {
    final AmazonWebView childView = this.inAppWebView;
    // The JS protects against multiple calls, so this should happen only when
    // closeDialog() is called by other native code.
    if (childView == null) {
        return;
    }
    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            childView.setWebViewClient(new AmazonWebViewClient() {
                // NB: wait for about:blank before dismissing
                public void onPageFinished(AmazonWebView view, String url) {
                    if (dialog != null) {
                        dialog.dismiss();
                    }
                }
            });
            // NB: From SDK 19: "If you call methods on WebView from any thread
            // other than your app's UI thread, it can cause unexpected results."
            // http://developer.android.com/guide/webapps/migrating.html#Threads
            childView.loadUrl("about:blank");
        }
    });
    
    try {
        JSONObject obj = new JSONObject();
        obj.put("type", EXIT_EVENT);
        sendUpdate(obj, false);
    } catch (JSONException ex) {
        Log.d(LOG_TAG, "Should never happen");
    }
}
 
开发者ID:dpa99c,项目名称:cordova-plugin-inappbrowser-wkwebview,代码行数:37,代码来源:InAppBrowser.java

示例10: onPageFinished

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
public void onPageFinished(AmazonWebView view, String url) {
    super.onPageFinished(view, url);
    
    try {
        JSONObject obj = new JSONObject();
        obj.put("type", LOAD_STOP_EVENT);
        obj.put("url", url);
    
        sendUpdate(obj, true);
    } catch (JSONException ex) {
        Log.d(LOG_TAG, "Should never happen");
    }
}
 
开发者ID:dpa99c,项目名称:cordova-plugin-inappbrowser-wkwebview,代码行数:14,代码来源:InAppBrowser.java

示例11: onReceivedError

import com.amazon.android.webkit.AmazonWebView; //导入依赖的package包/类
public void onReceivedError(AmazonWebView view, int errorCode, String description, String failingUrl) {
    super.onReceivedError(view, errorCode, description, failingUrl);
    
    try {
        JSONObject obj = new JSONObject();
        obj.put("type", LOAD_ERROR_EVENT);
        obj.put("url", failingUrl);
        obj.put("code", errorCode);
        obj.put("message", description);
    
        sendUpdate(obj, true, PluginResult.Status.ERROR);
    } catch (JSONException ex) {
        Log.d(LOG_TAG, "Should never happen");
    }
}
 
开发者ID:dpa99c,项目名称:cordova-plugin-inappbrowser-wkwebview,代码行数:16,代码来源:InAppBrowser.java


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