use of org.wikipedia.edit.EditHandler in project apps-android-wikipedia by wikimedia.
the class PageFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
if (callback() != null) {
callback().onPageInitWebView(webView);
}
updateFontSize();
// Explicitly set background color of the WebView (independently of CSS, because
// the background may be shown momentarily while the WebView loads content,
// creating a seizure-inducing effect, or at the very least, a migraine with aura).
webView.setBackgroundColor(getThemedColor(getActivity(), R.attr.paper_color));
bridge = new CommunicationBridge(webView, "file:///android_asset/index.html");
setupMessageHandlers();
sendDecorOffsetMessage();
if (!app.getCurrentTheme().isDefault()) {
ThemeBridgeAdapter.setTheme(bridge);
}
errorView.setRetryClickListener((v) -> refreshPage());
errorView.setBackClickListener((v) -> {
boolean back = onBackPressed();
// Needed if we're coming from another activity or fragment
if (!back && callback() != null) {
// noinspection ConstantConditions
callback().onPageLoadErrorBackPressed();
}
});
editHandler = new EditHandler(this, bridge);
pageFragmentLoadState.setEditHandler(editHandler);
tocHandler = new ToCHandler(this, tocDrawer, bridge);
// TODO: initialize View references in onCreateView().
leadImagesHandler = new LeadImagesHandler(this, bridge, webView, getView().findViewById(R.id.page_header_view));
bottomContentView.setup(this, bridge, webView);
shareHandler = new ShareHandler(this, bridge);
tabsProvider = new TabsProvider(this, tabList);
tabsProvider.setTabsProviderListener(tabsProviderListener);
if (callback() != null) {
LongPressHandler.WebViewContextMenuListener contextMenuListener = new PageContainerLongPressHandler(this);
new LongPressHandler(webView, HistoryEntry.SOURCE_INTERNAL_LINK, contextMenuListener);
}
pageFragmentLoadState.setUp(model, this, refreshView, webView, bridge, leadImagesHandler, getCurrentTab().getBackStack());
if (shouldLoadFromBackstack(getActivity()) || savedInstanceState != null) {
if (!pageFragmentLoadState.backStackEmpty()) {
pageFragmentLoadState.loadFromBackStack();
} else {
loadMainPageInForegroundTab();
}
}
if (shouldShowTabList(getActivity())) {
showTabList();
}
}
Aggregations