android.webkit.WebHistoryItem Java Examples

The following examples show how to use android.webkit.WebHistoryItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientWebView.java    From habpanelviewer with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: ClientWebView.java    From habpanelviewer with GNU General Public License v3.0 6 votes vote down vote up
@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;
            }
        }
    }
}
 
Example #3
Source File: JavascriptEvaluation.java    From android-test with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: CordovaWebView.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
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;
}
 
Example #5
Source File: CordovaWebView.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #6
Source File: CordovaWebView.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
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 );
    }
}
 
Example #7
Source File: CordovaWebView.java    From wildfly-samples with MIT License 5 votes vote down vote up
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;
}
 
Example #8
Source File: CordovaWebView.java    From wildfly-samples with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #9
Source File: CordovaWebView.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
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;
}
 
Example #10
Source File: CordovaWebView.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #11
Source File: CordovaWebView.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
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;
}
 
Example #12
Source File: CordovaWebView.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #13
Source File: CordovaWebView.java    From reader with MIT License 5 votes vote down vote up
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;
}
 
Example #14
Source File: CordovaWebView.java    From reader with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #15
Source File: CordovaWebView.java    From reader with MIT License 5 votes vote down vote up
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;
}
 
Example #16
Source File: CordovaWebView.java    From reader with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #17
Source File: DappBrowserFragment.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
/**
 * 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());
        }
    }
}
 
Example #18
Source File: CordovaWebView.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #19
Source File: BaseWebActivity.java    From Hentoid with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source File: CordovaWebView.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
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;
}
 
Example #21
Source File: CordovaWebView.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #22
Source File: CordovaWebView.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
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;
}
 
Example #23
Source File: CordovaWebView.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
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 );
    }
}
 
Example #24
Source File: FirstActivity3.java    From YCWebView with Apache License 2.0 5 votes vote down vote up
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());
    }
}
 
Example #25
Source File: FirstActivity1.java    From YCWebView with Apache License 2.0 5 votes vote down vote up
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());
    }
}
 
Example #26
Source File: FirstActivity2.java    From YCWebView with Apache License 2.0 5 votes vote down vote up
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());
    }
}
 
Example #27
Source File: DoubleViewTubiPlayerActivity.java    From TubiPlayer with MIT License 4 votes vote down vote up
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;
    }