当前位置: 首页>>代码示例>>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;未经允许,请勿转载。