- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中android.webkit.WebBackForwardList.getCurrentIndex()
方法的一些代码示例,展示了WebBackForwardList.getCurrentIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebBackForwardList.getCurrentIndex()
方法的具体详情如下:
包路径:android.webkit.WebBackForwardList
类名称:WebBackForwardList
方法名:getCurrentIndex
暂无
代码示例来源:origin: Justson/AgentWeb
public void onPageFinished(WebView view) {
if (!mIsOnReceivedTitle && mWebChromeClient != null) {
WebBackForwardList list = null;
try {
list = view.copyBackForwardList();
} catch (NullPointerException e) {
if (LogUtils.isDebug()) {
e.printStackTrace();
}
}
if (list != null
&& list.getSize() > 0
&& list.getCurrentIndex() >= 0
&& list.getItemAtIndex(list.getCurrentIndex()) != null) {
String previousTitle = list.getItemAtIndex(list.getCurrentIndex()).getTitle();
mWebChromeClient.onReceivedTitle(view, previousTitle);
}
}
}
代码示例来源:origin: cymcsg/UltimateAndroid
/**
* Get the latest url of webview
* @param webView
* @return
*/
public static String getHistoricalUrl(WebView webView) {
WebBackForwardList webBackForwardList = getHistoricalList(webView);
return webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() - 1).getUrl();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldReturnCopyFromCopyBackForwardList() {
WebBackForwardList historyList = webView.copyBackForwardList();
// Adding history after copying should not affect the copy.
webView.loadUrl("foo1.bar");
webView.loadUrl("foo2.bar");
assertThat(historyList.getSize()).isEqualTo(0);
assertThat(historyList.getCurrentIndex()).isEqualTo(-1);
assertThat(historyList.getCurrentItem()).isNull();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldCopyBackForwardListWhenEmpty() {
WebBackForwardList historyList = webView.copyBackForwardList();
assertThat(historyList.getSize()).isEqualTo(0);
assertThat(historyList.getCurrentIndex()).isEqualTo(-1);
assertThat(historyList.getCurrentItem()).isNull();
}
代码示例来源:origin: avluis/Hentoid
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_BACK) {
WebBackForwardList webBFL = webView.copyBackForwardList();
int i = webBFL.getCurrentIndex();
do {
i--;
}
while (i >= 0 && webView.getOriginalUrl()
.equals(webBFL.getItemAtIndex(i).getOriginalUrl()));
if (webView.canGoBackOrForward(i - webBFL.getCurrentIndex())) {
webView.goBackOrForward(i - webBFL.getCurrentIndex());
} else {
super.onBackPressed();
}
return true;
}
return false;
}
代码示例来源:origin: calvinaquino/LNReader-Android
@Override
public boolean canGoBack() {
WebBackForwardList history = this.copyBackForwardList();
WebHistoryItem prevData = history.getItemAtIndex(history.getCurrentIndex() - 1);
if (prevData != null) {
if (prevData.getUrl().startsWith(PREFIX_PAGEMODEL)) {
Log.d(TAG, "Previous data is internal page: " + prevData.getUrl());
return false;
} else
Log.d(TAG, "Back to: " + prevData.getUrl());
}
return super.canGoBack();
}
代码示例来源:origin: vbier/habpanelviewer
@Override
public boolean canGoBackOrForward(int steps) {
Log.d(TAG, "canGoBackOrForward: steps=" + steps);
int increment = steps < 0 ? -1 : 1;
WebBackForwardList list = copyBackForwardList();
int count = 0;
int startIdx = list.getCurrentIndex();
for (int i = startIdx + increment; i < list.getSize() && i >= 0; i += increment) {
WebHistoryItem item = list.getItemAtIndex(i);
Log.d(TAG, "canGoBackOrForward: item=" + item.getOriginalUrl());
if (!item.getOriginalUrl().startsWith("data:")) {
count += increment;
if (count == steps) {
Log.d(TAG, "canGoBackOrForward: true");
return true;
}
}
}
return false;
}
代码示例来源:origin: avluis/Hentoid
@Override
public void onDownloadFabClick(View view) {
downloadFabPressed = true;
historyIndex = getWebView().copyBackForwardList().getCurrentIndex();
String newUrl = getWebView().getUrl().replace("Book/Info", "Read/View");
final int index = ordinalIndexOf(newUrl);
if (index > 0) newUrl = newUrl.substring(0, index);
getWebView().loadUrl(newUrl);
}
代码示例来源:origin: avluis/Hentoid
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
BaseWebActivity activity = activityReference.get();
if (url.contains("//www.tsumino.com/Book/Info/") && activity != null) {
executeAsyncTask(new HtmlLoader(activity), url);
} else if (downloadFabPressed && url.contains("//www.tsumino.com/Read/View/")) {
downloadFabPressed = false;
int currentIndex = getWebView().copyBackForwardList().getCurrentIndex();
getWebView().goBackOrForward(historyIndex - currentIndex);
processDownload();
}
}
代码示例来源:origin: vbier/habpanelviewer
@Override
public void goBackOrForward(int steps) {
Log.d(TAG, "goBackOrForward: steps=" + steps);
int increment = steps < 0 ? -1 : 1;
WebBackForwardList list = copyBackForwardList();
int count = 0;
int intCount = 0;
int startIdx = list.getCurrentIndex();
for (int i = startIdx + increment; i < list.getSize() && i >= 0; i += increment) {
intCount += increment;
WebHistoryItem item = list.getItemAtIndex(i);
Log.d(TAG, "goBackOrForward: item=" + item.getOriginalUrl());
if (!item.getOriginalUrl().startsWith("data:")) {
count += increment;
if (count == steps) {
Log.d(TAG, "goBackOrForward: intCount=" + intCount + ", item=" + item.getOriginalUrl());
super.goBackOrForward(intCount);
return;
}
}
}
}
本文整理了Java中android.webkit.WebBackForwardList.getCurrentIndex()方法的一些代码示例,展示了WebBackForwardList.getCurr
本文整理了Java中android.webkit.WebBackForwardList.getSize()方法的一些代码示例,展示了WebBackForwardList.getSize()的具体用法。
本文整理了Java中android.webkit.WebBackForwardList.getItemAtIndex()方法的一些代码示例,展示了WebBackForwardList.getItemA
我正在尝试使用 WebView 和 android studio 实现一个简单的网络浏览器应用程序。我想将我的 WebView 的状态(例如 WebBackForwardList)保存到内部存储并在我
最近我得知我的混合 Android 应用程序无法正常工作。 提示是当他们按下设备上的后退按钮时,它应该返回到以前的 webview url。 但它返回到一个 url,就像用户按了两次后退按钮一样。 所
如何使用 WebBackForwardList 类获取 WebView 的历史记录?我看着 documentation page但我无法理解,WebBackForwardList 是访问 WebVie
我是一名优秀的程序员,十分优秀!