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;
}
Aggregations