android.support.v17.leanback.widget.OnActionClickedListener Java Examples

The following examples show how to use android.support.v17.leanback.widget.OnActionClickedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LiveDataDetailFragmentUiModule.java    From leanback-showcase with Apache License 2.0 6 votes vote down vote up
@Provides
@PerFragment
public FullWidthDetailsOverviewSharedElementHelper provideHelper(Activity activity,
        PresenterSelector mPs, DetailsOverviewRow row, OnActionClickedListener listener) {
    FullWidthDetailsOverviewSharedElementHelper mHelper =
            new FullWidthDetailsOverviewSharedElementHelper();
    mHelper.setSharedElementEnterTransition(activity,
            LiveDataDetailActivity.SHARED_ELEMENT_NAME);

    ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row))
            .setListener(mHelper);
    ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row))
            .setParticipatingEntranceTransition(false);
    ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row))
            .setOnActionClickedListener(listener);
    return mHelper;

}
 
Example #2
Source File: MovieDetailsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
private void setupDetailsOverviewRowPresenter() {
    // Set detail background and style.
    DetailsOverviewRowPresenter detailsPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
    detailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background));
    detailsPresenter.setStyleLarge(true);

    // Hook up transition element.
    detailsPresenter.setSharedElementEnterTransition(getActivity(),
            MovieDetailsActivity.SHARED_ELEMENT_NAME);

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlaybackActivity.class);
                intent.putExtra(MovieDetailsActivity.MOVIE, mSelectedMovie);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
}
 
Example #3
Source File: VideoDetailsFragment.java    From leanback-assistant with Apache License 2.0 5 votes vote down vote up
private void setupAdapter() {
    FullWidthDetailsOverviewRowPresenter detailsPresenter =
            new FullWidthDetailsOverviewRowPresenter(
                    new DetailsDescriptionPresenter(), new MovieDetailsOverviewLogoPresenter());

    detailsPresenter.setBackgroundColor(
            ContextCompat.getColor(getContext(), R.color.background_dark));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);

    detailsPresenter.setOnActionClickedListener(
            new OnActionClickedListener() {
                @Override
                public void onActionClicked(Action action) {
                    if (action.getId() == ACTION_WATCH) {
                        Intent intent =
                                PlaybackActivity.createIntent(getContext(), mMovie.getId());
                        startActivity(intent);
                    } else {
                        Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT)
                                .show();
                    }
                }
            });

    ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    mAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setAdapter(mAdapter);
}
 
Example #4
Source File: DetailRowBuilderTask.java    From Amphitheatre with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();
    DetailsOverviewRowPresenter dorPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter(mActivity));

    dorPresenter.setBackgroundColor(mActivity.getResources().getColor(R.color.fastlane_background));
    dorPresenter.setStyleLarge(true);
    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_PLAY) {
                VideoUtils.playVideo(new WeakReference<Activity>(mActivity), mVideo);
            }
            else if (action.getId() == ACTION_VIEW_TRAILER) {
                Uri trailerUri = Uri.parse(mVideo.getMovie().getTrailer());
                mActivity.startActivity(new Intent(Intent.ACTION_VIEW, trailerUri));
            }
            else {
                Toast.makeText(mActivity, action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    ps.addClassPresenter(ListRow.class, new ListRowPresenter());

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    addGroups(adapter);

    if (mRowBuilderTaskListener != null) {
        mRowBuilderTaskListener.taskCompleted(adapter);
    }
}
 
Example #5
Source File: VideoDetailsFragment.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute( DetailsOverviewRow detailRow ) {
    if( detailRow == null )
        return;

    ClassPresenterSelector ps = new ClassPresenterSelector();
    DetailsOverviewRowPresenter dorPresenter =
            new DetailsOverviewRowPresenter( new DetailsDescriptionPresenter() );
    // set detail background and style
    dorPresenter.setBackgroundColor( getResources().getColor( R.color.detail_background ) );
    dorPresenter.setStyleLarge( true );
    dorPresenter.setOnActionClickedListener( new OnActionClickedListener() {
        @Override
        public void onActionClicked( Action action ) {
            if (action.getId() == ACTION_WATCH ) {
                Intent intent = new Intent( getActivity(), PlayerActivity.class );
                intent.putExtra( EXTRA_MOVIE, mSelectedMovie );
                intent.putExtra( EXTRA_SHOULD_AUTO_START, true );
                startActivity( intent );
            }
        }
    });

    ps.addClassPresenter( DetailsOverviewRow.class, dorPresenter );
    ps.addClassPresenter( ListRow.class,
            new ListRowPresenter() );


    ArrayObjectAdapter adapter = new ArrayObjectAdapter( ps );
    adapter.add( detailRow );
    loadRelatedMedia( adapter );
    setAdapter( adapter );
}
 
Example #6
Source File: LiveDataDetailFragmentSubComponent.java    From leanback-showcase with Apache License 2.0 4 votes vote down vote up
@BindsInstance
Builder actionClickedListener(OnActionClickedListener listener);
 
Example #7
Source File: VideoDetailsFragment.java    From android-tv-leanback with Apache License 2.0 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();

    FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
    detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_PLAY) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    ps.addClassPresenter(ListRow.class, new ListRowPresenter());

    /** bonus code for adding related items to details fragment **/
    // <START>
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            "You may also like"
    };

    CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
    VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
    manager.startDataLoading();
    HeaderItem header = new HeaderItem(0, subcategories[0]);
    adapter.add(new ListRow(header, rowAdapter));
    setAdapter(adapter);
    // <END>

}
 
