Search in sources :

Example 1 with ListViewContextMenuListener

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();
}
Also used : PageContainerLongPressHandler(org.wikipedia.page.PageContainerLongPressHandler) ListViewContextMenuListener(org.wikipedia.LongPressHandler.ListViewContextMenuListener) PageTitle(org.wikipedia.page.PageTitle) HistoryEntry(org.wikipedia.history.HistoryEntry) AdapterView(android.widget.AdapterView) ConfigurableTextView(org.wikipedia.views.ConfigurableTextView) LinearLayoutOverWebView(org.wikipedia.views.LinearLayoutOverWebView) BindView(butterknife.BindView) GoneIfEmptyTextView(org.wikipedia.views.GoneIfEmptyTextView) View(android.view.View) AdapterView(android.widget.AdapterView) WebView(android.webkit.WebView) TextView(android.widget.TextView) ListView(android.widget.ListView) ObservableWebView(org.wikipedia.views.ObservableWebView)

Aggregations

View (android.view.View)1 WebView (android.webkit.WebView)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 ListViewContextMenuListener (org.wikipedia.LongPressHandler.ListViewContextMenuListener)1 HistoryEntry (org.wikipedia.history.HistoryEntry)1 PageContainerLongPressHandler (org.wikipedia.page.PageContainerLongPressHandler)1 PageTitle (org.wikipedia.page.PageTitle)1 ConfigurableTextView (org.wikipedia.views.ConfigurableTextView)1 GoneIfEmptyTextView (org.wikipedia.views.GoneIfEmptyTextView)1 LinearLayoutOverWebView (org.wikipedia.views.LinearLayoutOverWebView)1 ObservableWebView (org.wikipedia.views.ObservableWebView)1