Search in sources :

Example 6 with TabView

use of org.mozilla.focus.tabs.TabView in project Rocket by mozilla-tw.

the class BrowserFragment method capturePage.

public boolean capturePage(@NonNull ScreenshotCallback callback) {
    final TabView current = tabsSession.getFocusTab().getTabView();
    // Failed to get WebView
    if (current == null || !(current instanceof WebView)) {
        return false;
    }
    WebView webView = (WebView) current;
    Bitmap content = getPageBitmap(webView);
    // Failed to capture
    if (content == null) {
        return false;
    }
    callback.onCaptureComplete(current.getTitle(), current.getUrl(), content);
    return true;
}
Also used : Bitmap(android.graphics.Bitmap) TabView(org.mozilla.focus.tabs.TabView) WebView(android.webkit.WebView)

Example 7 with TabView

use of org.mozilla.focus.tabs.TabView 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)

Aggregations

TabView (org.mozilla.focus.tabs.TabView)7 WebView (android.webkit.WebView)4 View (android.view.View)2 WebBackForwardList (android.webkit.WebBackForwardList)2 WebHistoryItem (android.webkit.WebHistoryItem)2 Bitmap (android.graphics.Bitmap)1 TabViewClient (org.mozilla.focus.tabs.TabViewClient)1