Search in sources :

Example 1 with TagViewRecyclerViewAdapter

use of com.nightonke.saver.adapter.TagViewRecyclerViewAdapter in project CoCoin by Nightonke.

the class TagViewFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setHasFixedSize(true);
    if (position == 0) {
        for (CoCoinRecord coCoinRecord : RecordManager.RECORDS) {
            list.add(coCoinRecord);
        }
    }
    if (position == 1) {
        for (CoCoinRecord coCoinRecord : RecordManager.RECORDS) {
            list.add(coCoinRecord);
        }
    } else {
        for (CoCoinRecord coCoinRecord : RecordManager.RECORDS) {
            if (coCoinRecord.getTag() == RecordManager.TAGS.get(position).getId()) {
                list.add(coCoinRecord);
            }
        }
    }
    mAdapter = new RecyclerViewMaterialAdapter(new TagViewRecyclerViewAdapter(list, mContext, position));
    mRecyclerView.setAdapter(mAdapter);
    MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
Also used : TagViewRecyclerViewAdapter(com.nightonke.saver.adapter.TagViewRecyclerViewAdapter) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerViewMaterialAdapter(com.github.florent37.materialviewpager.adapter.RecyclerViewMaterialAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CoCoinRecord(com.nightonke.saver.model.CoCoinRecord)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 RecyclerViewMaterialAdapter (com.github.florent37.materialviewpager.adapter.RecyclerViewMaterialAdapter)1 TagViewRecyclerViewAdapter (com.nightonke.saver.adapter.TagViewRecyclerViewAdapter)1 CoCoinRecord (com.nightonke.saver.model.CoCoinRecord)1