Search in sources :

Example 1 with ToolbarScrollingKiwixWebView

use of org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView in project kiwix-android by kiwix.

the class KiwixMobileActivity method selectTab.

private void selectTab(int position) {
    currentWebViewIndex = position;
    tabDrawerAdapter.setSelected(position);
    contentFrame.removeAllViews();
    KiwixWebView webView = mWebViews.get(position);
    contentFrame.addView(webView);
    tabDrawerAdapter.setSelected(currentWebViewIndex);
    if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
        new Handler().postDelayed(() -> drawerLayout.closeDrawers(), 150);
    }
    loadPrefs();
    if (menu != null) {
        refreshBookmarkSymbol(menu);
    }
    updateTableOfContents();
    if (!isHideToolbar) {
        ((ToolbarScrollingKiwixWebView) webView).ensureToolbarDisplayed();
    }
}
Also used : ToolbarScrollingKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView) KiwixWebView(org.kiwix.kiwixmobile.views.web.KiwixWebView) ToolbarStaticKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarStaticKiwixWebView) ToolbarScrollingKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView) Handler(android.os.Handler)

Example 2 with ToolbarScrollingKiwixWebView

use of org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView in project kiwix-android by kiwix.

the class KiwixMobileActivity method getWebView.

private KiwixWebView getWebView(String url) {
    AttributeSet attrs = StyleUtils.getAttributes(this, R.xml.webview);
    KiwixWebView webView;
    if (!isHideToolbar) {
        webView = new ToolbarScrollingKiwixWebView(KiwixMobileActivity.this, this, toolbarContainer, pageBottomTabLayout, attrs);
        ((ToolbarScrollingKiwixWebView) webView).setOnToolbarVisibilityChangeListener(new ToolbarScrollingKiwixWebView.OnToolbarVisibilityChangeListener() {

            @Override
            public void onToolbarDisplayed() {
                shrinkDrawers();
            }

            @Override
            public void onToolbarHidden() {
                expandDrawers();
            }
        });
    } else {
        webView = new ToolbarStaticKiwixWebView(KiwixMobileActivity.this, this, toolbarContainer, attrs);
    }
    webView.loadUrl(url);
    webView.loadPrefs();
    return webView;
}
Also used : ToolbarScrollingKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView) KiwixWebView(org.kiwix.kiwixmobile.views.web.KiwixWebView) ToolbarStaticKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarStaticKiwixWebView) ToolbarStaticKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarStaticKiwixWebView) AttributeSet(android.util.AttributeSet) ToolbarScrollingKiwixWebView(org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView)

Aggregations

KiwixWebView (org.kiwix.kiwixmobile.views.web.KiwixWebView)2 ToolbarScrollingKiwixWebView (org.kiwix.kiwixmobile.views.web.ToolbarScrollingKiwixWebView)2 ToolbarStaticKiwixWebView (org.kiwix.kiwixmobile.views.web.ToolbarStaticKiwixWebView)2 Handler (android.os.Handler)1 AttributeSet (android.util.AttributeSet)1