类android.webkit.WebChromeClient源码实例Demo

下面列出了怎么用android.webkit.WebChromeClient的API类实例代码及写法,或者点击链接到github查看源代码。

private void initListener() {
    mWebView.setWebChromeClient(new WebChromeClient() {

        //For Android5.0+
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
            if (mFilePathCallback != null) {
                mFilePathCallback.onReceiveValue(null);
            }
            mFilePathCallback = filePathCallback;

            showChooserDialog();
            return true;
        }
    });

}
 
源代码2 项目: L.TileLayer.Cordova   文件: CordovaWebView.java
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
源代码3 项目: android-post-webview   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAddressView = (EditText) findViewById(R.id.addressView);
    mWebView = (WebView) findViewById(R.id.webView);

    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);

    mWebView.setWebViewClient(new InterceptingWebViewClient(this, mWebView));
    mWebView.setWebChromeClient(new WebChromeClient());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }

    loadOnEnter();
}
 
源代码4 项目: JsBridge   文件: CustomWebViewActivity.java
public CustomWebView(Context context) {
    super(context);
    this.webView = new WebView(context);
    this.webView.getSettings().setJavaScriptEnabled(true);
    addView(this.webView);
    this.webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public boolean onJsPrompt(WebView view, String url,
                                  String message, String defaultValue, JsPromptResult result) {
            if (callback != null) {
                callback.onResult(message, new PromptResultImpl(result));
            }
            return true;
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            Log.d(JsBridge.TAG, consoleMessage.message());
            return true;
        }
    });
}
 
源代码5 项目: reader   文件: CordovaWebView.java
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
源代码6 项目: Mobike   文件: MessageDetailActivity.java
private void initWebView() {
        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        /*使webview能够加载图片*/
        webSettings.setBlockNetworkImage(false);
        webSettings.setAppCacheEnabled(true);
        mDialog=new SpotsDialog(this);
        mDialog.show();
        mWebView.loadUrl(mMessage.getClickUrl());
//        mWebAppInterface = new WebAppInterface(this);
//        mWebView.addJavascriptInterface(mWebAppInterface, "appInterface");
        mWebView.setWebViewClient(new MyWebChromeC());
        mWebView.setWebChromeClient(new WebChromeClient(){

        });

    }
 
源代码7 项目: timecat   文件: PreviewFragment.java
public void configWebView() {
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDomStorageEnabled(true);

    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            if (newProgress == 100) {
                pageFinish = true;
            }
        }
    });
    webView.loadUrl("file:///android_asset/markdown.html");
}
 
public void onActivityResult(int requestCode, int resultCode, Intent intent)
{
    if (requestCode >= SignTransactionDialog.REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS && requestCode <= SignTransactionDialog.REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS + 10)
    {
        GotAuthorisation(resultCode == RESULT_OK);
    }
    else if (requestCode == UPLOAD_FILE && uploadMessage != null)
    {
        if (resultCode == RESULT_OK)
        {
            uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
        }
        uploadMessage = null;
    }
    else if (requestCode == REQUEST_FILE_ACCESS)
    {
        if (resultCode == RESULT_OK)
        {
            requestUpload();
        }
    }
}
 
源代码9 项目: bluemix-parking-meter   文件: CordovaWebView.java
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
源代码10 项目: mua   文件: PreviewFragment.java
public void configWebView() {
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDomStorageEnabled(true);

    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            if (newProgress == 100) {
                pageFinish = true;
            }
        }
    });
    webView.loadUrl("file:///android_asset/markdown.html");
}
 
private Uri[] getSelectedFiles(Intent data, int resultCode) {
    if (data == null) {
        return null;
    }

    // we have one file selected
    if (data.getData() != null) {
        if (resultCode == RESULT_OK && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return WebChromeClient.FileChooserParams.parseResult(resultCode, data);
        } else {
            return null;
        }
    }

    // we have multiple files selected
    if (data.getClipData() != null) {
        final int numSelectedFiles = data.getClipData().getItemCount();
        Uri[] result = new Uri[numSelectedFiles];
        for (int i = 0; i < numSelectedFiles; i++) {
            result[i] = data.getClipData().getItemAt(i).getUri();
        }
        return result;
    }
    return null;
}
 
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    
    // Hide the content view.
    this.setVisibility(View.GONE);
    
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
源代码13 项目: android-profile   文件: SoomlaTwitterWebView.java
/**
 * Constructor
 *
 * @param parentActivity the parent activity of the web-view, which will
 *                       be used as a context
 */
