本文整理匯總了Java中android.support.v17.leanback.widget.Row類的典型用法代碼示例。如果您正苦於以下問題:Java Row類的具體用法?Java Row怎麽用?Java Row使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Row類屬於android.support.v17.leanback.widget包,在下文中一共展示了Row類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRelatedItems
import android.support.v17.leanback.widget.Row; //導入依賴的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: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Movie) {
Movie movie = (Movie) item;
Log.d(TAG, "Item: " + item.toString());
Intent intent = new Intent(getActivity(), DetailsActivity.class);
intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
intent.putExtra(getResources().getString(R.string.should_start), true);
startActivity(intent);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例3: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Movie) {
Log.d(TAG, "Item: " + item.toString());
Intent intent = new Intent(getActivity(), DetailsActivity.class);
intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例4: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
intent.putExtra(VideoDetailsActivity.VIDEO, video);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例5: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
intent.putExtra(VideoDetailsActivity.VIDEO, video);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例6: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
intent.putExtra(VideoDetailsActivity.VIDEO, video);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
} else {
Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT).show();
}
}
示例7: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
intent.putExtra(VideoDetailsActivity.VIDEO, video);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例8: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (isAdded()) {
if (item instanceof Clip) {
Clip clip = (Clip) item;
Intent intent = new Intent(getActivity(), PlaybackActivity.class);
intent.putExtra(PlaybackActivity.EXTRA_CLIP, clip);
startActivity(intent);
final long programId = clip.getProgramId();
if (programId != 0) {
// This clip is published as a program. Increment the view count for the
// program to demonstrate updating.
new SetViewCountInBackground(programId, clip.incrementViewCount());
}
}
}
}
示例9: getDefaultItemClickedListener
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
private OnItemViewClickedListener getDefaultItemClickedListener() {
return new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Clip) {
Toast.makeText(getActivity(), "** toggle selected **",
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), "** add as playlist **",
Toast.LENGTH_LONG).show();
}
}
};
}
示例10: getRelatedItems
import android.support.v17.leanback.widget.Row; //導入依賴的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);
}
示例11: setupEventListeners
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
protected void setupEventListeners() {
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof MetaFile2) {
MetaFile2 file = (MetaFile2) item;
if (file.isDirectory()) {
openDirectory(file);
} else {
String mimeType = MimeUtils.guessMimeTypeFromExtension(file.getExtension());
PlayUtils.openAnyFile(file, getActivity());
}
} else if (item instanceof Video) {
openDetailsActivity((Video) item, itemViewHolder);
} else {
throw new IllegalArgumentException("Click on an unexpected item type " + item);
}
}
});
}
示例12: onPostExecute
import android.support.v17.leanback.widget.Row; //導入依賴的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);
}
示例13: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
intent.putExtra(VideoDetailsActivity.VIDEO, video);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例14: onItemSelected
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
Video v = (Video) item;
long pospage = 40*page;
if(getPosition() >= pospage-5 && getPosition() <= pospage) {
if(page < ((pospage/40) + 1)) {
page++;
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
loadVideos(page);
}
}, 1000);
}
}
}
示例15: onItemClicked
import android.support.v17.leanback.widget.Row; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, final Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Apk) {
Apk application = (Apk) item;
Log.d(TAG, "Item: " + item.toString());
Intent intent = new Intent(getActivity(), DetailsActivity.class);
intent.putExtra(DetailsActivity.APPLICATION, application.toString());
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
} else if (item instanceof SettingOption) {
((SettingOption) item).getClickListener().onClick();
} else if (item instanceof File) {
Log.d(TAG, "Open file " + ((File) item).getAbsolutePath());
mApkDownloadHelper.install((File) item);
} else if (item instanceof ResolveInfo) {
GenerateShortcutHelper.begin(mMainActivity, (ResolveInfo) item);
}
}