Search in sources :

Example 1 with SpanSizeLookup

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;
}
Also used : SpanSizeLookup(com.simplecityapps.recycler_adapter.recyclerview.SpanSizeLookup) GridLayoutManager(android.support.v7.widget.GridLayoutManager) GridDividerDecoration(com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) Nullable(android.support.annotation.Nullable)

Example 2 with SpanSizeLookup

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;
}
Also used : SpanSizeLookup(com.simplecityapps.recycler_adapter.recyclerview.SpanSizeLookup) GridLayoutManager(android.support.v7.widget.GridLayoutManager) GridDividerDecoration(com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration) RecyclerListener(com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener) ShuffleView(com.simplecity.amp_library.ui.modelviews.ShuffleView) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 GridDividerDecoration (com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration)2 RecyclerListener (com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener)2 SpanSizeLookup (com.simplecityapps.recycler_adapter.recyclerview.SpanSizeLookup)2 SuppressLint (android.annotation.SuppressLint)1 Nullable (android.support.annotation.Nullable)1 ShuffleView (com.simplecity.amp_library.ui.modelviews.ShuffleView)1