Search in sources :

Example 6 with WebBackForwardList

use of android.webkit.WebBackForwardList in project phonegap-facebook-plugin by Wizcorp.

the class CordovaWebView method printBackForwardList.

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);
    }
}
Also used : WebHistoryItem(android.webkit.WebHistoryItem) WebBackForwardList(android.webkit.WebBackForwardList) SuppressLint(android.annotation.SuppressLint)

Example 7 with WebBackForwardList

use of android.webkit.WebBackForwardList in project phonegap-facebook-plugin by Wizcorp.

the class CordovaWebView method restoreState.

public WebBackForwardList restoreState(Bundle savedInstanceState) {
    WebBackForwardList myList = super.restoreState(savedInstanceState);
    Log.d(TAG, "WebView restoration crew now restoring!");
    // Initialize the plugin manager once more
    this.pluginManager.init();
    return myList;
}
Also used : WebBackForwardList(android.webkit.WebBackForwardList)

Example 8 with WebBackForwardList

use of android.webkit.WebBackForwardList in project Rocket by mozilla-tw.

the class BrowserFragment method goBack.

public void goBack() {
    final TabView current = tabsSession.getFocusTab().getTabView();
    if (current != null) {
        WebBackForwardList webBackForwardList = ((WebView) current).copyBackForwardList();
        WebHistoryItem item = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() - 1);
        updateURL(item.getUrl());
        current.goBack();
    }
}
Also used : WebHistoryItem(android.webkit.WebHistoryItem) TabView(org.mozilla.focus.tabs.TabView) WebView(android.webkit.WebView) WebBackForwardList(android.webkit.WebBackForwardList)

Example 9 with WebBackForwardList

use of android.webkit.WebBackForwardList in project Rocket by mozilla-tw.

the class BrowserFragment method goForward.

public void goForward() {
    final TabView current = tabsSession.getFocusTab().getTabView();
    if (current != null) {
        WebBackForwardList webBackForwardList = ((WebView) current).copyBackForwardList();
        WebHistoryItem item = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() + 1);
        updateURL(item.getUrl());
        current.goForward();
    }
}
Also used : WebHistoryItem(android.webkit.WebHistoryItem) TabView(org.mozilla.focus.tabs.TabView) WebView(android.webkit.WebView) WebBackForwardList(android.webkit.WebBackForwardList)

Example 10 with WebBackForwardList

use of android.webkit.WebBackForwardList in project focus-android by mozilla-mobile.

the class SystemWebView method restoreWebViewState.

@Override
public void restoreWebViewState(Session session) {
    final Bundle stateData = session.getWebViewState();
    final WebBackForwardList backForwardList = stateData != null ? super.restoreState(stateData) : null;
    final String desiredURL = session.getUrl().getValue();
    client.restoreState(stateData);
    client.notifyCurrentURL(desiredURL);
    if (backForwardList != null && backForwardList.getCurrentItem().getUrl().equals(desiredURL)) {
        // restoreState doesn't actually load the current page, it just restores navigation history,
        // so we also need to explicitly reload in this case:
        reload();
    } else {
        loadUrl(desiredURL);
    }
}
Also used : Bundle(android.os.Bundle) WebBackForwardList(android.webkit.WebBackForwardList)

Aggregations

WebBackForwardList (android.webkit.WebBackForwardList)19 Test (org.junit.Test)10 WebHistoryItem (android.webkit.WebHistoryItem)7 Bundle (android.os.Bundle)6 WebView (android.webkit.WebView)5 SuppressLint (android.annotation.SuppressLint)2 TabView (org.mozilla.focus.tabs.TabView)2