类android.webkit.WebHistoryItem源码实例Demo

下面列出了怎么用android.webkit.WebHistoryItem的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: habpanelviewer   文件: ClientWebView.java
@Override
public boolean canGoBackOrForward(int 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);

        if (!item.getOriginalUrl().startsWith("data:")) {
            count += increment;

            if (count == steps) {
                return true;
            }
        }
    }

    return false;
}
 
源代码2 项目: habpanelviewer   文件: ClientWebView.java
@Override
public void goBackOrForward(int 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);

        if (!item.getOriginalUrl().startsWith("data:")) {
            count += increment;

            if (count == steps) {
                super.goBackOrForward(intCount);
                return;
            }
        }
    }
}
 
源代码3 项目: android-test   文件: JavascriptEvaluation.java
private boolean isWebViewSane() {
  String url = unprepared.view.getUrl();
  WebHistoryItem current = unprepared.view.copyBackForwardList().getCurrentItem();
  boolean getUrlReady = url != null;
  boolean webHistoryReady = current != null;

  if (getUrlReady && webHistoryReady) {
    String historyUrl = current.getUrl();
    boolean viewAndHistoryMatch = urlAndHistoryUrlMatch(url, historyUrl);
    boolean nonZeroContentHeight = unprepared.view.getContentHeight() != 0;
    boolean progressComplete = unprepared.view.getProgress() == 100;
    sanityMessage =
        String.format(
            "viewAndHistoryUrlsMatch: %s, nonZeroContentHeight: %s, progressComplete: %s",
            viewAndHistoryMatch, nonZeroContentHeight, progressComplete);
    return viewAndHistoryMatch && progressComplete && nonZeroContentHeight;
  } else {
    sanityMessage =
        String.format(
            "view.getUrl() != null: %s view.copyBackForwardList().getCurrentItem() != null: %s",
            getUrlReady, webHistoryReady);
  }
  return false;
}
 
/**
 * Browse to relative entry with sanity check on value
 * @param relative relative addition or subtraction of browsing index
 */
private void loadSessionUrl(int relative)
{
    WebBackForwardList sessionHistory = web3.copyBackForwardList();
    int newIndex = sessionHistory.getCurrentIndex() + relative;
    if (newIndex < sessionHistory.getSize())
    {
        WebHistoryItem newItem = sessionHistory.getItemAtIndex(newIndex);
        if (newItem != null)
        {
            urlTv.setText(newItem.getUrl());
        }
    }
}
 
源代码5 项目: YCWebView   文件: FirstActivity2.java
private void getWebTitle(WebView view){
    WebBackForwardList forwardList = view.copyBackForwardList();
    WebHistoryItem item = forwardList.getCurrentItem();
    if (item != null) {
        tvTitle.setText(item.getTitle());
       // X5LogUtils.i("-------onReceivedTitle----getWebTitle---"+item.getTitle());
    }
}
 
源代码6 项目: YCWebView   文件: FirstActivity1.java
private void getWebTitle(WebView view){
    WebBackForwardList forwardList = view.copyBackForwardList();
    WebHistoryItem item = forwardList.getCurrentItem();
    if (item != null) {
        tvTitle.setText(item.getTitle());
       // X5LogUtils.i("-------onReceivedTitle----getWebTitle---"+item.getTitle());
    }
}
 
源代码7 项目: YCWebView   文件: FirstActivity3.java
private void getWebTitle(WebView view){
    WebBackForwardList forwardList = view.copyBackForwardList();
    WebHistoryItem item = forwardList.getCurrentItem();
    if (item != null) {
        tvTitle.setText(item.getTitle());
       // X5LogUtils.i("-------onReceivedTitle----getWebTitle---"+item.getTitle());
    }
}
 
源代码8 项目: L.TileLayer.Cordova   文件: CordovaWebView.java
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 );
    }
}
 
源代码9 项目: L.TileLayer.Cordova   文件: CordovaWebView.java
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;
}
 
源代码10 项目: IoTgo_Android_App   文件: CordovaWebView.java
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 );
    }
}
 
源代码11 项目: IoTgo_Android_App   文件: CordovaWebView.java
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;
}
 
源代码12 项目: Hentoid   文件: BaseWebActivity.java
/**
 * Indicate if the browser's back list contains a book gallery
 * Used to determine the display of the "back to latest gallery" button
 *
 * @param backForwardList Back list to examine
 * @return Index of the latest book gallery in the list; -1 if none has been detected
 */
private int backListContainsGallery(@NonNull final WebBackForwardList backForwardList) {
    for (int i = backForwardList.getCurrentIndex() - 1; i >= 0; i--) {
        WebHistoryItem item = backForwardList.getItemAtIndex(i);
        if (webClient.isBookGallery(item.getUrl())) return i;
    }
    return -1;
}
 
源代码13 项目: bluemix-parking-meter   文件: CordovaWebView.java
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 );
    }
}
 
源代码14 项目: bluemix-parking-meter   文件: CordovaWebView.java
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;
}
 
源代码15 项目: reader   文件: CordovaWebView.java
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 );
    }
}
 
源代码16 项目: reader   文件: CordovaWebView.java
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;
}
 
源代码17 项目: reader   文件: CordovaWebView.java
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 );
    }
}
 
源代码18 项目: reader   文件: CordovaWebView.java
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;
}
 
源代码19 项目: phonegapbootcampsite   文件: CordovaWebView.java
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 );
    }
}
 
源代码20 项目: phonegapbootcampsite   文件: CordovaWebView.java
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;
}
 
源代码21 项目: CordovaYoutubeVideoPlayer   文件: CordovaWebView.java
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 );
    }
}
 
源代码22 项目: CordovaYoutubeVideoPlayer   文件: CordovaWebView.java
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;
}
 
源代码23 项目: wildfly-samples   文件: CordovaWebView.java
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 );
    }
}
 
源代码24 项目: wildfly-samples   文件: CordovaWebView.java
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;
}
 
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 );
    }
}
 
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;
}
 
源代码27 项目: TubiPlayer   文件: DoubleViewTubiPlayerActivity.java
private boolean ingoreWebViewBackNavigation(WebView vpaidWebView) {

        if (vpaidWebView != null) {
            WebBackForwardList mWebBackForwardList = vpaidWebView.copyBackForwardList();

            if (mWebBackForwardList == null) {
                return false;
            }

            WebHistoryItem historyItem = mWebBackForwardList.getItemAtIndex(mWebBackForwardList.getCurrentIndex() - 1);

            if (historyItem == null) {
                return false;
            }

            String historyUrl = historyItem.getUrl();

            if (historyUrl != null && historyUrl.equalsIgnoreCase(VpaidClient.EMPTY_URL)) {

                return true;
            }
        }

        return false;
    }