android.webkit.WebView.canGoForward()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(237)

本文整理了Java中android.webkit.WebView.canGoForward()方法的一些代码示例,展示了WebView.canGoForward()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.canGoForward()方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:canGoForward

WebView.canGoForward介绍

暂无

代码示例

代码示例来源:origin: chentao0707/SimplifyReader

public boolean canGoForward() {
  return null != mWebView ? mWebView.canGoForward() : false;
}

代码示例来源:origin: square/assertj-android

public WebViewAssert canNotGoForward() {
 isNotNull();
 assertThat(actual.canGoForward()) //
   .overridingErrorMessage("Expected to not be able to go forward but could.") //
   .isFalse();
 return this;
}

代码示例来源:origin: square/assertj-android

public WebViewAssert canGoForward() {
 isNotNull();
 assertThat(actual.canGoForward()) //
   .overridingErrorMessage("Expected to be able to go forward but could not.") //
   .isTrue();
 return this;
}

代码示例来源:origin: TommyLemon/APIJSON

@Override
public void onDragBottom(boolean rightToLeft) {
  if (rightToLeft) {
    if (wvWebView.canGoForward()) {
      wvWebView.goForward();
    }
    return;
  }        
  onBackPressed();
}

代码示例来源:origin: TommyLemon/Android-ZBLibrary

@Override
public void onDragBottom(boolean rightToLeft) {
  if (rightToLeft) {
    if (wvWebView.canGoForward()) {
      wvWebView.goForward();
    }
    return;
  }
  onBackPressed();
}

代码示例来源:origin: TheFinestArtist/FinestWebView-Android

@Override
public void onPageFinished(WebView view, String url) {
 BroadCastManager.onPageFinished(FinestWebViewActivity.this, key, url);
 if (updateTitleFromHtml) {
  title.setText(view.getTitle());
 }
 urlTv.setText(UrlParser.getHost(url));
 requestCenterLayout();
 if (view.canGoBack() || view.canGoForward()) {
  back.setVisibility(showIconBack ? View.VISIBLE : View.GONE);
  forward.setVisibility(showIconForward ? View.VISIBLE : View.GONE);
  back.setEnabled(!disableIconBack && (rtl ? view.canGoForward() : view.canGoBack()));
  forward.setEnabled(!disableIconForward && (rtl ? view.canGoBack() : view.canGoForward()));
 } else {
  back.setVisibility(View.GONE);
  forward.setVisibility(View.GONE);
 }
 if (injectJavaScript != null) {
  webView.evaluateJavascript(injectJavaScript, null);
 }
}

代码示例来源:origin: cSploit/android

@Override
public boolean onOptionsItemSelected(MenuItem item) {
 switch (item.getItemId()) {
  case android.R.id.home:
   mWebView = null;
   onBackPressed();
   return true;
  case R.id.back:
   if (mWebView.canGoBack())
    mWebView.goBack();
   return true;
  case R.id.forward:
   if (mWebView.canGoForward())
    mWebView.goForward();
   return true;
  case R.id.reload:
   mWebView.reload();
  default:
   return super.onOptionsItemSelected(item);
 }
}

代码示例来源:origin: TheFinestArtist/FinestWebView-Android

protected void requestCenterLayout() {
 int maxWidth;
 if (webView.canGoBack() || webView.canGoForward()) {
  maxWidth = DisplayUtil.getWidth() - UnitConverter.dpToPx(48) * 4;
 } else {
  maxWidth = DisplayUtil.getWidth() - UnitConverter.dpToPx(48) * 2;
 }
 title.setMaxWidth(maxWidth);
 urlTv.setMaxWidth(maxWidth);
 title.requestLayout();
 urlTv.requestLayout();
}

代码示例来源:origin: weexteam/weex-hackernews

@Override
public void onPageFinished(WebView view, String url) {
  super.onPageFinished(view, url);
  WXLogUtils.v("tag", "onPageFinished " + url);
  if (mOnPageListener != null) {
    mOnPageListener.onPageFinish(url, view.canGoBack(), view.canGoForward());
  }
}

代码示例来源:origin: luili16/UIMocker

@Override
public boolean canGoForward() {
  return mWebView.canGoForward();
}

代码示例来源:origin: fangx/ZhiHuMVP

