當前位置: 首頁>>代碼示例>>Java>>正文


Java WebBackForwardList.getCurrentIndex方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:21,代碼來源:AgentWebView.java

示例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();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:InviteWebviewimpl.java

示例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();
    }
}
 
開發者ID:WangGanxin,項目名稱:DoingDaily,代碼行數:20,代碼來源:ZhihuArticleFragment.java

示例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;
}
 
開發者ID:avluis,項目名稱:Hentoid,代碼行數:22,代碼來源:BaseWebActivity.java

示例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();
}
 
開發者ID:Horrarndoo,項目名稱:YiZhi,代碼行數:14,代碼來源:BaseWebViewLoadActivity.java

示例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);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:28,代碼來源:InviteWebviewimpl.java

示例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();
}
 
開發者ID:joy-inc,項目名稱:core-web,代碼行數:36,代碼來源:BaseWebViewPresenter.java

示例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);
}
 
開發者ID:joy-inc,項目名稱:core-web,代碼行數:35,代碼來源:BaseWebViewPresenter.java

示例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();
        }
    }
 
開發者ID:joy-inc,項目名稱:joy-app,代碼行數:35,代碼來源:WebViewActivity.java

示例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);
	}
}
 
開發者ID:restorer,項目名稱:gloomy-dungeons-2,代碼行數:40,代碼來源:GeneralWebActivity.java

示例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();
	}
}
 
開發者ID:lyshie,項目名稱:nthu-cis,代碼行數:31,代碼來源:MailingListActivity.java

示例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();
	}
}
 
開發者ID:lyshie,項目名稱:nthu-cis,代碼行數:31,代碼來源:EDocActivity.java


注:本文中的android.webkit.WebBackForwardList.getCurrentIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。