本文整理汇总了Java中android.support.v17.leanback.widget.DetailsOverviewRowPresenter类的典型用法代码示例。如果您正苦于以下问题:Java DetailsOverviewRowPresenter类的具体用法?Java DetailsOverviewRowPresenter怎么用?Java DetailsOverviewRowPresenter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DetailsOverviewRowPresenter类属于android.support.v17.leanback.widget包,在下文中一共展示了DetailsOverviewRowPresenter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的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);
}
示例2: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate DetailsFragment");
super.onCreate(savedInstanceState);
mDorPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
backgroundManager.attach(getActivity().getWindow());
mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);
mDefaultBackground = getResources().getDrawable(R.drawable.default_background);
mMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
mSelectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
mDetailRowBuilderTask = (DetailRowBuilderTask) new DetailRowBuilderTask().execute(mSelectedMovie);
mDorPresenter.setSharedElementEnterTransition(getActivity(),
DetailsActivity.SHARED_ELEMENT_NAME);
updateBackground(mSelectedMovie.getBackgroundImageURI());
setOnItemViewClickedListener(new ItemViewClickedListener());
}
示例3: buildAboutAdapter
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的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;
}
示例4: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的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);
}
示例5: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTopOffsetRatio(0.6f);
final Intent intent = getActivity().getIntent();
mShowId = intent.getLongExtra(EXTRA_TVSHOW_ID, -1);
mColor = ContextCompat.getColor(getActivity(), R.color.leanback_details_background);
mOverviewRowPresenter = new DetailsOverviewRowPresenter(new TvshowMoreDetailsDescriptionPresenter());
mOverviewRowPresenter.setSharedElementEnterTransition(getActivity(), SHARED_ELEMENT_NAME, 1000);
mOverviewRowPresenter.setBackgroundColor(getResources().getColor(R.color.leanback_details_background));
mOverviewRowPresenter.setStyleLarge(false);
mOverviewRowPresenter.setOnActionClickedListener(null);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof ScraperImage) {
if (row == mPostersRow) {
mShowPosterSaverTask = new ShowPosterSaverTask().execute((ScraperImage) item);
}
else if (row == mBackdropsRow) {
mBackdropSaverTask = new BackdropSaverTask().execute((ScraperImage) item);
}
}
else if (item instanceof WebPageLink) {
WebPageLink link = (WebPageLink)item;
WebUtils.openWebLink(getActivity(), link.getUrl());
}
}
});
// WORKAROUND: at least one instance of BackdropTask must be created soon in the process (onCreate ?)
// else it does not work later.
// --> This instance of BackdropTask() will not be used but it must be created here!
mBackdropTask = new BackdropTask(getActivity(), VideoInfoCommonClass.getDarkerColor(mColor));
}
示例6: onCreatePresenterSelector
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@Override
protected PresenterSelector onCreatePresenterSelector(
DetailsOverviewRowPresenter rowPresenter) {
ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
presenterSelector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
return presenterSelector;
}
示例7: setupAdapter
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
private void setupAdapter() {
DetailsOverviewRowPresenter rowPresenter = new DetailsOverviewRowPresenter(
new DetailsContentPresenter(getActivity()));
rowPresenter.setBackgroundColor(getResources().getColor(R.color.common_tv_background,
null));
rowPresenter.setSharedElementEnterTransition(getActivity(),
DvrDetailsActivity.SHARED_ELEMENT_NAME);
rowPresenter.setOnActionClickedListener(onCreateOnActionClickedListener());
mRowsAdapter = new ArrayObjectAdapter(onCreatePresenterSelector(rowPresenter));
setAdapter(mRowsAdapter);
}
示例8: onCreatePresenterSelector
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
/**
* Creates and returns presenter selector will be used by rows adaptor.
*/
protected PresenterSelector onCreatePresenterSelector(
DetailsOverviewRowPresenter rowPresenter) {
ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
presenterSelector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
return presenterSelector;
}
示例9: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
private void setupDetailsOverviewRowPresenter() {
// Set detail background and style.
DetailsOverviewRowPresenter detailsPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getActivity()));
detailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background));
detailsPresenter.setStyleLarge(true);
// Hook up transition element.
detailsPresenter.setSharedElementEnterTransition(getActivity(),
DetailsActivity.SHARED_ELEMENT_NAME);
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
}
示例10: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate DetailsFragment");
super.onCreate(savedInstanceState);
mDorPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
backgroundManager.attach(getActivity().getWindow());
mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);
mDefaultBackground = getResources().getDrawable(R.drawable.default_background);
mMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
mSelectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(MOVIE);
mDetailRowBuilderTask = (DetailRowBuilderTask) new DetailRowBuilderTask().execute(mSelectedMovie);
mDorPresenter.setSharedElementEnterTransition(getActivity(),
DetailsActivity.SHARED_ELEMENT_NAME);
updateBackground(mSelectedMovie.getBackgroundImageURI());
setOnItemViewClickedListener(new ItemViewClickedListener());
}
示例11: setupFragment
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
private void setupFragment() {
mDetailsPresenter = new DetailsOverviewRowPresenter(getDetailsPresenter());
mDetailsPresenter.setStyleLarge(false);
ClassPresenterSelector ps = new ClassPresenterSelector();
ps.addClassPresenter(DetailsOverviewRow.class, mDetailsPresenter);
ps.addClassPresenter(TracksHeaderRow.class, new TracksHeaderRowPresenter());
OnItemViewClickedListener onTrackRowItemClicked = new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof TrackSimple) {
playFromTrack(((TrackSimple) item));
}
}
};
ps.addClassPresenter(TrackRow.class, getTrackRowPresenter(onTrackRowItemClicked));
mRowsAdapter = new ArrayObjectAdapter(ps);
setAdapter(mRowsAdapter);
setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
TracksDetailsFragment.this.onActionClicked(action);
}
});
}
示例12: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate DetailsFragment");
super.onCreate(savedInstanceState);
mApplication = TvApp.getApplication();
mApiClient = mApplication.getApiClient();
//Make sure we refresh
lastLoaded.set(Calendar.YEAR, 2000);
mDorPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
backgroundManager.attach(getActivity().getWindow());
mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);
mDefaultBackground = getResources().getDrawable(R.drawable.default_background);
mMetrics = new DisplayMetrics();
mActivity = (DetailsActivity) getActivity();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
mItemId = mActivity.getIntent().getStringExtra("ItemId");
mChannelId = mActivity.getIntent().getStringExtra("ChannelId");
String programJson = mActivity.getIntent().getStringExtra("ProgramInfo");
if (programJson != null) mProgramInfo = mApplication.getSerializer().DeserializeFromString(programJson, ProgramInfoDto.class);
mDorPresenter.setSharedElementEnterTransition(getActivity(),
DetailsActivity.SHARED_ELEMENT_NAME);
setOnItemViewClickedListener(new ItemViewClickedListener());
}
示例13: showCardInfo
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@Override public void showCardInfo(final CardInfo cardInfo) {
new AsyncTask<Void, Void, Bitmap>() {
@Override protected Bitmap doInBackground(Void... params) {
Bitmap detailImage = null;
try {
detailImage = Picasso.with(getActivity())
.load(cardInfo.getCardImageUrl())
.placeholder(R.drawable.icn_wink)
.error(R.drawable.icn_wink)
.resize(Util.convertDpToPixel(getActivity(), DETAIL_THUMB_WIDTH),
Util.convertDpToPixel(getActivity(), DETAIL_THUMB_HEIGHT))
.centerCrop()
.get();
} catch (IOException e) {
//Empty
}
return detailImage;
}
@Override protected void onPostExecute(Bitmap bitmap) {
DetailsOverviewRow detailRow = configureDetailsOverviewRow(cardInfo, bitmap);
ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
DetailsOverviewRowPresenter dorPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
dorPresenter.setBackgroundColor(getResources().getColor(R.color.primary_color));
dorPresenter.setStyleLarge(false);
presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
adapter = new ArrayObjectAdapter(presenterSelector);
adapter.add(detailRow);
setAdapter(adapter);
}
}.execute();
}
示例14: onPostExecute
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@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 );
}
示例15: onPostExecute
import android.support.v17.leanback.widget.DetailsOverviewRowPresenter; //导入依赖的package包/类
@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);
}
}