Search in sources :

Example 1 with AgendaListViewAdapter

use of com.orgzly.android.ui.AgendaListViewAdapter in project orgzly-android by orgzly.

the class AgendaFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    if (BuildConfig.LOG_DEBUG)
        LogUtils.d(TAG, view, savedInstanceState);
    super.onViewCreated(view, savedInstanceState);
    /* On long click */
    getListView().setOnItemLongClickListener((parent, view1, position, id) -> {
        if (mListAdapter != null && mListAdapter.getItemViewType(position) != AgendaListViewAdapter.DIVIDER_VIEW_TYPE) {
            mListener.onNoteLongClick(AgendaFragment.this, view1, position, id, originalNoteIDs.get(id).getNoteId());
        }
        return true;
    });
    getListView().setOnItemMenuButtonClickListener((itemView, buttonId, noteId) -> onButtonClick(mListener, itemView, buttonId, originalNoteIDs.get(noteId).getNoteId()));
    /* Create a selection. */
    mSelection = new Selection();
    mListAdapter = new AgendaListViewAdapter(getActivity(), mSelection, getListView().getItemMenus(), false);
    setListAdapter(mListAdapter);
    /*
         * Restore selected items, now that adapter is set.
         * Saved with {@link Selection#saveSelectedIds(android.os.Bundle, String)}.
         */
    mSelection.restoreIds(savedInstanceState);
}
Also used : AgendaListViewAdapter(com.orgzly.android.ui.AgendaListViewAdapter) Selection(com.orgzly.android.ui.Selection)

Aggregations

AgendaListViewAdapter (com.orgzly.android.ui.AgendaListViewAdapter)1 Selection (com.orgzly.android.ui.Selection)1