本文整理汇总了Java中android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.setInitialState方法的典型用法代码示例。如果您正苦于以下问题:Java FullWidthDetailsOverviewRowPresenter.setInitialState方法的具体用法?Java FullWidthDetailsOverviewRowPresenter.setInitialState怎么用?Java FullWidthDetailsOverviewRowPresenter.setInitialState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter
的用法示例。
在下文中一共展示了FullWidthDetailsOverviewRowPresenter.setInitialState方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupDetailsOverviewRowPresenter
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
private FullWidthDetailsOverviewRowPresenter setupDetailsOverviewRowPresenter() {
FullWidthDetailsOverviewRowPresenter mDetailsPresenter = new FullWidthDetailsOverviewRowPresenter(
new EventDetailsDescriptionPresenter(getActivity()),
new EventDetailsOverviewLogoPresenter());
mDetailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background));
mDetailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);
mDetailsPresenter.setAlignmentMode(FullWidthDetailsOverviewRowPresenter.ALIGN_MODE_START);
FullWidthDetailsOverviewSharedElementHelper helper
= new FullWidthDetailsOverviewSharedElementHelper();
helper.setSharedElementEnterTransition(getActivity(),
EventDetailsActivity.SHARED_ELEMENT_NAME);
mDetailsPresenter.setListener(helper);
prepareEntranceTransition();
mDetailsPresenter.setOnActionClickedListener(mOnActionClickedListener);
return mDetailsPresenter;
}
示例2: setupAdapter
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
private void setupAdapter() {
// Set detail background and style.
FullWidthDetailsOverviewRowPresenter detailsPresenter =
new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(),
new MovieDetailsOverviewLogoPresenter());
detailsPresenter.setBackgroundColor(
ContextCompat.getColor(getActivity(), R.color.selected_background));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);
// Hook up transition element.
mHelper = new FullWidthDetailsOverviewSharedElementHelper();
mHelper.setSharedElementEnterTransition(getActivity(),
VideoDetailsActivity.SHARED_ELEMENT_NAME);
detailsPresenter.setListener(mHelper);
detailsPresenter.setParticipatingEntranceTransition(false);
prepareEntranceTransition();
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(VideoDetailsActivity.VIDEO, mSelectedVideo);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
mPresenterSelector = new ClassPresenterSelector();
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
mAdapter = new ArrayObjectAdapter(mPresenterSelector);
setAdapter(mAdapter);
}
示例3: setupAdapter
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
private void setupAdapter() {
FullWidthDetailsOverviewRowPresenter detailsPresenter =
new FullWidthDetailsOverviewRowPresenter(
new DetailsDescriptionPresenter(), new MovieDetailsOverviewLogoPresenter());
detailsPresenter.setBackgroundColor(
ContextCompat.getColor(getContext(), R.color.background_dark));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);
detailsPresenter.setOnActionClickedListener(
new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
if (action.getId() == ACTION_WATCH) {
Intent intent =
PlaybackActivity.createIntent(getContext(), mMovie.getId());
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT)
.show();
}
}
});
ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
mAdapter = new ArrayObjectAdapter(mPresenterSelector);
setAdapter(mAdapter);
}
示例4: setupAdapter
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
private void setupAdapter() {
// Set detail background and style.
FullWidthDetailsOverviewRowPresenter detailsPresenter =
new FullWidthDetailsOverviewRowPresenter(new TVContactRequestDetailPresenter(),
new TVContactRequestDetailsOverviewLogoPresenter());
detailsPresenter.setBackgroundColor(
ContextCompat.getColor(getActivity(), R.color.color_primary_dark));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);
// Hook up transition element.
FullWidthDetailsOverviewSharedElementHelper mHelper = new FullWidthDetailsOverviewSharedElementHelper();
mHelper.setSharedElementEnterTransition(getActivity(),
TVContactRequestActivity.SHARED_ELEMENT_NAME);
detailsPresenter.setListener(mHelper);
detailsPresenter.setParticipatingEntranceTransition(false);
prepareEntranceTransition();
detailsPresenter.setOnActionClickedListener(action -> {
if (action.getId() == ACTION_ACCEPT) {
presenter.acceptTrustRequest(mSelectedContactRequest);
} else if (action.getId() == ACTION_REFUSE) {
presenter.refuseTrustRequest(mSelectedContactRequest);
} else if (action.getId() == ACTION_BLOCK) {
presenter.blockTrustRequest(mSelectedContactRequest);
}
});
ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
mAdapter = new ArrayObjectAdapter(mPresenterSelector);
setAdapter(mAdapter);
}
示例5: setupAdapter
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
private void setupAdapter() {
// Set detail background and style.
FullWidthDetailsOverviewRowPresenter detailsPresenter =
new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(),
new MovieDetailsOverviewLogoPresenter());
detailsPresenter.setBackgroundColor(
ContextCompat.getColor(getActivity(), R.color.selected_background));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);
// Hook up transition element.
mHelper = new FullWidthDetailsOverviewSharedElementHelper();
mHelper.setSharedElementEnterTransition(getActivity(),
VideoDetailsActivity.SHARED_ELEMENT_NAME);
detailsPresenter.setListener(mHelper);
detailsPresenter.setParticipatingEntranceTransition(false);
prepareEntranceTransition();
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(VideoDetailsActivity.VIDEO, mSelectedVideo);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
mPresenterSelector = new ClassPresenterSelector();
mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
mAdapter = new ArrayObjectAdapter(mPresenterSelector);
setAdapter(mAdapter);
}
示例6: onPostExecute
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
ClassPresenterSelector ps = new ClassPresenterSelector();
FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);
detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
if (action.getId() == ACTION_PLAY) {
Intent intent = new Intent(getActivity(), PlayerActivity.class);
intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
ps.addClassPresenter(ListRow.class, new ListRowPresenter());
/** bonus code for adding related items to details fragment **/
// <START>
ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
adapter.add(detailRow);
String subcategories[] = {
"You may also like"
};
CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
manager.startDataLoading();
HeaderItem header = new HeaderItem(0, subcategories[0]);
adapter.add(new ListRow(header, rowAdapter));
setAdapter(adapter);
// <END>
}
示例7: onPostExecute
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
ClassPresenterSelector ps = new ClassPresenterSelector();
FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);
detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
if (action.getId() == ACTION_PLAY) {
Intent intent = new Intent(getActivity(), PlayerActivity.class);
intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
ps.addClassPresenter(ListRow.class, new ListRowPresenter());
/** bonus code for adding related items to details fragment **/
// <START>
ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
adapter.add(detailRow);
String subcategories[] = {
"You may also like"
};
CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
manager.startDataLoading();
HeaderItem header = new HeaderItem(0, subcategories[0]);
adapter.add(new ListRow(header, rowAdapter));
setAdapter(adapter);
// <END>
}
示例8: onPostExecute
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
ClassPresenterSelector ps = new ClassPresenterSelector();
FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);
detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
if (action.getId() == ACTION_PLAY) {
Intent intent = new Intent(getActivity(), PlayerActivity.class);
intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
ps.addClassPresenter(ListRow.class,
new ListRowPresenter());
/** bonus code for adding related items to details fragment **/
// <START>
ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
adapter.add(detailRow);
String subcategories[] = {
"You may also like"
};
CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
manager.startDataLoading();
HeaderItem header = new HeaderItem(0, subcategories[0]);
adapter.add(new ListRow(header, rowAdapter));
setAdapter(adapter);
// <END>
}
示例9: onPostExecute
import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter; //导入方法依赖的package包/类
@Override
protected void onPostExecute(DetailsOverviewRow detailRow) {
ClassPresenterSelector ps = new ClassPresenterSelector();
FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext()));
detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL);
detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
if (action.getId() == ACTION_PLAY) {
Intent intent = new Intent(getActivity(), PlayerActivity.class);
intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo);
startActivity(intent);
} else {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
}
}
});
ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
ps.addClassPresenter(ListRow.class,
new ListRowPresenter());
/** bonus code for adding related items to details fragment **/
// <START>
ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps);
adapter.add(detailRow);
String subcategories[] = {
"You may also like"
};
CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter()));
VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter);
manager.startDataLoading();
HeaderItem header = new HeaderItem(0, subcategories[0]);
adapter.add(new ListRow(header, rowAdapter));
setAdapter(adapter);
// <END>
}