public boolean canGoForward() {
  return null != mWebView ? mWebView.canGoForward() : false;
}

代码示例来源:origin: wzmyyj/ZYMK

public void goForward() {
  if (web.canGoForward()) {
    web.goForward();
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public WebViewAssert canGoForward() {
 isNotNull();
 assertThat(actual.canGoForward()) //
   .overridingErrorMessage("Expected to be able to go forward but could not.") //
   .isTrue();
 return this;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public WebViewAssert canNotGoForward() {
 isNotNull();
 assertThat(actual.canGoForward()) //
   .overridingErrorMessage("Expected to not be able to go forward but could.") //
   .isFalse();
 return this;
}

代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK

private void setBrowserNav() {
  if (webView != null && btnBack != null && btnForward != null) {
    btnBack.setEnabled(webView.canGoBack());
    btnForward.setEnabled(webView.canGoForward());
  }
}

代码示例来源:origin: jbruchanov/AnUitor

@Override
  public void run() {
    data.put("CanGoBack", wv.canGoBack());
    data.put("CanGoForward", wv.canGoForward());
    data.put("OriginalURL", wv.getOriginalUrl());
    data.put("URL", wv.getUrl());
    data.put("Title", wv.getTitle());
    data.put("Progress", wv.getProgress());
    WebSettings settings = wv.getSettings();
    fillSettings(settings, data);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      data.put("CanZoomIn", wv.canZoomIn());
      data.put("CanZoomOut", wv.canZoomOut());
      data.put("IsPrivateBrowsingEnabled", wv.isPrivateBrowsingEnabled());
    }
    synchronized (lock) {
      lock.notifyAll();
    }
  }
});

代码示例来源:origin: AmniX/AdBlockedWebView-Android

@Override
public void onPageFinished(WebView view, String url) {
  mPresenter.onReceivedTitle(view.getTitle(), url);
  mPresenter.setEnabledGoBackAndGoFoward(view.canGoBack(), view.canGoForward());
}

代码示例来源:origin: appnexus/mobile-sdk-android

@Override
  public void onPageFinished(WebView webview, String url) {
    back.setEnabled(webview.canGoBack());
    forward.setEnabled(webview.canGoForward());
    CookieSyncManager csm = CookieSyncManager.getInstance();
    if (csm != null) csm.sync();
  }
});

代码示例来源:origin: amahi/android

@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
  switch (menuItem.getItemId()) {
    case android.R.id.home:
      finish();
      return true;
    case R.id.menu_back:
      if (getWebView().canGoBack()) {
        getWebView().goBack();
      }
      return true;
    case R.id.menu_forward:
      if (getWebView().canGoForward()) {
        getWebView().goForward();
      }
      return true;
    default:
      return super.onOptionsItemSelected(menuItem);
  }
}

代码示例来源:origin: yll2wcf/book

void webViewMethod() {
  webView.goBack();//后退
  webView.goForward();//前进
  //以当前的index为起始点前进或者后退到历史记录中指定的steps, 如果steps为负数则为后退,正数则为前进
  // webView.goBackOrForward(intsteps);
  webView.canGoForward();//判断是否可以前进
  webView.canGoBack(); //判断是否可以后退
  webView.clearCache(true);//清除网页访问留下的缓存,由于内核缓存是全局的因此这个方法不仅仅针对webview而是针对整个应用程序.
  webView.clearHistory();//清除当前webview访问的历史记录,只会webview访问历史记录里的所有记录除了当前访问记录.
  webView.clearFormData();//这个api仅仅清除自动完成填充的表单数据,并不会清除WebView存储到本地的数据。
  webView.onResume(); //激活WebView为活跃状态,能正常执行网页的响应
  webView.onPause();//当页面被失去焦点被切换到后台不可见状态,需要执行onPause动过, onPause动作通知内核暂停所有的动作,比如DOM的解析、plugin的执行、JavaScript执行。
  webView.pauseTimers();//当应用程序被切换到后台我们使用了webview, 这个方法不仅仅针对当前的webview而是全局的全应用程序的webview,它会暂停所有webview的layout,parsing,javascripttimer。降低CPU功耗。
  webView.resumeTimers();//恢复pauseTimers时的动作。
  webView.destroy();//销毁,关闭了Activity时,音乐或视频,还在播放。就必须销毁
}
//按键事件

相关文章

WebView类方法