Example #8
Source File: VideoDetailsFragment.java    From android-tv-leanback with Apache License 2.0 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();

    FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
    detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_PLAY) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    ps.addClassPresenter(ListRow.class, new ListRowPresenter());

    /** bonus code for adding related items to details fragment **/
    // <START>
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            "You may also like"
    };

    CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
    VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
    manager.startDataLoading();
    HeaderItem header = new HeaderItem(0, subcategories[0]);
    adapter.add(new ListRow(header, rowAdapter));
    setAdapter(adapter);
    // <END>
}
 
Example #9
Source File: VideoDetailsFragment.java    From android-tv-leanback with Apache License 2.0 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();

    FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
    detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_PLAY) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    ps.addClassPresenter(ListRow.class,
            new ListRowPresenter());

    /** bonus code for adding related items to details fragment **/
    // <START>
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            "You may also like"
    };

    CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
    VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
    manager.startDataLoading();
    HeaderItem header = new HeaderItem(0, subcategories[0]);
    adapter.add(new ListRow(header, rowAdapter));
    setAdapter(adapter);
    // <END>

}
 
Example #10
Source File: VideoDetailsFragment.java    From android-tv-leanback with Apache License 2.0 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();

    FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
    detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_PLAY) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    ps.addClassPresenter(ListRow.class,
            new ListRowPresenter());

    /** bonus code for adding related items to details fragment **/
    // <START>
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            "You may also like"
    };

    CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
    VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
    manager.startDataLoading();
    HeaderItem header = new HeaderItem(0, subcategories[0]);
    adapter.add(new ListRow(header, rowAdapter));
    setAdapter(adapter);
    // <END>
}
 
Example #11
Source File: VideoDetailsFragment.java    From CumulusTV with MIT License 4 votes vote down vote up
private void setupDetailsOverviewRowPresenter() {
    // Set detail background and style.
    DetailsOverviewRowPresenter detailsPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
    detailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background));
    detailsPresenter.setStyleLarge(true);

    // Hook up transition element.
    detailsPresenter.setSharedElementEnterTransition(getActivity(),
            DetailsActivity.SHARED_ELEMENT_NAME);

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if(action.getId() == ACTION_EDIT) {
                ActivityUtils.editChannel(getActivity(), jsonChannel.getMediaUrl());
            } else if(action.getId() == ACTION_WATCH) {
                Log.d(TAG, ChannelDatabase.getInstance(getActivity()).getHashMap().toString());
                if (ChannelDatabase.getInstance(getActivity()).getHashMap()
                        .containsKey(jsonChannel.getMediaUrl())) {
                    // Open in Live Channels
                    Uri liveChannelsUri =
                            TvContract.buildChannelUri(
                                    ChannelDatabase.getInstance(
                                            getActivity()).getHashMap()
                                            .get(jsonChannel.getMediaUrl()));
                    getActivity().startActivity(
                            new Intent(Intent.ACTION_VIEW, liveChannelsUri));
                } else {
                    ActivityUtils.openStream(getActivity(), jsonChannel.getMediaUrl());
                }
            } else if(action.getId() == ACTION_ADD) {
                Log.d(TAG, "Adding " + jsonChannel.toString());
                ActivityUtils
                        .addChannel(getActivity(), gapi, jsonChannel);
                getActivity().setResult(LeanbackActivity.RESULT_CODE_REFRESH_UI);
                getActivity().finish();
            }
        }
    });
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
}
 
