本文整理汇总了Java中android.webkit.WebHistoryItem类的典型用法代码示例。如果您正苦于以下问题:Java WebHistoryItem类的具体用法?Java WebHistoryItem怎么用?Java WebHistoryItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebHistoryItem类属于android.webkit包,在下文中一共展示了WebHistoryItem类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printBackForwardList
import android.webkit.WebHistoryItem; //导入依赖的package包/类
public void printBackForwardList() {
WebBackForwardList currentList = this.copyBackForwardList();
int currentSize = currentList.getSize();
for(int i = 0; i < currentSize; ++i)
{
WebHistoryItem item = currentList.getItemAtIndex(i);
String url = item.getUrl();
LOG.d(TAG, "The URL at index: " + Integer.toString(i) + " is " + url );
}
}
示例2: startOfHistory
import android.webkit.WebHistoryItem; //导入依赖的package包/类
public boolean startOfHistory()
{
WebBackForwardList currentList = this.copyBackForwardList();
WebHistoryItem item = currentList.getItemAtIndex(0);
if( item!=null){ // Null-fence in case they haven't called loadUrl yet (CB-2458)
String url = item.getUrl();
String currentUrl = this.getUrl();
LOG.d(TAG, "The current URL is: " + currentUrl);
LOG.d(TAG, "The URL at item 0 is: " + url);
return currentUrl.equals(url);
}
return false;
}
示例3: goBack
import android.webkit.WebHistoryItem; //导入依赖的package包/类
@Override
public void goBack() {
WebBackForwardList list = mWebView.copyBackForwardList();
int curIndex = list.getCurrentIndex();
WebHistoryItem curItem = list.getCurrentItem();
WebHistoryItem prevItem = list.getItemAtIndex(curIndex - 1);
int steps = 0;
if (prevItem != null) {
steps--;
if (prevItem.getUrl().equals(JoyWeb.getCookie())) {
prevItem = list.getItemAtIndex(curIndex - 2);
if (prevItem != null) {
steps--;
if (UriUtils.isEquals(prevItem.getUrl(), curItem.getUrl())) {
prevItem = list.getItemAtIndex(curIndex - 3);
if (prevItem != null) {
steps--;
goBackOrForward(steps);
} else {
mBaseView.finish();
}
return;
}
goBackOrForward(steps);
} else {
mBaseView.finish();
}
return;
}
if (goBackOrForward(steps)) {
return;
}
}
mBaseView.finish();
}
示例4: goForward
import android.webkit.WebHistoryItem; //导入依赖的package包/类
@Override
public void goForward() {
WebBackForwardList list = mWebView.copyBackForwardList();
int curIndex = list.getCurrentIndex();
WebHistoryItem curItem = list.getCurrentItem();
WebHistoryItem nextItem = list.getItemAtIndex(curIndex + 1);
int steps = 0;
if (nextItem != null) {
steps++;
if (nextItem.getUrl().equals(JoyWeb.getCookie())) {
nextItem = list.getItemAtIndex(curIndex + 2);
if (nextItem != null) {
steps++;
if (UriUtils.isEquals(nextItem.getUrl(), curItem.getUrl())) {
nextItem = list.getItemAtIndex(curIndex + 3);
if (nextItem != null) {
steps++;
goBackOrForward(steps);
} else {
mBaseView.showToast(R.string.toast_no_next_page);
}
return;
}
if (goBackOrForward(steps)) {
return;
}
}
}
if (goBackOrForward(steps)) {
return;
}
}
mBaseView.showToast(R.string.toast_no_next_page);
}