Search in sources :

Example 1 with GridDividerDecoration

use of com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration 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);
        layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

            @Override
            public int getSpanSize(int position) {
                if (albumArtistAdapter.items.get(position) instanceof EmptyView) {
                    return spanCount;
                }
                return 1;
            }
        });
        recyclerView = (FastScrollRecyclerView) inflater.inflate(R.layout.fragment_recycler, container, false);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.addItemDecoration(new GridDividerDecoration(getResources(), 4, true));
        recyclerView.setRecyclerListener(this);
        recyclerView.setAdapter(albumArtistAdapter);
        actionMode = null;
        themeUIComponents();
    }
    return recyclerView;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) GridDividerDecoration(com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration) EmptyView(com.simplecity.amp_library.ui.modelviews.EmptyView) Nullable(android.support.annotation.Nullable)

Example 2 with GridDividerDecoration

use of com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration 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);
        layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

            @Override
            public int getSpanSize(int position) {
                if (albumAdapter.items.get(position) instanceof EmptyView) {
                    return spanCount;
                }
                return 1;
            }
        });
        recyclerView = (FastScrollRecyclerView) inflater.inflate(R.layout.fragment_recycler, container, false);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.addItemDecoration(new GridDividerDecoration(getResources(), 4, true));
        recyclerView.setRecyclerListener(this);
        recyclerView.setAdapter(albumAdapter);
        actionMode = null;
        themeUIComponents();
    }
    return recyclerView;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) GridDividerDecoration(com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration) EmptyView(com.simplecity.amp_library.ui.modelviews.EmptyView) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 3 with GridDividerDecoration

use of com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration in project Shuttle by timusus.

the class GenreFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mRecyclerView == null) {
        mRecyclerView = (FastScrollRecyclerView) inflater.inflate(R.layout.fragment_recycler, container, false);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        mRecyclerView.addItemDecoration(new GridDividerDecoration(getResources(), 4, true));
        mRecyclerView.setRecyclerListener(this);
        mRecyclerView.setAdapter(genreAdapter);
        themeUIComponents();
    }
    return mRecyclerView;
}
Also used : GridDividerDecoration(com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

GridDividerDecoration (com.simplecity.amp_library.ui.recyclerview.GridDividerDecoration)3 GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 EmptyView (com.simplecity.amp_library.ui.modelviews.EmptyView)2 SuppressLint (android.annotation.SuppressLint)1 Nullable (android.support.annotation.Nullable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1