use of com.byoutline.kickmaterial.adapters.ProjectsAdapter in project kickmaterial by byoutline.
the class ProjectsListFragment method setUpAdapters.
private void setUpAdapters() {
/** NEW ADAPTER **/
layoutManager = new GridLayoutManager(getActivity(), 2);
final boolean showHeader = sharedPreferences.getBoolean(PREFS_SHOW_HEADER, true);
// TODO: decide when to hide it.
sharedPreferences.edit().putBoolean(PREFS_SHOW_HEADER, false).apply();
final ProjectsAdapter.ItemViewTypeProvider itemViewTypeProvider = new ProjectsAdapter.ItemViewTypeProvider(showHeader);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (itemViewTypeProvider.getViewType(position) == ProjectsAdapter.NORMAL_ITEM) {
return 1;
}
return 2;
}
});
projectListRv.setEndlessScrollListener(this);
projectListRv.setLayoutManager(layoutManager);
adapter = new ProjectsAdapter(getActivity(), this, showHeader, itemViewTypeProvider);
projectListRv.setAdapter(adapter);
}
Aggregations