本文整理匯總了Java中android.support.v17.leanback.widget.ArrayObjectAdapter.add方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayObjectAdapter.add方法的具體用法?Java ArrayObjectAdapter.add怎麽用?Java ArrayObjectAdapter.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v17.leanback.widget.ArrayObjectAdapter
的用法示例。
在下文中一共展示了ArrayObjectAdapter.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupUI
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void setupUI() {
VideoFragment videoFragment = (VideoFragment) getFragmentManager().findFragmentById(R.id.video_fragment);
mGlue = new VideoFragmentGlueHost(videoFragment);
mGlue.setSurfaceHolderCallback(this);
mGlue.setOnActionClickedListener(this);
mControlsRow = new PlaybackControlsRow(mSelectedLink);
ArrayObjectAdapter adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
mPlayPauseAction = new PlaybackControlsRow.PlayPauseAction(this);
mPlayPauseAction.nextIndex(); // set to play
adapter.add(new PlaybackControlsRow.RewindAction(this));
adapter.add(mPlayPauseAction);
adapter.add(new PlaybackControlsRow.FastForwardAction(this));
mControlsRow.setPrimaryActionsAdapter(adapter);
PlaybackControlsRowPresenter presenter = new PlaybackControlsRowPresenter(new DetailsPresenter());
mGlue.setPlaybackRow(mControlsRow);
mGlue.setPlaybackRowPresenter(presenter);
}
示例2: setupMoreMovies
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void setupMoreMovies() {
HeaderItem moreMoviesHeader = new HeaderItem(1, getString(R.string.more_movies));
MorePresenter morePresenter = new MorePresenter(getActivity());
ArrayObjectAdapter moreRowAdapter = new ArrayObjectAdapter(morePresenter);
// add items
List<MediaProvider.NavInfo> navigation = mMoviesProvider.getNavigation();
for (MediaProvider.NavInfo info : navigation) {
moreRowAdapter.add(new MorePresenter.MoreItem(
info.getId(),
info.getLabel(),
info.getIcon(),
info));
}
mRowsAdapter.add(new ListRow(moreMoviesHeader, moreRowAdapter));
}
示例3: loadRows
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void loadRows() {
List<Movie> list = MovieList.setupMovies();
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
CardPresenter cardPresenter = new CardPresenter();
int i;
for (i = 0; i < NUM_ROWS; i++) {
if (i != 0) {
Collections.shuffle(list);
}
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
for (int j = 0; j < NUM_COLS; j++) {
listRowAdapter.add(list.get(j % 5));
}
HeaderItem header = new HeaderItem(i, MovieList.MOVIE_CATEGORY[i]);
mRowsAdapter.add(new ListRow(header, listRowAdapter));
}
HeaderItem gridHeader = new HeaderItem(i, "PREFERENCES");
GridItemPresenter mGridPresenter = new GridItemPresenter();
ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter);
gridRowAdapter.add(getResources().getString(R.string.grid_view));
gridRowAdapter.add(getString(R.string.error_fragment));
gridRowAdapter.add(getResources().getString(R.string.personal_settings));
mRowsAdapter.add(new ListRow(gridHeader, gridRowAdapter));
setAdapter(mRowsAdapter);
}
示例4: addOtherRows
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void addOtherRows() {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
for (Movie movie : mItems) {
listRowAdapter.add(movie);
}
HeaderItem header = new HeaderItem(0, getString(R.string.related_movies));
mRowsAdapter.add(new ListRow(header, listRowAdapter));
}
示例5: addInAdapterInAlphabeticalOrder
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
/**
* Bloody ArrayObjectAdapter does not support sort()! (ArrayAdapter does...)
* Need this f*ck*ng piece of code to do it
* Non performance issue here since we're never handling a LOT of items
* @param newObject a NetworkSource instance to add to the adapter
* @param adapter an adapter containing some NetworkSource objects
*/
private void addInAdapterInAlphabeticalOrder(NetworkSource newObject, ArrayObjectAdapter adapter) {
for (int i=0; i<adapter.size(); i++) {
NetworkSource obj = (NetworkSource)adapter.get(i);
if (newObject.getName().compareToIgnoreCase(obj.getName()) < 0) {
adapter.add(i, newObject); // insert before this item
return;
}
}
// Default is to add at the end (either because of the names or because this is the first item)
adapter.add(newObject);
}
示例6: setupRelatedMovieListRow
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void setupRelatedMovieListRow() {
String subcategories[] = {getString(R.string.related_movies)};
List<Movie> list = MovieList.getList();
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]);
mAdapter.add(new ListRow(header, listRowAdapter));
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
}
示例7: getStreamActionsAdapter
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private ArrayObjectAdapter getStreamActionsAdapter(List<Stream> streams) {
ArrayObjectAdapter actionsAdapter = new ArrayObjectAdapter();
streamUrlList = new ArrayList<StreamUrl>();
for (Stream s : streams) {
if (s.getType().equals("video") || true)
for (String key : s.getUrls().keySet()) {
StreamUrl url = s.getUrls().get(key);
int index = streamUrlList.size();
streamUrlList.add(url);
actionsAdapter.add(new Action(index, s.getDisplay(), url.getDisplay()));
}
}
return actionsAdapter;
}
示例8: setupMovieListRow
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void setupMovieListRow() {
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]);
mAdapter.add(new ListRow(header, listRowAdapter));
}
示例9: getFunctionRow
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private ListRow getFunctionRow() {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new FunctionCardPresenter());
List<FunctionModel> functionModels = FunctionModel.getFunctionList(getContext());
for (FunctionModel item : functionModels
) {
listRowAdapter.add(item);
}
return new ListRow(new HeaderItem(0, getContext().getString(R.string.title_function)), listRowAdapter);
}
示例10: getAppRow
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private List<ListRow> getAppRow() {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new AppCardPresenter());
ArrayObjectAdapter listSysRowAdapter = new ArrayObjectAdapter(new AppCardPresenter());
for (AppModel appModel : mAppModels
)
if (appModel.isSysApp()) listSysRowAdapter.add(appModel);
else listRowAdapter.add(appModel);
List<ListRow> listRows = new ArrayList<>();
listRows.add(new ListRow(new HeaderItem(0, getContext().getString(R.string.title_app)), listRowAdapter));
listRows.add(new ListRow(new HeaderItem(0, getContext().getString(R.string.title_sysapp)), listSysRowAdapter));
return listRows;
}
示例11: getCardRow
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private ListRow[] getCardRow() {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
for (CardModel carModel : CardModel.getCardModels()
) {
listRowAdapter.add(carModel);
}
HeaderItem header = new HeaderItem(0, getContext().getString(R.string.title_used));
return new ListRow[]{new ListRow(header, listRowAdapter)};
}
示例12: onLoadFinish
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
@Override
public void onLoadFinish(List<Video> start_movies, List<Video> start_tvshows) {
HeaderItem header_movies = new HeaderItem(0, "MOVIES");
HeaderItem header_tvshows = new HeaderItem(1, "TV SHOWS");
HeaderItem header_settings = new HeaderItem(1, "SETTINGS");
ArrayObjectAdapter movies = new ArrayObjectAdapter(new CardPresenter(getActivity()));
ArrayObjectAdapter tvshows = new ArrayObjectAdapter(new CardPresenter(getActivity()));
ArrayObjectAdapter settings = new ArrayObjectAdapter(new GridItemPresenter());
movies.addAll(movies.size(), start_movies);
tvshows.addAll(tvshows.size(), start_tvshows);
settings.add("Preferences");
mCategoryRowAdapter.add(new ListRow(header_movies, movies));
prepareMoreMovieButtons(mCategoryRowAdapter.size());
mCategoryRowAdapter.add(new ListRow(header_tvshows, tvshows));
prepareMoreTVShowButtons(mCategoryRowAdapter.size());
// HACK - remove init row
for(int i = 0; i < mCategoryRowAdapter.size(); i++) {
ListRow lr = (ListRow) mCategoryRowAdapter.get(i);
if(lr.getHeaderItem().getName().equals("HACKINIT")) {
mCategoryRowAdapter.removeItems(i, 1);
}
}
mCategoryRowAdapter.add(new ListRow(header_settings, settings));
startEntranceTransition();
}
示例13: onStart
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
@Override
public void onStart() {
super.onStart();
// Set up UI
Video video = getActivity().getIntent().getParcelableExtra(VideoDetailsActivity.VIDEO);
if (!updateSelectedVideo(video)) {
return;
}
mGlue = new PlaybackControlHelper(getActivity(), this, mSelectedVideo);
PlaybackControlsRowPresenter controlsRowPresenter = mGlue.createControlsRowAndPresenter();
PlaybackControlsRow controlsRow = mGlue.getControlsRow();
mMediaControllerCallback = mGlue.createMediaControllerCallback();
mMediaController = getActivity().getMediaController();
mMediaController.registerCallback(mMediaControllerCallback);
ClassPresenterSelector ps = new ClassPresenterSelector();
ps.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
ps.addClassPresenter(ListRow.class, new ListRowPresenter());
mRowsAdapter = new ArrayObjectAdapter(ps);
mRowsAdapter.add(controlsRow);
addOtherRows();
updatePlaybackRow();
setAdapter(mRowsAdapter);
startPlaying();
}
示例14: addPhotoRow
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
private void addPhotoRow() {
String headerName = getResources().getString(R.string.app_header_photo_name);
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new ImgCardPresenter());
for (MediaModel mediaModel : MediaModel.getPhotoModels()) {
listRowAdapter.add(mediaModel);
}
HeaderItem header = new HeaderItem(0, headerName);
rowsAdapter.add(new ListRow(header, listRowAdapter));
}
示例15: onCreateSecondaryActions
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入方法依賴的package包/類
@Override
protected void onCreateSecondaryActions(ArrayObjectAdapter adapter) {
adapter.add(mThumbsUpAction);
adapter.add(mThumbsDownAction);
if (android.os.Build.VERSION.SDK_INT > 23) {
adapter.add(mPipAction);
}
}