use of org.wikipedia.LongPressHandler.ListViewContextMenuListener in project apps-android-wikipedia by wikimedia.
the class BottomContentView method setup.
public void setup(PageFragment parentFragment, CommunicationBridge bridge, ObservableWebView webview) {
this.parentFragment = parentFragment;
this.webView = webview;
this.bridge = bridge;
setWebView(webview);
webview.addOnScrollChangeListener(this);
webview.addOnContentHeightChangedListener(this);
pageExternalLink.setPaintFlags(pageExternalLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
if (parentFragment.callback() != null) {
ListViewContextMenuListener contextMenuListener = new LongPressHandler(parentFragment);
new org.wikipedia.LongPressHandler(readMoreList, HistoryEntry.SOURCE_INTERNAL_LINK, contextMenuListener);
}
addOnLayoutChangeListener((View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) -> {
if (prevLayoutHeight == getHeight()) {
return;
}
prevLayoutHeight = getHeight();
padWebView();
});
readMoreList.setAdapter(readMoreAdapter);
readMoreList.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
PageTitle title = readMoreAdapter.getItem(position).getPageTitle();
HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK);
parentFragment.loadPage(title, historyEntry);
funnel.logSuggestionClicked(page.getTitle(), readMoreItems.getResults(), position);
});
// hide ourselves by default
hide();
}
Aggregations