use of com.simplecityapps.recycler_adapter.recyclerview.SpanSizeLookup in project Shuttle by timusus.
the class AlbumArtistFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (recyclerView == null) {
int spanCount = SettingsManager.getInstance().getArtistColumnCount(getResources());
layoutManager = new GridLayoutManager(getContext(), spanCount);
spanSizeLookup = new SpanSizeLookup(adapter, spanCount);
spanSizeLookup.setSpanIndexCacheEnabled(true);
layoutManager.setSpanSizeLookup(spanSizeLookup);
recyclerView = (FastScrollRecyclerView) inflater.inflate(R.layout.fragment_recycler, container, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new GridDividerDecoration(getResources(), 4, true));
recyclerView.setRecyclerListener(new RecyclerListener());
}
if (recyclerView.getAdapter() != adapter) {
recyclerView.setAdapter(adapter);
}
return recyclerView;
}
use of com.simplecityapps.recycler_adapter.recyclerview.SpanSizeLookup in project Shuttle by timusus.
the class AlbumFragment method onCreateView.
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (recyclerView == null) {
int spanCount = SettingsManager.getInstance().getAlbumColumnCount(getResources());
layoutManager = new GridLayoutManager(getContext(), spanCount);
spanSizeLookup = new SpanSizeLookup(adapter, spanCount);
spanSizeLookup.setSpanIndexCacheEnabled(true);
layoutManager.setSpanSizeLookup(spanSizeLookup);
recyclerView = (FastScrollRecyclerView) inflater.inflate(R.layout.fragment_recycler, container, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new GridDividerDecoration(getResources(), 4, true));
recyclerView.setRecyclerListener(new RecyclerListener());
}
if (recyclerView.getAdapter() != adapter) {
recyclerView.setAdapter(adapter);
}
shuffleView = new ShuffleView();
shuffleView.setTitleResId(R.string.shuffle_albums);
shuffleView.setClickListener(this);
return recyclerView;
}
Aggregations