android.webkit.WebChromeClient Java Examples

The following examples show how to use android.webkit.WebChromeClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageDetailActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
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(){

        });

    }
 
Example #2
Source File: DetailFragment.java    From ListItemFold with MIT License 6 votes vote down vote up
@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;
}
 
Example #3
Source File: CordovaWebView.java    From L.TileLayer.Cordova with MIT License 6 votes vote down vote up
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();
}
 
Example #4
Source File: WebActivity.java    From XDroid-Databinding with MIT License 6 votes vote down vote up
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);
}
 
Example #5
Source File: MainActivity.java    From android-post-webview with The Unlicense 6 votes vote down vote up
@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();
}
 
Example #6
Source File: WebActivity.java    From XDroid with MIT License 6 votes vote down vote up
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);
}
 
Example #7
Source File: CustomWebViewActivity.java    From JsBridge with Apache License 2.0 6 votes vote down vote up
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;
        }
    });
}
 
Example #8
Source File: Gateway3DSecureActivity.java    From gateway-android-sdk with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #9
Source File: SoomlaTwitterWebView.java    From android-profile with Apache License 2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example #10
Source File: CordovaWebView.java    From cordova-android-chromeview with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #11
Source File: Web3WebviewModule.java    From react-native-web3-webview with MIT License 6 votes vote down vote up
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;
}
 
Example #12
Source File: PreviewFragment.java    From mua with MIT License 6 votes vote down vote up
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");
}
 
Example #13
Source File: CordovaWebView.java    From bluemix-parking-meter with MIT License 6 votes vote down vote up
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();
}
 
Example #14
Source File: DappBrowserFragment.java    From alpha-wallet-android with MIT License 6 votes vote down vote up
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();
        }
    }
}
 
Example #15
Source File: PreviewFragment.java    From timecat with Apache License 2.0 6 votes vote down vote up
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");
}
 
Example #16
Source File: CordovaWebView.java    From reader with MIT License 6 votes vote down vote up
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();
}
 
Example #17
Source File: CustomChooserActivity.java    From android-webview-upload-file with Apache License 2.0 6 votes vote down vote up
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;
        }
    });

}
 
Example #18
Source File: CordovaWebViewImpl.java    From ultimate-cordova-webview-app with MIT License 5 votes vote down vote up
@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();
}
 
Example #19
Source File: LiveThread.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
public ItemHolder(View itemView) {
    super(itemView);
    title = itemView.findViewById(R.id.title);
    info = itemView.findViewById(R.id.body);
    go = itemView.findViewById(R.id.go);
    imageArea = itemView.findViewById(R.id.image_area);
    twitterArea = itemView.findViewById(R.id.twitter_area);
    twitterArea.setWebChromeClient(new WebChromeClient());
    twitterArea.getSettings().setJavaScriptEnabled(true);
    twitterArea.setBackgroundColor(Color.TRANSPARENT);
    twitterArea.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);

}
 
Example #20
Source File: AgentWebView.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
public final void setWebChromeClient(WebChromeClient client) {
    AgentWebChrome mAgentWebChrome = new AgentWebChrome(this);
    mAgentWebChrome.setDelegate(client);
    mFixedOnReceivedTitle.setWebChromeClient(client);
    super.setWebChromeClient(mAgentWebChrome);
    setWebChromeClientSupport(mAgentWebChrome);
}
 
Example #21
Source File: EditorInfoActivity.java    From LeisureRead with Apache License 2.0 5 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView() {

  final WebSettings webSettings = mWebView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
  webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
  webSettings.setDomStorageEnabled(true);
  webSettings.setGeolocationEnabled(true);
  mWebView.getSettings().setBlockNetworkImage(true);
  mWebView.setWebViewClient(webViewClient);
  mWebView.requestFocus(View.FOCUS_DOWN);
  mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
  mWebView.setWebChromeClient(new WebChromeClient() {

    @Override
    public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {

      AlertDialog.Builder b2 = new AlertDialog.Builder(EditorInfoActivity.this).setTitle(
          R.string.app_name)
          .setMessage(message)
          .setPositiveButton("确定", (dialog, which) -> result.confirm());

      b2.setCancelable(false);
      b2.create();
      b2.show();
      return true;
    }
  });
  mWebView.loadUrl(url);
}
 
Example #22
Source File: GeolocationActivity.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle b) {
    super.onCreate(b);

    wv.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
            callback.invoke(origin, true, false);
        }
    });
}
 
Example #23
Source File: RobotiumWebClient.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Enables JavaScript in the given {@code WebViews} objects.
 * 
 * @param webViews the {@code WebView} objects to enable JavaScript in
 */

public void enableJavascriptAndSetRobotiumWebClient(List<WebView> webViews, WebChromeClient originalWebChromeClient){
	this.originalWebChromeClient = originalWebChromeClient;
	for(final WebView webView : webViews){
		if(webView != null){ 
			inst.runOnMainSync(new Runnable() {
				public void run() {
					webView.getSettings().setJavaScriptEnabled(true);
					webView.setWebChromeClient(robotiumWebClient);
				}
			});
		}
	}
}
 
Example #24
Source File: FragmentPagerFragmentWebView.java    From Scrollable with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle sis) {
    super.onViewCreated(view, sis);

    mWebView = findView(R.id.web_view);
    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.post(new Runnable() {
        @Override
        public void run() {
            mWebView.loadUrl("https://github.com/noties/Scrollable/tree/develop");
        }
    });
}
 
Example #25
Source File: FileChooser.java    From quickhybrid-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void showFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
    setFilePathCallbacks(filePathCallback);
    String[] acceptTypes = new String[0];
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        acceptTypes = fileChooserParams.getAcceptTypes();
    }
    dealOpenFileChooser(acceptTypes.length > 0 ? acceptTypes[0] : "");
}
 
Example #26
Source File: Web3TokenView.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
public void setupWindowCallback(@NonNull FunctionCallback callback)
{
    setWebChromeClient(
            new WebChromeClient()
            {
                @Override
                public void onCloseWindow(WebView window)
                {
                    callback.functionSuccess();
                }
            }
    );
}
 
Example #27
Source File: CordovaWebViewImpl.java    From pychat with MIT License 5 votes vote down vote up
@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();
}
 
Example #28
Source File: CustomWebViewModule.java    From react-native-webview-android-file-upload with MIT License 5 votes vote down vote up
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);
    }
}
 
Example #29
Source File: Utils.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
@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)));
}
 
Example #30
Source File: PrefetchService.java    From GankMeizhi with Apache License 2.0 5 votes vote down vote up
@UiThread
private void load(String url) {
    WebView webView = new WebView(this);
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            if (newProgress == 100) {
                Log.d(TAG, "onProgressChanged: " + view.getUrl());
            }
        }
    });
    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_DEFAULT);
    String cacheDirPath = getFilesDir().getAbsolutePath() + "/webviewcache";
    webView.getSettings().setDatabasePath(cacheDirPath);
    webView.getSettings().setAppCachePath(cacheDirPath);
    webView.getSettings().setAppCacheEnabled(true);

    webView.requestFocus();
    webView.getSettings().getAllowFileAccess();

    webView.loadUrl(url);
}