public SoomlaTwitterWebView(Activity parentActivity) {
    super(parentActivity);

    this.getSettings().setJavaScriptEnabled(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        this.getSettings().setAllowUniversalAccessFromFileURLs(true);
    }

    this.mHandler = new Handler(Looper.getMainLooper());

    this.setWebChromeClient(new WebChromeClient() {
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.d(TAG, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
            return true;
        }
    });

    this.setBackgroundColor(0x00000000);
    this.mTranslucent = true;
    postInvalidate();
}
 
@Override
@SuppressLint("SetJavaScriptEnabled")
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_3dsecure);

    // init toolbar
    toolbar = findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(view -> onBackPressed());

    // init web view
    webView = findViewById(R.id.webview);
    webView.setWebChromeClient(new WebChromeClient());
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(buildWebViewClient());

    init();
}
 
源代码15 项目: XDroid   文件: WebActivity.java
private void initWebView() {
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            if (newProgress == 100) {
                if (contentLayout != null)
                    contentLayout.showContent();
                if (webView != null)
                    url = webView.getUrl();
            } else {
                if (contentLayout != null)
                    contentLayout.showLoading();
            }
        }
    });
    webView.setWebViewClient(new WebViewClient());
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDatabaseEnabled(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    webView.getSettings().setAppCacheEnabled(true);

    webView.loadUrl(url);
}
 
源代码16 项目: ListItemFold   文件: DetailFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_blank, container, false);

    mWebview = (WebView) view.findViewById(R.id.h5_web);
    WebSettings webSettings = mWebview.getSettings();
    webSettings.setSupportZoom(false);
    webSettings.setPluginState(WebSettings.PluginState.ON);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setJavaScriptEnabled(true);
    mWebview.setWebChromeClient(new WebChromeClient());
    mWebview.setWebViewClient(new WebViewClient());
    mWebview.loadUrl(mUrl);
    DetailAnimViewGroup wrapper = new DetailAnimViewGroup(inflater.getContext(), view, 0);
    wrapper.setReversed(false);
    return wrapper;
}
 
源代码17 项目: XDroid-Databinding   文件: WebActivity.java
private void initWebView() {
    getBinding().webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            if (newProgress == 100) {
                if (getBinding().contentLayout != null)
                    getBinding().contentLayout.showContent();
                if (getBinding().webView != null)
                    url = getBinding().webView.getUrl();
            } else {
                if (getBinding().contentLayout != null)
                    getBinding().contentLayout.showLoading();
            }
        }
    });
    getBinding().webView.setWebViewClient(new WebViewClient());
    getBinding().webView.getSettings().setBuiltInZoomControls(true);
    getBinding().webView.getSettings().setJavaScriptEnabled(true);
    getBinding().webView.getSettings().setDomStorageEnabled(true);
    getBinding().webView.getSettings().setDatabaseEnabled(true);
    getBinding().webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    getBinding().webView.getSettings().setAppCacheEnabled(true);

    getBinding().webView.loadUrl(url);
}
 
源代码18 项目: a2cardboard   文件: CordovaWebViewImpl.java
@Override
@Deprecated
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }

    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;

    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) engine.getView().getParent();
    parent.addView(view, new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
            Gravity.CENTER));

    // Hide the content view.
    engine.getView().setVisibility(View.GONE);

    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
 
