本文整理汇总了Java中android.support.v17.leanback.widget.DetailsOverviewRow.setImageBitmap方法的典型用法代码示例。如果您正苦于以下问题:Java DetailsOverviewRow.setImageBitmap方法的具体用法?Java DetailsOverviewRow.setImageBitmap怎么用?Java DetailsOverviewRow.setImageBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v17.leanback.widget.DetailsOverviewRow
的用法示例。
在下文中一共展示了DetailsOverviewRow.setImageBitmap方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: configureDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private DetailsOverviewRow configureDetailsOverviewRow(CardInfo cardInfo, Bitmap bitmap) {
final DetailsOverviewRow row = new DetailsOverviewRow(cardInfo);
row.setImageBitmap(getActivity(), bitmap);
row.addAction(new Action(VD_CALL_ACTION_ID, getString(R.string.vd_call_action_title)));
row.addAction(new Action(CALL_ACTION_ID, getString(R.string.call_action_title)));
row.addAction(new Action(CHAT_ACTION_ID, getString(R.string.chat_action_title)));
row.addAction(new Action(EDIT_ACTION_ID, getString(R.string.edit_action_title)));
return row;
}
示例6: doInBackground
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Video... videos) {
mVideo = videos[0];
DetailsOverviewRow row = new DetailsOverviewRow(mVideo);
try {
Bitmap poster = Picasso.with(mActivity)
.load(mVideo.getCardImageUrl())
.resize(Utils.dpToPx(DETAIL_THUMB_WIDTH, mActivity.getApplicationContext()),
Utils.dpToPx(DETAIL_THUMB_HEIGHT, mActivity.getApplicationContext()))
.centerCrop()
.get();
row.setImageBitmap(mActivity, poster);
} catch (IOException e) {
e.printStackTrace();
}
if (mShowPlayButton) {
row.addAction(new Action(ACTION_PLAY, mActivity.getString(R.string.play)));
}
if (mVideo.getMovie() != null && !TextUtils.isEmpty(mVideo.getMovie().getTrailer())) {
row.addAction(
new Action(ACTION_VIEW_TRAILER, mActivity.getString(R.string.watch_trailer)));
}
return row;
}
示例7: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String displayNumber = getActivity().getIntent().getStringExtra(
RichFeedUtil.EXTRA_DISPLAY_NUMBER);
DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(
new DetailsDescriptionPresenter());
dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment");
DetailsOverviewRow row = new DetailsOverviewRow(displayNumber);
Resources res = getResources();
Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.nejnettv);
int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
(bitmap.getWidth() - length) / 2,
(bitmap.getHeight() - length) / 2,
length, length);
row.setImageBitmap(getActivity(), croppedBitmap);
Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1));
Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2));
row.addAction(action1);
row.addAction(action2);
ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
dorPresenter.setBackgroundColor(res.getColor(R.color.detail_background));
dorPresenter.setStyleLarge(true);
dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
getActivity().finish();
}
});
presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
adapter.add(row);
setAdapter(adapter);
}
示例8: initUIs
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void initUIs(Bitmap bitmap) {
DetailsOverviewRowPresenter dorPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
dorPresenter.setSharedElementEnterTransition(getActivity(), "SetUpFragment");
mAddChannelAction = new Action(ACTION_ADD_CHANNELS,
getResources().getString(R.string.rich_setup_add_channel));
Action cancelAction = new Action(ACTION_CANCEL,
getResources().getString(R.string.rich_setup_cancel));
mInProgressAction = new Action(ACTION_IN_PROGRESS,
getResources().getString(R.string.rich_setup_in_progress));
DetailsOverviewRow row = new DetailsOverviewRow(mTvListing);
if (bitmap != null) {
int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
(bitmap.getWidth() - length) / 2,
(bitmap.getHeight() - length) / 2,
length, length);
row.setImageBitmap(getActivity(), croppedBitmap);
}
row.addAction(mAddChannelAction);
row.addAction(cancelAction);
ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
// 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_ADD_CHANNELS) {
setupChannels(mInputId);
} else if (action.getId() == ACTION_CANCEL) {
getActivity().finish();
}
}
});
presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
mAdapter = new ArrayObjectAdapter(presenterSelector);
mAdapter.add(row);
setAdapter(mAdapter);
BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
backgroundManager.attach(getActivity().getWindow());
if (bitmap != null) {
backgroundManager.setBitmap(bitmap);
} else {
backgroundManager.setDrawable(
getActivity().getDrawable(R.drawable.default_background));
}
}
示例9: doInBackground
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(BaseItemDto... baseItem) {
DetailsOverviewRow row = new DetailsOverviewRow(mBaseItem);
try {
Bitmap poster = Picasso.with(getActivity())
.load(Utils.getPrimaryImageUrl(mBaseItem, mApiClient, true, false, Utils.convertDpToPixel(mApplication, DETAIL_THUMB_HEIGHT)))
.resize(Utils.convertDpToPixel(mApplication,DETAIL_THUMB_WIDTH),
Utils.convertDpToPixel(mApplication, DETAIL_THUMB_HEIGHT))
.centerInside()
.get();
row.setImageBitmap(getActivity(), poster);
} catch (IOException e) {
}
UserItemDataDto userData = mBaseItem.getUserData();
if (userData != null && userData.getPlaybackPositionTicks() > 0) {
row.addAction(new Action(ACTION_RESUME, "Resume"));
}
switch (mBaseItem.getType()) {
case "Person":
case "Photo":
break;
default:
if (mBaseItem.getIsFolder() && Utils.CanPlay(mBaseItem)) {
row.addAction(new Action(ACTION_PLAY, "Play All"));
row.addAction(new Action(ACTION_SHUFFLE, "Shuffle All"));
} else {
if (Utils.CanPlay(mBaseItem)) row.addAction(new Action(ACTION_PLAY, "Play"));
if (mProgramInfo != null && TvApp.getApplication().getCurrentUser().getPolicy().getEnableLiveTvManagement()) {
//Add record buttons
if (mProgramInfo.getTimerId() != null) {
//existing recording
row.addAction(new Action(ACTION_CANCEL_RECORD, "Cancel"));
} else {
row.addAction(new Action(ACTION_RECORD, "Record"));
}
}
row.addAction(new Action(ACTION_DETAILS, "Details"));
}
}
return row;
}
示例10: onCreate
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String displayNumber = getActivity().getIntent().getStringExtra(
RichFeedUtil.EXTRA_DISPLAY_NUMBER);
DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(
new DetailsDescriptionPresenter());
dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment");
DetailsOverviewRow row = new DetailsOverviewRow(displayNumber);
Resources res = getResources();
Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.your_company);
int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
(bitmap.getWidth() - length) / 2,
(bitmap.getHeight() - length) / 2,
length, length);
row.setImageBitmap(getActivity(), croppedBitmap);
Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1));
Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2));
row.addAction(action1);
row.addAction(action2);
ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
dorPresenter.setBackgroundColor(ContextCompat.getColor(getActivity(),
R.color.detail_background));
dorPresenter.setStyleLarge(true);
dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
getActivity().finish();
}
});
presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
adapter.add(row);
setAdapter(adapter);
}