Example #12
Source File: RichAppLinkDetailsFragment.java    From androidtv-sample-inputs with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String displayNumber = getActivity().getIntent().getStringExtra(
            RichFeedUtil.EXTRA_DISPLAY_NUMBER);

    DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(
            new DetailsDescriptionPresenter());
    dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment");

    DetailsOverviewRow row = new DetailsOverviewRow(displayNumber);
    Resources res = getResources();
    Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.your_company);
    int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
    Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
            (bitmap.getWidth() - length) / 2,
            (bitmap.getHeight() - length) / 2,
            length, length);
    row.setImageBitmap(getActivity(), croppedBitmap);

    Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1));
    Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2));
    row.addAction(action1);
    row.addAction(action2);

    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    dorPresenter.setBackgroundColor(ContextCompat.getColor(getActivity(),
            R.color.detail_background));
    dorPresenter.setStyleLarge(true);

    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            getActivity().finish();
        }
    });

    presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
    adapter.add(row);

    setAdapter(adapter);
}
 
Example #13
Source File: TVVideoDetailsFragment.java    From BuildingForAndroidTV with MIT License 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();
    DetailsOverviewRowPresenter dorPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
    // set detail background and style
    dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background));
    dorPresenter.setStyleLarge(true);
    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(getResources().getString(R.string.movie), selectedMovie);
                intent.putExtra(getResources().getString(R.string.should_start), true);
                startActivity(intent);
            }
            else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    ps.addClassPresenter(ListRow.class,
            new ListRowPresenter());

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            getString(R.string.related_movies)
    };
    List<Movie> list = MovieList.list;
    Collections.shuffle(list);
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
    for (int j = 0; j < NUM_COLS; j++) {
        listRowAdapter.add(list.get(j % 5));
    }

    HeaderItem header = new HeaderItem(0, subcategories[0], null);
    adapter.add(new ListRow(header, listRowAdapter));

    setAdapter(adapter);
}
 
Example #14
Source File: TVVideoDetailsFragment.java    From BuildingForAndroidTV with MIT License 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();
    DetailsOverviewRowPresenter dorPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
    // set detail background and style
    dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background));
    dorPresenter.setStyleLarge(true);
    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(getResources().getString(R.string.movie), selectedMovie);
                intent.putExtra(getResources().getString(R.string.should_start), true);
                startActivity(intent);
            }
            else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    ps.addClassPresenter(ListRow.class,
            new ListRowPresenter());

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            getString(R.string.related_movies)
    };
    List<Movie> list = MovieList.list;
    Collections.shuffle(list);
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
    for (int j = 0; j < NUM_COLS; j++) {
        listRowAdapter.add(list.get(j % 5));
    }

    HeaderItem header = new HeaderItem(0, subcategories[0], null);
    adapter.add(new ListRow(header, listRowAdapter));

    setAdapter(adapter);
}
 
Example #15
Source File: TVVideoDetailsFragment.java    From BuildingForAndroidTV with MIT License 4 votes vote down vote up
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
    ClassPresenterSelector ps = new ClassPresenterSelector();
    DetailsOverviewRowPresenter dorPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
    // set detail background and style
    dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background));
    dorPresenter.setStyleLarge(true);
    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlayerActivity.class);
                intent.putExtra(getResources().getString(R.string.movie), selectedMovie);
                intent.putExtra(getResources().getString(R.string.should_start), true);
                startActivity(intent);
            }
            else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    ps.addClassPresenter(ListRow.class,
            new ListRowPresenter());

    ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
    adapter.add(detailRow);

    String subcategories[] = {
            getString(R.string.related_movies)
    };
    List<Movie> list = MovieList.list;
    Collections.shuffle(list);
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
    for (int j = 0; j < NUM_COLS; j++) {
        listRowAdapter.add(list.get(j % 5));
    }

    HeaderItem header = new HeaderItem(0, subcategories[0], null);
    adapter.add(new ListRow(header, listRowAdapter));

    setAdapter(adapter);
}