List of usage examples for android.webkit WebView canGoForward
public boolean canGoForward()
From source file:de.baumann.browser.helper.helper_webView.java
private static void webView_Touch(final Activity from, final WebView webView) { webView.setOnTouchListener(new class_OnSwipeTouchListener_webview(from) { public void onSwipeRight() { if (webView.canGoBack()) { webView.goBack();//w ww. j a v a 2s.c o m } else { Snackbar.make(webView, R.string.toast_back, Snackbar.LENGTH_SHORT).show(); } } public void onSwipeLeft() { if (webView.canGoForward()) { webView.goForward(); } else { Snackbar.make(webView, R.string.toast_forward, Snackbar.LENGTH_SHORT).show(); } } }); }
From source file:com.macleod2486.utnow.MainActivity.java
public void forward(View view) { WebView utdirect = (WebView) findViewById(R.id.webView); if (utdirect.canGoForward()) utdirect.goForward();//from www . ja va2 s.c om }
From source file:com.tomeokin.lspush.biz.home.CollectionWebViewActivity.java
@Override protected void onPrepareWebView(WebView webView) { super.onPrepareWebView(webView); webView.setWebViewClient(new WebViewClient() { @Override/* ww w. j av a 2 s . com*/ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { return false; // let the web view handle the url } @Override public void onPageFinished(WebView view, String url) { boolean canGoBack = view.canGoBack(); mBottomBar.backButton.setEnabled(canGoBack); mBottomBar.backButton .setImageResource(canGoBack ? R.drawable.ic_action_back_deep : R.drawable.ic_action_back); boolean canGoForward = view.canGoForward(); mBottomBar.forwardButton.setEnabled(canGoForward); mBottomBar.forwardButton.setImageResource( canGoForward ? R.drawable.ic_action_forward_deep : R.drawable.ic_action_forward); } }); }
From source file:com.purchasingpower.inappbrowser.WebViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); setContentView(getResources().getIdentifier("nativebrowserplugin", "layout", getPackageName())); if (!checkPermission()) { requestPermission();//from w ww . j av a 2 s.c om } Intent intent = getIntent(); String url = intent.getExtras().getString("url"); final WebView myWebView = (WebView) findViewById( getResources().getIdentifier("webview", "id", getPackageName())); myWebView.setWebViewClient(new MyWebViewClient()); webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setLoadWithOverviewMode(true); webSettings.setAllowFileAccess(true); myWebView.setWebChromeClient(new PQChromeClient()); //if SDK version is greater of 19 then activate hardware acceleration otherwise activate software acceleration if (Build.VERSION.SDK_INT >= 19) { myWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } else if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT < 19) { myWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } myWebView.loadUrl(url); back = (ImageView) findViewById(getResources().getIdentifier("back", "id", getPackageName())); back.setImageResource(getResources().getIdentifier("back_gray", "drawable", getPackageName())); forward = (ImageView) findViewById(getResources().getIdentifier("forward", "id", getPackageName())); forward.setImageResource(getResources().getIdentifier("forward_gray", "drawable", getPackageName())); done = (TextView) findViewById(getResources().getIdentifier("done", "id", getPackageName())); pbar = (ProgressBar) findViewById(getResources().getIdentifier("pbar", "id", getPackageName())); pbar.setVisibility(View.VISIBLE); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myWebView.canGoBack()) { myWebView.goBack(); } } }); forward.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myWebView.canGoForward()) { myWebView.goForward(); } } }); done.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.v("Done", "Clicked"); finish(); } }); }