本文整理汇总了Java中android.support.v17.leanback.widget.DetailsOverviewRow.setActionsAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java DetailsOverviewRow.setActionsAdapter方法的具体用法?Java DetailsOverviewRow.setActionsAdapter怎么用?Java DetailsOverviewRow.setActionsAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v17.leanback.widget.DetailsOverviewRow
的用法示例。
在下文中一共展示了DetailsOverviewRow.setActionsAdapter方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedVideo);
Glide.with(this)
.load(mSelectedVideo.cardImageUrl)
.asBitmap()
.dontAnimate()
.error(R.drawable.default_background)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(final Bitmap resource,
GlideAnimation glideAnimation) {
row.setImageBitmap(getActivity(), resource);
startEntranceTransition();
}
});
SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
adapter.set(ACTION_WATCH_TRAILER, new Action(ACTION_WATCH_TRAILER, getResources()
.getString(R.string.watch_trailer_1),
getResources().getString(R.string.watch_trailer_2)));
adapter.set(ACTION_RENT, new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
adapter.set(ACTION_BUY, new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
row.setActionsAdapter(adapter);
mAdapter.add(row);
}
示例3: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedVideo);
Glide.with(this)
.load(mSelectedVideo.cardImageUrl)
.asBitmap()
.dontAnimate()
.error(R.drawable.default_background)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(final Bitmap resource,
GlideAnimation glideAnimation) {
row.setImageBitmap(getActivity(), resource);
startEntranceTransition();
}
});
SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
adapter.set(ACTION_PLAY_NOW, new Action(ACTION_PLAY_NOW, getResources()
.getString(R.string.play_now)));
adapter.set(ACTION_PLAY_FROM, new Action(ACTION_PLAY_FROM, getResources().getString(R.string.play_from)));
// adapter.set(ACTION_PLAY_TRAILER, new Action(ACTION_PLAY_TRAILER, getResources().getString(R.string.play_trailer)));
if(Chilly.getInstance(getActivity().getApplicationContext()).userLoggedIn()){
adapter.set(ACTION_TRAKT, new Action(ACTION_TRAKT, "TRAKT"));
}
row.setActionsAdapter(adapter);
mAdapter.add(row);
}
示例4: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
final DetailsOverviewRow row = new DetailsOverviewRow(mMovie);
Glide.with(this)
.load(mMovie.getCardImage())
.asBitmap()
.dontAnimate()
.error(R.drawable.assistant_tv_banner)
.into(
new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(
final Bitmap resource, GlideAnimation glideAnimation) {
row.setImageBitmap(getActivity(), resource);
}
});
SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
adapter.set(
ACTION_WATCH, new Action(ACTION_WATCH, getResources().getString(R.string.watch)));
adapter.set(
ACTION_RENT,
new Action(
ACTION_RENT,
getResources().getString(R.string.rent),
mMovie.getRentalPrice()));
adapter.set(
ACTION_BUY,
new Action(
ACTION_BUY,
getResources().getString(R.string.buy),
mMovie.getPurchasePrice()));
row.setActionsAdapter(adapter);
mAdapter.add(row);
}
示例5: setDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
/**
* Sets details overview.
*/
protected void setDetailsOverviewRow(DetailsContent detailsContent) {
mDetailsOverview = new DetailsOverviewRow(detailsContent);
mDetailsOverview.setActionsAdapter(onCreateActionsAdapter());
mRowsAdapter.add(mDetailsOverview);
onLoadLogoAndBackgroundImages(detailsContent);
}
示例6: provideDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Provides
@PerFragment
DetailsOverviewRow provideDetailsOverviewRow(
@DetailFragmentArrayObjectAdapterForActionsQualifier ArrayObjectAdapter adapter) {
DetailsOverviewRow row = new DetailsOverviewRow(new Object());
row.setActionsAdapter(adapter);
return row;
}
示例7: createDetailsRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void createDetailsRow() {
actionsAdapter = new ArrayObjectAdapter();
populateActionsAdapter();
mDetailsRow = new DetailsOverviewRow(new Object());
mDetailsRow.setActionsAdapter(actionsAdapter);
mRowsAdapter.add(0, mDetailsRow);
}
示例8: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedVideo);
RequestOptions options = new RequestOptions()
.error(R.drawable.default_background)
.dontAnimate();
Glide.with(this)
.asBitmap()
.load(mSelectedVideo.cardImageUrl)
.apply(options)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(
Bitmap resource,
Transition<? super Bitmap> transition) {
row.setImageBitmap(getActivity(), resource);
startEntranceTransition();
}
});
SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
adapter.set(ACTION_WATCH_TRAILER, new Action(ACTION_WATCH_TRAILER, getResources()
.getString(R.string.watch_trailer_1),
getResources().getString(R.string.watch_trailer_2)));
adapter.set(ACTION_RENT, new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
adapter.set(ACTION_BUY, new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
row.setActionsAdapter(adapter);
mAdapter.add(row);
}
示例9: 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(
ContextCompat.getDrawable(getActivity(), R.drawable.default_background));
int width = convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH);
int height = 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());
}
});
ArrayObjectAdapter actionAdapter = new ArrayObjectAdapter();
actionAdapter.add(
new Action(
ACTION_WATCH_TRAILER,
getResources().getString(R.string.watch_trailer_1),
getResources().getString(R.string.watch_trailer_2)));
actionAdapter.add(
new Action(
ACTION_RENT,
getResources().getString(R.string.rent_1),
getResources().getString(R.string.rent_2)));
actionAdapter.add(
new Action(
ACTION_BUY,
getResources().getString(R.string.buy_1),
getResources().getString(R.string.buy_2)));
row.setActionsAdapter(actionAdapter);
mAdapter.add(row);
}
示例10: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
Log.d(TAG, "doInBackground: " + mSelectedApk.toString());
final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedApk);
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(mSelectedApk.getIcon())
.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());
}
});
// See if this is already installed. If so, check if it can be updated.
// Offer an uninstall option.
// Add an install button.
SparseArrayObjectAdapter possibleActions = new SparseArrayObjectAdapter();
PackageManager packageManager = getActivity().getPackageManager();
try {
PackageInfo info = packageManager.getPackageInfo(mSelectedApk.getPackageName(), 0);
if (info.versionCode < mSelectedApk.getVersionCode()) {
possibleActions.set(ACTION_UPDATE,
new Action(ACTION_UPDATE, getString(R.string.update)));
}
possibleActions.set(ACTION_UNINSTALL,
new Action(ACTION_UNINSTALL, getString(R.string.uninstall)));
} catch (PackageManager.NameNotFoundException e) {
// App is not installed
possibleActions.set(ACTION_INSTALL,
new Action(ACTION_INSTALL, getString(R.string.install)));
}
row.setActionsAdapter(possibleActions);
mAdapter.add(row);
}
示例11: createActions
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void createActions(DetailsOverviewRow detailsRow) {
SparseArrayObjectAdapter actionsAdapter = new SparseArrayObjectAdapter();
actionsAdapter.set(ACTION_PLAY,
new Action(ACTION_PLAY, getString(R.string.ondemand_details_action_play)));
detailsRow.setActionsAdapter(actionsAdapter);
}
示例12: setupDetailsOverviewRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
final DetailsOverviewRow row = new DetailsOverviewRow(jsonChannel);
row.setImageDrawable(getResources().getDrawable(R.drawable.c_background5));
int width = Utils.convertDpToPixel(getActivity()
.getApplicationContext(), DETAIL_THUMB_WIDTH);
int height = Utils.convertDpToPixel(getActivity()
.getApplicationContext(), DETAIL_THUMB_HEIGHT);
new Thread(new Runnable() {
@Override
public void run() {
try {
final Bitmap bitmap = Glide.with(getActivity())
.load(ChannelDatabase.getNonNullChannelLogo(jsonChannel))
.asBitmap()
.fitCenter()
.error(R.drawable.c_background5)
.into(DETAIL_THUMB_WIDTH, DETAIL_THUMB_HEIGHT)
.get();
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
row.setImageBitmap(getActivity(), bitmap);
mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
}
});
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}).start();
ArrayObjectAdapter actions = new ArrayObjectAdapter();
// Add another action IF it isn't a channel you already have:
ChannelDatabase cdn = ChannelDatabase.getInstance(getActivity());
if(cdn.findChannelByMediaUrl(jsonChannel.getMediaUrl()) == null) {
actions.add(new Action(ACTION_ADD, getString(R.string.add_channel_txt)));
} else {
actions.add(new Action(ACTION_EDIT, getString(R.string.edit_channel)));
}
actions.add(new Action(ACTION_WATCH, getString(R.string.play)));
row.setActionsAdapter(actions);
mAdapter.add(row);
}