本文整理汇总了Java中android.support.v17.leanback.widget.DetailsOverviewRow类的典型用法代码示例。如果您正苦于以下问题:Java DetailsOverviewRow类的具体用法?Java DetailsOverviewRow怎么用?Java DetailsOverviewRow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DetailsOverviewRow类属于android.support.v17.leanback.widget包,在下文中一共展示了DetailsOverviewRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
private DetailsOverviewRow setupDetailsOverviewRow(Object event) {
final DetailsOverviewRow row = new DetailsOverviewRow(event);
String thumbUrl;
if (event instanceof Event) {
thumbUrl = ((Event) event).getThumbUrl();
} else {
thumbUrl = ((Room) event).getThumb();
}
Glide.with(getActivity())
.load(thumbUrl)
.asBitmap()
.into(new SimpleTarget<Bitmap>(DETAIL_THUMB_WIDTH, DETAIL_THUMB_HEIGHT) {
@Override
public void onResourceReady(Bitmap resource,
GlideAnimation<? super Bitmap> glideAnimation) {
row.setImageBitmap(getActivity(), resource);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
// super.onLoadFailed(e, errorDrawable);
row.setImageDrawable(getResources().getDrawable(DEFAULT_DRAWABLE));
}
});
return row;
}
示例2: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
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_WATCH_TRAILER) {
Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
intent.putExtra(DetailsActivity.MOVIE, mSelectedMovie);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
}
示例3: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的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);
}
示例4: onPostExecute
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的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);
}
示例5: createDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
private DetailsOverviewRow createDetailsOverviewRow() {
final DetailsOverviewRow detailsRow = new DetailsOverviewRow(mItem);
Picasso.with(getActivity()).load(mHeroImage).into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
detailsRow.setImageBitmap(getActivity(), bitmap);
mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onBitmapFailed(Drawable errorDrawable) {
if(VersionUtils.isLollipop())
getActivity().startPostponedEnterTransition();
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});
return detailsRow;
}
示例6: onSuccess
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
@Override
public void onSuccess(MediaProvider.Filters filters, ArrayList<Media> items, boolean changed) {
if (!isAdded()) return;
if (null == items || items.size() == 0) return;
Media itemDetail = items.get(0);
mItem = itemDetail;
ThreadUtils.runOnUiThread(new Runnable() {
@Override public void run() {
final DetailsOverviewRow detailRow = createDetailsOverviewRow();
mAdapter.replace(0, detailRow);
onDetailLoaded();
}
});
}
示例7: provideHelper
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
@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;
}
示例8: doInBackground
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Movie... movies) {
mSelectedMovie = movies[0];
DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
try {
Bitmap poster = Picasso.with(getActivity())
.load(mSelectedMovie.getCardImageUrl())
.resize(Utils.convertDpToPixel(getActivity().getApplicationContext(),
DETAIL_THUMB_WIDTH),
Utils.convertDpToPixel(getActivity().getApplicationContext(),
DETAIL_THUMB_HEIGHT))
.centerCrop()
.get();
row.setImageBitmap(getActivity(), poster);
} catch (IOException e) {
}
row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
return row;
}
示例9: doInBackground
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Video... videos) {
DetailsOverviewRow row = new DetailsOverviewRow(videos[0]);
try {
Bitmap poster = Picasso.with(getActivity())
.load(videos[0].getThumbUrl())
.resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()),
dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext()))
.centerCrop()
.get();
row.setImageBitmap(getActivity(), poster);
} catch (IOException e) {
Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e);
}
SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString(
R.string.action_play)));
adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later)));
row.setActionsAdapter(adapter);
return row;
}
示例10: doInBackground
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Movie... movies) {
mSelectedMovie = movies[0];
DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
try {
Bitmap poster = Picasso.with(getActivity())
.load(mSelectedMovie.getCardImageUrl())
.resize(Utils.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH),
Utils.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_HEIGHT))
.centerCrop()
.get();
row.setImageBitmap(getActivity(), poster);
} catch (IOException e) {
}
row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
return row;
}
示例11: buildAboutAdapter
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
private ArrayObjectAdapter buildAboutAdapter() {
DetailsOverviewRowPresenter rowPresenter = new DetailsOverviewRowPresenter(new AboutDetailsDescriptionPresenter());
rowPresenter.setBackgroundColor(getResources().getColor(R.color.about_background));
rowPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {}
});
ClassPresenterSelector selector = new ClassPresenterSelector();
selector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
selector.addClassPresenter(ListRow.class, new ListRowPresenter());
ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(selector);
rowsAdapter.add(generateAboutMeRow());
rowsAdapter.add(generateAboutGDGRow());
return rowsAdapter;
}
示例12: doInBackground
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Movie... movies) {
selectedMovie = movies[0];
DetailsOverviewRow row = new DetailsOverviewRow(selectedMovie);
try {
Bitmap poster = Picasso.with(getActivity())
.load(selectedMovie.getCardImageUrl())
.resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()),
dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext()))
.centerCrop()
.get();
row.setImageBitmap(getActivity(), poster);
} catch (IOException e) {
}
row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
return row;
}
示例13: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
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);
}
示例14: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
private void setupDetailsOverviewRow() {
Log.d(TAG, "doInBackground: " + mSelectedMovie.toString());
final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
row.setImageDrawable(getResources().getDrawable(R.drawable.default_background));
int width = Utils.convertDpToPixel(getActivity()
.getApplicationContext(), DETAIL_THUMB_WIDTH);
int height = Utils.convertDpToPixel(getActivity()
.getApplicationContext(), DETAIL_THUMB_HEIGHT);
Glide.with(getActivity())
.load(mSelectedMovie.getCardImageUrl())
.centerCrop()
.error(R.drawable.default_background)
.into(new SimpleTarget<GlideDrawable>(width, height) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable>
glideAnimation) {
Log.d(TAG, "details overview card image url ready: " + resource);
row.setImageDrawable(resource);
mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
}
});
row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
mAdapter.add(row);
}
示例15: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入依赖的package包/类
private void setupDetailsOverviewRowPresenter() {
// Set detail background.
FullWidthDetailsOverviewRowPresenter detailsPresenter =
new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
detailsPresenter.setBackgroundColor(
ContextCompat.getColor(getActivity(), R.color.selected_background));
// Hook up transition element.
FullWidthDetailsOverviewSharedElementHelper sharedElementHelper =
new FullWidthDetailsOverviewSharedElementHelper();
sharedElementHelper.setSharedElementEnterTransition(
getActivity(), DetailsActivity.SHARED_ELEMENT_NAME);
detailsPresenter.setListener(sharedElementHelper);
detailsPresenter.setParticipatingEntranceTransition(true);
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(DetailsActivity.MOVIE, mSelectedMovie);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
}