本文整理匯總了Java中android.support.v17.leanback.widget.ArrayObjectAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java ArrayObjectAdapter類的具體用法?Java ArrayObjectAdapter怎麽用?Java ArrayObjectAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ArrayObjectAdapter類屬於android.support.v17.leanback.widget包,在下文中一共展示了ArrayObjectAdapter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRelatedItems
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private Row getRelatedItems() {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
final Set<Long> related = mSelectedEvent.getMetadata().getRelated().keySet();
mDisposables.add(((LeanbackBaseActivity) getActivity()).getApiServiceObservable()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
mediaApiService -> {
for (long id : related) {
mDisposables.add(mediaApiService.getEvent(id)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(event -> listRowAdapter.add(event)));
}
listRowAdapter.notifyArrayItemRangeChanged(0, listRowAdapter.size());
}
)
);
HeaderItem header = new HeaderItem(0, getString(R.string.related_talks));
return new ListRow(header, listRowAdapter);
}
示例2: setupSecondaryRowPlaybackControl
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private void setupSecondaryRowPlaybackControl(@NonNull PresenterSelector presenterSelector) {
mSecondaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
mPlaybackControlsRow.setSecondaryActionsAdapter(mSecondaryActionsAdapter);
Activity activity = getActivity();
mScaleVideoAction = new ScaleVideoAction(activity);
mClosedCaptioningAction = new ClosedCaptioningAction(activity);
mClosedCaptioningAction.setIcon(getResources().getDrawable(R.drawable.ic_av_subs, null));
if (mStreamInfo!= null && mStreamInfo.getSubtitleLanguage() != null && !mStreamInfo.getSubtitleLanguage().equals(SubsProvider.SUBTITLE_LANGUAGE_NONE)) {
mClosedCaptioningAction.setIndex(ClosedCaptioningAction.ON);
} else {
mClosedCaptioningAction.setIndex(ClosedCaptioningAction.OFF);
}
// Add rest of controls to secondary adapter.
mSecondaryActionsAdapter.add(mScaleVideoAction);
if(mSubsButtonEnabled)
mSecondaryActionsAdapter.add(mClosedCaptioningAction);
}
示例3: 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);
}
示例4: onCreate
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate DetailsFragment");
super.onCreate(savedInstanceState);
mDetailsBackground = new DetailsFragmentBackgroundController(this);
mSelectedMovie =
(Movie) getActivity().getIntent().getSerializableExtra(DetailsActivity.MOVIE);
if (mSelectedMovie != null) {
mPresenterSelector = new ClassPresenterSelector();
mAdapter = new ArrayObjectAdapter(mPresenterSelector);
setupDetailsOverviewRow();
setupDetailsOverviewRowPresenter();
setupRelatedMovieListRow();
setAdapter(mAdapter);
initializeBackground(mSelectedMovie);
setOnItemViewClickedListener(new ItemViewClickedListener());
} else {
Intent intent = new Intent(getActivity(), MainActivity.class);
startActivity(intent);
}
}
示例5: createControlsRowAndPresenter
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();
adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
getControlsRow().setSecondaryActionsAdapter(adapter);
mFastForwardAction = (PlaybackControlsRow.FastForwardAction) getPrimaryActionsAdapter()
.lookup(ACTION_FAST_FORWARD);
mRewindAction = (PlaybackControlsRow.RewindAction) getPrimaryActionsAdapter()
.lookup(ACTION_REWIND);
presenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
dispatchAction(action);
}
});
return presenter;
}
示例6: onActivityCreated
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// Final initialization, modifying UI elements.
super.onActivityCreated(savedInstanceState);
// Prepare the manager that maintains the same background image between activities.
prepareBackgroundManager();
setupUIElements();
setupEventListeners();
prepareEntranceTransition();
// Map category results from the database to ListRow objects.
// This Adapter is used to render the MainFragment sidebar labels.
mCategoryRowAdapter = new ArrayObjectAdapter(new ListRowPresenter());
setAdapter(mCategoryRowAdapter);
updateRecommendations();
}
示例7: getRelatedItems
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private Row getRelatedItems() {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
final long[] related = mSelectedEvent.getMetadata().getRelated();
mDisposables.add(((LeanbackBaseActivity) getActivity()).getApiServiceObservable()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
mediaApiService -> {
for (long id : related) {
mDisposables.add(mediaApiService.getEvent(id)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(event -> listRowAdapter.add(event)));
}
listRowAdapter.notifyArrayItemRangeChanged(0, listRowAdapter.size());
}
)
);
HeaderItem header = new HeaderItem(0, getString(R.string.related_talks));
return new ListRow(header, listRowAdapter);
}
示例8: getRecordingActionsAdapter
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private ArrayObjectAdapter getRecordingActionsAdapter(List<Recording> recordings) {
ArrayObjectAdapter actionsAdapter = new ArrayObjectAdapter();
if(mWatchlistItem != null){
actionsAdapter.add(new Action(REMOVE_WATCHLIST_ACTION,getString(R.string.remove_from_watchlist)));
} else {
actionsAdapter.add(new Action(ADD_WATCHLIST_ACTION,getString(R.string.add_to_watchlist)));
}
if (recordings != null) {
for (int i = 0; i < recordings.size(); i++) {
Recording recording = recordings.get(i);
if (recording.getMimeType().startsWith("video/") || true) {
String quality = recording.isHighQuality() ? "HD" : "SD";
String title = quality + " (" + recording.getLanguage() + ")";
actionsAdapter.add(new Action(recording.getApiID(), title, recording.getMimeType().substring(6)));
}
}
} else {
actionsAdapter.add(new Action(DUMMY_ID, "Dummy", "HLS"));
}
return actionsAdapter;
}
示例9: addStreams
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private void addStreams(CardPresenter cardPresenter, List<LiveConference> liveConferences) {
if (liveConferences.size() > 0) {
HeaderItem streamingHeader = new HeaderItem(getString(R.string.livestreams));
mStreamingSection = new SectionRow(streamingHeader);
mRowsAdapter.add(0, mStreamingSection);
for (LiveConference con : liveConferences) {
if(!con.getConference().equals("Sendeschleife")){
int i = -1;
for (i = 0; i < con.getGroups().size(); i++) {
Group g = con.getGroups().get(i);
// setup header
String group = g.getGroup().length() > 0 ? g.getGroup() : con.getConference();
HeaderItem header = new HeaderItem(group);
header.setDescription(con.getConference() + " - " + con.getDescription());
header.setContentDescription(group);
// setup list
ArrayObjectAdapter listRowAdapter
= new ArrayObjectAdapter(cardPresenter);
listRowAdapter.addAll(listRowAdapter.size(), g.getRooms());
mRowsAdapter.add(i + 1, new ListRow(header, listRowAdapter));
}
}
// mRowsAdapter.add(i + 1, new DividerRow());
}
}
}
示例10: onCreate
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
bgMngr.attach(getActivity().getWindow());
bgMngr.setColor(getResources().getColor(R.color.leanback_background));
mShortcut = (Shortcut)getActivity().getIntent().getSerializableExtra(EXTRA_SHORTCUT);
DetailsOverviewRow detailRow = new DetailsOverviewRow(mShortcut);
detailRow.setImageScaleUpAllowed(false);
addActions(detailRow);
mDetailsRowPresenter = new FullWidthDetailsOverviewRowPresenter(new ShortcutDetailsPresenter());
mDetailsRowPresenter.setBackgroundColor(getResources().getColor(R.color.lightblue900));
mDetailsRowPresenter.setOnActionClickedListener(this);
ArrayObjectAdapter adapter = new ArrayObjectAdapter(mDetailsRowPresenter);
adapter.add(detailRow);
setAdapter(adapter);
}
示例11: onPostExecute
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
protected void onPostExecute(Void avoid) {
ClassPresenterSelector ps = new ClassPresenterSelector();
ps.addClassPresenter(DetailsOverviewRow.class, mOverviewRowPresenter);
ps.addClassPresenter(PlotAndGenresRow.class, new PlotAndGenresRowPresenter(16,mColor)); // 16 lines max to fit on screen
ps.addClassPresenter(FullTextRow.class, new FullTextRowPresenter(18,mColor)); // 18 lines max to fit on screen
ps.addClassPresenter(ListRow.class, new ListRowPresenter());
mOverviewRowPresenter.setBackgroundColor(mColor);
mRowsAdapter = new ArrayObjectAdapter(ps);
mRowsAdapter.clear();
// Add all the non-null rows
for (Row row : new Row[] {mDetailsRow, mPlotAndGenresRow, mCastRow, mPostersRow, mBackdropsRow, mWebLinksRow}) {
if (row!=null) {
mRowsAdapter.add(row);
}
}
setAdapter(mRowsAdapter);
}
示例12: onActivityCreated
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
prepareBackgroundManager();
setupUIElements();
setupEventListeners();
prepareEntranceTransition();
mCategoryRowAdapter = new ArrayObjectAdapter(new ListRowPresenter());
loadRows();
setAdapter(mCategoryRowAdapter);
updateRecommendations();
}
示例13: setupRowAdapter
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private void setupRowAdapter() {
VerticalGridPresenter gridPresenter = new VerticalGridPresenter(ZOOM_FACTOR);
gridPresenter.setNumberOfColumns(COLUMNS);
setGridPresenter(gridPresenter);
PresenterSelector cardPresenterSelector = new CardPresenterSelector(getActivity());
mAdapter = new ArrayObjectAdapter(cardPresenterSelector);
setAdapter(mAdapter);
prepareEntranceTransition();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
createRows();
startEntranceTransition();
}
}, 1000);
}
示例14: onCreate
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ArrayObjectAdapter mRowAdapter =
new ArrayObjectAdapter(new VideoCardViewPresenter(getContext()));
setAdapter(mRowAdapter);
setTitle(getString(R.string.assistant_playback_videos));
setBadgeDrawable(
getActivity().getResources().getDrawable(R.drawable.assistant_tv_banner, null));
VerticalGridPresenter gridPresenter = new VerticalGridPresenter();
gridPresenter.setNumberOfColumns(NUM_COLUMNS);
setGridPresenter(gridPresenter);
for (Movie movie : MockDatabase.getAllMovies()) {
mRowAdapter.add(movie);
}
setOnItemViewClickedListener(new ItemViewClickedListener());
}
示例15: setupFragment
import android.support.v17.leanback.widget.ArrayObjectAdapter; //導入依賴的package包/類
private void setupFragment() {
VerticalGridPresenter gridPresenter = new VerticalGridPresenter(FocusHighlight.ZOOM_FACTOR_SMALL);
gridPresenter.setNumberOfColumns(numColumns);
//gridPresenter.setShadowEnabled(false);
setGridPresenter(gridPresenter);
mAdapter = new ArrayObjectAdapter(new CardPresenter());
List<Contact> contacts = ContactProvider.getContactList();
mAdapter.addAll(0, contacts);
setAdapter(mAdapter);
setOnItemViewClickedListener(new ItemViewClickedListener());
setOnItemViewSelectedListener(new ItemViewSelectedListener());
}