Search in sources :

Example 1 with GroupAdapter

use of com.genius.groupie.GroupAdapter in project philm by chrisbanes.

the class MovieDetailFragment method populateUi.

private void populateUi() {
    if (mMovie == null) {
        return;
    }
    if (mBackdropImageView != null) {
        if (mMovie.hasBackdropUrl()) {
            mBackdropImageView.loadBackdrop(mMovie);
        }
    }
    if (mCollapsingToolbarLayout != null) {
        mCollapsingToolbarLayout.setTitle(mMovie.getTitle());
    }
    mAdapter = new GroupAdapter();
    mAdapter.add(new TitleItem());
    mAdapter.add(new ButtonsItem());
    if (!TextUtils.isEmpty(mMovie.getOverview())) {
        mAdapter.add(new SummaryItem());
    }
    mAdapter.add(new RatingItem());
    mAdapter.add(new DetailsGroup());
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getTrailers())) {
    //            mItems.add(DetailItemType.TRAILERS);
    //        }
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getCast())) {
    //            mItems.add(DetailItemType.CAST);
    //        }
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getCrew())) {
    //            mItems.add(DetailItemType.CREW);
    //        }
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getRelated())) {
    //            mItems.add(DetailItemType.RELATED);
    //        }
    GridLayoutManager layoutManager = new GridLayoutManager(getContext(), mAdapter.getSpanCount());
    layoutManager.setSpanSizeLookup(mAdapter.getSpanSizeLookup());
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setAdapter(mAdapter);
}
Also used : GroupAdapter(com.genius.groupie.GroupAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 GroupAdapter (com.genius.groupie.GroupAdapter)1