本文整理匯總了Java中android.webkit.WebBackForwardList.getCurrentIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java WebBackForwardList.getCurrentIndex方法的具體用法?Java WebBackForwardList.getCurrentIndex怎麽用?Java WebBackForwardList.getCurrentIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.webkit.WebBackForwardList
的用法示例。
在下文中一共展示了WebBackForwardList.getCurrentIndex方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPageFinished
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
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);
}
}
}
示例2: _backEvent
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
private void _backEvent() {
if (this.mWebView != null && this.mWebView.canGoBack()) {
this.mWebView.stopLoading();
LogInfo.log("+->", "mWebView-->>back" + this.mWebView.getUrl());
WebBackForwardList list = this.mWebView.copyBackForwardList();
if (list.getCurrentIndex() <= 0) {
this.pullDownUrlText.setText(String.format(getString(R.string.supplied_by), new Object[]{getUrlTitle(list.getItemAtIndex(0).getUrl())}));
} else {
this.pullDownUrlText.setText(String.format(getString(R.string.supplied_by), new Object[]{getUrlTitle(list.getItemAtIndex(list.getCurrentIndex() - 1).getUrl())}));
this.titleView.setText(list.getItemAtIndex(list.getCurrentIndex() - 1).getTitle());
}
this.mWebView.goBack();
if (!this.close.isShown()) {
this.close.setVisibility(0);
}
} else if ("floatBallActive".equals(this.web_flag)) {
finish();
} else {
finish();
}
}
示例3: backAction
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
@Override
public void backAction() {
String curUrl = webView.getUrl();
boolean isExit = true;
if (!TextUtils.isEmpty(curUrl)) {
if (webView.canGoBack()) {
WebBackForwardList backList = webView.copyBackForwardList();
if (backList != null && backList.getCurrentIndex() == 1) {
isExit = false;
loadLocalHtml(articleBean.getBody());
}
}
}
if (isExit) {
mActivity.finish();
}
}
示例4: onKeyDown
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
@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;
}
示例5: onBackPressedSupport
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
@Override
public void onBackPressedSupport() {
if (nswvDetailContent.canGoBack()) {
//獲取webView的瀏覽記錄
WebBackForwardList mWebBackForwardList = nswvDetailContent.copyBackForwardList();
//這裏的判斷是為了讓頁麵在有上一個頁麵的情況下,跳轉到上一個html頁麵,而不是退出當前activity
if (mWebBackForwardList.getCurrentIndex() > 0) {
nswvDetailContent.goBack();
return;
}
}
super.onBackPressedSupport();
}
示例6: onClick
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
public void onClick(View v) {
int id = v.getId();
if (id == R.id.close_iv) {
finish();
} else if (id == R.id.back_iv) {
if (this.mWebView.canGoBack()) {
LogInfo.log("+->", "mWebView-->>back" + this.mWebView.getUrl());
WebBackForwardList list = this.mWebView.copyBackForwardList();
if (list.getCurrentIndex() <= 0) {
this.pullDownUrlText.setText(String.format(getString(R.string.supplied_by), new Object[]{getUrlTitle(list.getItemAtIndex(0).getUrl())}));
this.titleView.setText(list.getItemAtIndex(0).getTitle());
} else {
this.pullDownUrlText.setText(String.format(getString(R.string.supplied_by), new Object[]{getUrlTitle(list.getItemAtIndex(list.getCurrentIndex() - 1).getUrl())}));
this.titleView.setText(list.getItemAtIndex(list.getCurrentIndex() - 1).getTitle());
}
this.mWebView.goBack();
if (!this.close.isShown()) {
this.close.setVisibility(0);
}
} else if ("floatBallActive".equals(this.web_flag)) {
finish();
} else {
finish();
}
}
UIsUtils.hideSoftkeyboard(this);
}
示例7: goBack
import android.webkit.WebBackForwardList; //導入方法依賴的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();
}
示例8: goForward
import android.webkit.WebBackForwardList; //導入方法依賴的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);
}
示例9: onGoBackClick
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
private void onGoBackClick(boolean needFinish) {
if (getWebWidget().canGoBack()) {
if (getWebWidget().isCookieStatusNone()) {
//如果沒有種cookie,直接back
getWebWidget().goBack();
} else {
//如果加載過cookie,則最早的曆史紀錄是cookieurl,不能back
WebBackForwardList list = getWebWidget().copyBackForwardList();
if (list != null && list.getCurrentIndex() > 1) {
if (mUseBottomBanner && list.getCurrentIndex() == 2) {// TODO 跳過loading頁,直接關閉。暫時先這麽寫
finish();
return;
}
getWebWidget().goBack();
} else {
if (needFinish)
finish();
}
}
} else {
if (needFinish)
finish();
}
}
示例10: onBackPressed
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
webView.stopLoading();
WebBackForwardList list = webView.copyBackForwardList();
int currentIndex = list.getCurrentIndex();
int index = currentIndex;
while (index >= 0) {
WebHistoryItem item = list.getItemAtIndex(index);
index--;
if (item == null) {
continue;
}
String url = item.getUrl();
if (url.startsWith(GeneralWebViewClient.ERORR_PAGE_URL)) {
continue;
}
if (index >= 0) {
WebHistoryItem prevItem = list.getItemAtIndex(index);
if (prevItem != null && url.equals(prevItem.getUrl())) {
continue;
}
}
break;
}
if (index < 0) {
super.onBackPressed();
} else {
webView.goBackOrForward(index - currentIndex);
}
}
示例11: onBackPressed
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
View layout_wv = findViewById(R.id.layoutWebView);
if (layout_wv != null) {
if (layout_wv.getVisibility() != View.VISIBLE)
finish();
else {
WebView wv = (WebView) findViewById(R.id.webViewMailingList);
if (wv != null) {
WebBackForwardList bf = wv.copyBackForwardList();
String back_url = "about:blank";
if (bf != null & bf.getCurrentIndex() > 0)
back_url = bf.getItemAtIndex(bf.getCurrentIndex() - 1)
.getUrl();
if (wv.canGoBack() && !back_url.equals("about:blank")) {
wv.goBack();
} else {
layout_wv.setVisibility(View.INVISIBLE);
wv.loadUrl("about:blank");
}
}
}
} else {
finish();
}
}
示例12: onBackPressed
import android.webkit.WebBackForwardList; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
View layout_wv = findViewById(R.id.layoutWebViewEDOC);
if (layout_wv != null) {
if (layout_wv.getVisibility() != View.VISIBLE)
finish();
else {
WebView wv = (WebView) findViewById(R.id.webViewEDOC);
if (wv != null) {
WebBackForwardList bf = wv.copyBackForwardList();
String back_url = "about:blank";
if (bf != null & bf.getCurrentIndex() > 0)
back_url = bf.getItemAtIndex(bf.getCurrentIndex() - 1)
.getUrl();
if (wv.canGoBack() && !back_url.equals("about:blank")) {
wv.goBack();
} else {
layout_wv.setVisibility(View.INVISIBLE);
wv.loadUrl("about:blank");
}
}
}
} else {
finish();
}
}