源代码19 项目: XQuickEnergy   文件: HtmlViewerActivity.java
@Override
protected void onCreate(Bundle savedInstanceState)
{
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_html_viewer);

 mWebView = (MyWebView) findViewById(R.id.mwv_webview);
 pgb = (ProgressBar) findViewById(R.id.pgb_webview);

 mWebView.setWebChromeClient(
  new WebChromeClient()
  {
   @Override
   public void onProgressChanged(WebView view, int progress)
   {
    pgb.setProgress(progress);
    if(progress < 100)
    {
     setTitle("Loading...");
     pgb.setVisibility(View.VISIBLE);
    }else
    {
     setTitle(mWebView.getTitle());
     pgb.setVisibility(View.GONE);
    }
   }
  });
 mWebView.loadUrl(getIntent().getData().toString());
}
 
源代码20 项目: XDroidMvp   文件: WebActivity.java
private void initWebView() {
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            if (newProgress == 100) {
                swipeRefreshLayout.setRefreshing(false);
                if (contentLayout != null)
                    contentLayout.showContent();
                if (webView != null)
                    url = webView.getUrl();
            } else {
                if (contentLayout != null)
                    contentLayout.showLoading();
            }
        }
    });
    webView.setWebViewClient(new WebViewClient());
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDatabaseEnabled(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    webView.getSettings().setAppCacheEnabled(true);

    webView.loadUrl(url);
}
 
源代码21 项目: materialistic   文件: SubmitActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppUtils.setStatusBarColor(getWindow(), ContextCompat.getColor(this, R.color.blackT12));
    setContentView(R.layout.activity_submit);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME |
            ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);
    mTitleLayout = (TextInputLayout) findViewById(R.id.textinput_title);
    mContentLayout = (TextInputLayout) findViewById(R.id.textinput_content);
    mTitleEditText = (TextView) findViewById(R.id.edittext_title);
    mContentEditText = (TextView) findViewById(R.id.edittext_content);
    String text, subject;
    if (savedInstanceState == null) {
        subject = getIntent().getStringExtra(Intent.EXTRA_SUBJECT);
        text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
    } else {
        subject = savedInstanceState.getString(STATE_SUBJECT);
        text = savedInstanceState.getString(STATE_TEXT);
    }
    mTitleEditText.setText(subject);
    mContentEditText.setText(text);
    if (TextUtils.isEmpty(subject)) {
        if (isUrl(text)) {
            WebView webView = new WebView(this);
            webView.setWebChromeClient(new WebChromeClient() {
                @Override
                public void onReceivedTitle(WebView view, String title) {
                    if (mTitleEditText.length() == 0) {
                        mTitleEditText.setText(title);
                    }
                }
            });
            webView.loadUrl(text);
        } else if (!TextUtils.isEmpty(text)) {
            extractUrl(text);
        }
    }
}
 
源代码22 项目: STUer-client   文件: StuWebViewActivity.java
private void webViewProgressSetting() {
    mWebView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            if (newProgress == 100) {
                mProgressBar.setVisibility(View.INVISIBLE);
            } else {
                if (mProgressBar.getVisibility() == View.INVISIBLE) {
                    mProgressBar.setVisibility(View.VISIBLE);
                }
                mProgressBar.setProgress(newProgress);
            }
        }
    });
}
 
源代码23 项目: droidkit-webrtc   文件: GAEChannelClient.java
/** Asynchronously open an AppEngine channel. */
@SuppressLint("SetJavaScriptEnabled")
public GAEChannelClient(
    Activity activity, String token, MessageHandler handler) {
  webView = new WebView(activity);
  webView.getSettings().setJavaScriptEnabled(true);
  webView.setWebChromeClient(new WebChromeClient() {  // Purely for debugging.
      public boolean onConsoleMessage (ConsoleMessage msg) {
        Log.d(TAG, "console: " + msg.message() + " at " +
            msg.sourceId() + ":" + msg.lineNumber());
        return false;
      }
    });
  webView.setWebViewClient(new WebViewClient() {  // Purely for debugging.
      public void onReceivedError(
          WebView view, int errorCode, String description,
          String failingUrl) {
        Log.e(TAG, "JS error: " + errorCode + " in " + failingUrl +
            ", desc: " + description);
      }
    });
  proxyingMessageHandler =
      new ProxyingMessageHandler(activity, handler, token);
  webView.addJavascriptInterface(
      proxyingMessageHandler, "androidMessageHandler");
  webView.loadUrl("file:///android_asset/channel.html");
}
 
