Search in sources :

Example 1 with NotesAdapter

use of com.lguipeng.notes.adpater.NotesAdapter in project Notes by lguipeng.

the class MainActivity method initRecyclerView.

@Override
public void initRecyclerView(List<SNote> notes) {
    recyclerAdapter = new NotesAdapter(notes, this);
    recyclerView.setHasFixedSize(true);
    recyclerAdapter.setOnInViewClickListener(R.id.notes_item_root, new BaseRecyclerViewAdapter.onInternalClickListenerImpl<SNote>() {

        @Override
        public void OnClickListener(View parentV, View v, Integer position, SNote values) {
            super.OnClickListener(parentV, v, position, values);
            mainPresenter.onRecyclerViewItemClick(position, values);
        }
    });
    recyclerAdapter.setOnInViewClickListener(R.id.note_more, new BaseRecyclerViewAdapter.onInternalClickListenerImpl<SNote>() {

        @Override
        public void OnClickListener(View parentV, View v, Integer position, SNote values) {
            super.OnClickListener(parentV, v, position, values);
            mainPresenter.showPopMenu(v, position, values);
        }
    });
    recyclerAdapter.setFirstOnly(false);
    recyclerAdapter.setDuration(300);
    recyclerView.setAdapter(recyclerAdapter);
    refreshLayout.setColorSchemeColors(getColorPrimary());
    refreshLayout.setOnRefreshListener(mainPresenter);
}
Also used : NotesAdapter(com.lguipeng.notes.adpater.NotesAdapter) SNote(com.lguipeng.notes.model.SNote) BaseRecyclerViewAdapter(com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) MainView(com.lguipeng.notes.mvp.views.impl.MainView) RecyclerView(android.support.v7.widget.RecyclerView) ListView(android.widget.ListView)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 SearchView (android.support.v7.widget.SearchView)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 NotesAdapter (com.lguipeng.notes.adpater.NotesAdapter)1 BaseRecyclerViewAdapter (com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter)1 SNote (com.lguipeng.notes.model.SNote)1 MainView (com.lguipeng.notes.mvp.views.impl.MainView)1