Search in sources :

Example 1 with ListItemAttachmentAdapter

use of ve.com.abicelis.remindy.app.adapters.ListItemAttachmentAdapter in project Remindy by abicelis.

the class ListAttachmentViewHolder method setUpRecyclerView.

private void setUpRecyclerView() {
    List<ListItemAttachment> items = mCurrent.getItems();
    if (//If no items or last item of list isn't blank, add a blank item
    items.size() == 0 || items.get(items.size() - 1).getText() != null)
        items.add(new ListItemAttachment());
    mLayoutManager = new LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false);
    mListItemAdapter = new ListItemAttachmentAdapter(mActivity, items, mRealTimeDataPersistence);
    mListItemAdapter.setAttachmentDataUpdatedListener(new ListItemAttachmentAdapter.AttachmentDataUpdatedListener() {

        @Override
        public void onAttachmentDataUpdated() {
            mAttachmentAdapter.triggerAttachmentDataUpdatedListener();
        }
    });
    DividerItemDecoration itemDecoration = new DividerItemDecoration(mActivity, mLayoutManager.getOrientation());
    itemDecoration.setDrawable(ContextCompat.getDrawable(mActivity, R.drawable.item_decoration_complete_line));
    mRecyclerView.setNestedScrollingEnabled(false);
    mRecyclerView.addItemDecoration(itemDecoration);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mListItemAdapter);
}
Also used : ListItemAttachmentAdapter(ve.com.abicelis.remindy.app.adapters.ListItemAttachmentAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ListItemAttachment(ve.com.abicelis.remindy.model.attachment.ListItemAttachment)

Aggregations

DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 ListItemAttachmentAdapter (ve.com.abicelis.remindy.app.adapters.ListItemAttachmentAdapter)1 ListItemAttachment (ve.com.abicelis.remindy.model.attachment.ListItemAttachment)1