源代码24 项目: turbolinks-android   文件: TurbolinksHelper.java
/**
 * <p>Configures basic settings of the webView (Javascript enabled, DOM storage enabled,
 * database enabled).</p>
 *
 * @param webView The shared webView.
 */
@SuppressLint("SetJavaScriptEnabled")
private static void configureWebViewDefaults(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setDatabaseEnabled(true);

    webView.setWebChromeClient(new WebChromeClient());
}
 
源代码25 项目: imsdk-android   文件: RichEditor.java
@SuppressLint("SetJavaScriptEnabled")
public RichEditor(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setVerticalScrollBarEnabled(false);
    setHorizontalScrollBarEnabled(false);
    getSettings().setJavaScriptEnabled(true);
    setWebChromeClient(new WebChromeClient());
    setWebViewClient(createWebviewClient());
    loadUrl(SETUP_HTML);

    applyAttributes(context, attrs);
}
 
源代码26 项目: uservoice-android-sdk   文件: Utils.java
@SuppressLint("SetJavaScriptEnabled")
public static void displayArticle(WebView webView, Article article, Context context) {
    String styles = "iframe, img { max-width: 100%; }";
    if (isDarkTheme(context)) {
        webView.setBackgroundColor(Color.parseColor("#303030"));
        styles += "body { background-color: #303030; color: #F6F6F6; } a { color: #0099FF; }";
    }
    String html = String.format("<html><head><meta charset=\"utf-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://cdn.uservoice.com/stylesheets/vendor/typeset.css\"/><style>%s</style></head><body class=\"typeset\" style=\"font-family: sans-serif; margin: 1em\"><h3>%s</h3><br>%s</body></html>", styles, article.getTitle(), article.getHtml());
    webView.setWebChromeClient(new WebChromeClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
}
 
源代码27 项目: weex-uikit   文件: WXWebViewTest.java
@Test
public void testLoadUrl() throws Exception {
  String url = "http://www.taobao.com";
  view.loadUrl(url);
  WebViewClient client = shadow.getWebViewClient();
  client.onPageStarted(webView,url,null);
  client.onPageFinished(webView,url);

  WebChromeClient chromeClient = shadow.getWebChromeClient();
  chromeClient.onProgressChanged(webView,10);
  chromeClient.onProgressChanged(webView,100);
  chromeClient.onReceivedTitle(webView,"test");

}
 
private void startFileChooser(WebChromeClient.FileChooserParams fileChooserParams) {
    final String[] acceptTypes = getSafeAcceptedTypes(fileChooserParams);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final boolean allowMultiple = fileChooserParams.getMode() == WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE;

        Intent intent = fileChooserParams.createIntent();
        intent.setType("*/*");
        intent.putExtra(Intent.EXTRA_MIME_TYPES, getAcceptedMimeType(acceptTypes));
        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple);
        getCurrentActivity().startActivityForResult(intent, SELECT_FILE);
    }
}
 
源代码29 项目: android-discourse   文件: Utils.java
@SuppressLint("SetJavaScriptEnabled")
public static void displayArticle(WebView webView, Article article, Context context) {
    String styles = "iframe, img { width: 100%; }";
    if (isDarkTheme(context)) {
        webView.setBackgroundColor(Color.BLACK);
        styles += "body { background-color: #000000; color: #F6F6F6; } a { color: #0099FF; }";
    }
    String html = String.format("<html><head><meta charset=\"utf-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://cdn.uservoice.com/stylesheets/vendor/typeset.css\"/><style>%s</style></head><body class=\"typeset\" style=\"font-family: sans-serif; margin: 1em\"><h3>%s</h3>%s</body></html>", styles, article.getTitle(), article.getHtml());
    webView.setWebChromeClient(new WebChromeClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
}
 
源代码30 项目: alpha-wallet-android   文件: Web3TokenView.java
public void setupWindowCallback(@NonNull FunctionCallback callback)
{
    setWebChromeClient(
            new WebChromeClient()
            {
                @Override
                public void onCloseWindow(WebView window)
                {
                    callback.functionSuccess();
                }
            }
    );
}