Search in sources :

Example 1 with DividerItemDecoration

use of get.saga.ui.DividerItemDecoration in project saga-android by AnandChowdhary.

the class LibraryFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_library, container, false);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setHasFixedSize(true);
    final SwipeRefreshLayout refresh = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeRefreshLayout);
    refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            songList.clear();
            getSongList();
            mRecyclerView.getAdapter().notifyDataSetChanged();
            refresh.setRefreshing(false);
        }
    });
    mAdapter = new LibraryAdapter();
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}
Also used : DividerItemDecoration(get.saga.ui.DividerItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 DividerItemDecoration (get.saga.ui.DividerItemDecoration)1