本文整理汇总了Java中android.support.v17.leanback.widget.DetailsOverviewRow.setImageDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java DetailsOverviewRow.setImageDrawable方法的具体用法?Java DetailsOverviewRow.setImageDrawable怎么用?Java DetailsOverviewRow.setImageDrawable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v17.leanback.widget.DetailsOverviewRow
的用法示例。
在下文中一共展示了DetailsOverviewRow.setImageDrawable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: addActions
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
public void addActions(DetailsOverviewRow detailRow){
detailRow.addAction(new Action(ACTION_OPEN, getResources().getString(R.string.open_indexed_folder)));
if(ShortcutDbAdapter.VIDEO.isShortcut(getActivity(), mShortcut.getUri().toString())<0) {
detailRow.addAction(new Action(ACTION_ADD_INDEX, getResources().getString(R.string.add_to_indexed_folders)));
}
else
detailRow.addAction(new Action(ACTION_REINDEX, getResources().getString(R.string.network_reindex)));
detailRow.addAction(new Action(ACTION_REMOVE, getResources().getString(R.string.remove_from_shortcuts)));
detailRow.setImageDrawable(getResources().getDrawable(R.drawable.filetype_new_server));
}
示例3: generateAboutMeRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private Row generateAboutMeRow() {
AboutItem aboutItem = new AboutItem();
aboutItem.setTitle(getString(R.string.about_me_title));
aboutItem.setSubtitle(getString(R.string.about_me_subtitle));
aboutItem.setBody(getString(R.string.about_me_body));
DetailsOverviewRow overviewRow = new DetailsOverviewRow(aboutItem);
overviewRow.setImageDrawable(getResources().getDrawable(R.drawable.about_me_photo));
return overviewRow;
}
示例4: generateAboutGDGRow
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private Row generateAboutGDGRow() {
AboutItem aboutItem = new AboutItem();
aboutItem.setTitle(getString(R.string.about_gdg_title));
aboutItem.setSubtitle(getString(R.string.about_gdg_subtitle));
aboutItem.setBody(getString(R.string.about_gdg_body));
DetailsOverviewRow overviewRow = new DetailsOverviewRow(aboutItem);
overviewRow.setImageDrawable(getResources().getDrawable(R.drawable.about_gdg_photo));
overviewRow.addAction(new Action(JOIN_GDG, getString(R.string.about_gdg_action_one)));
return overviewRow;
}
示例5: 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);
}
示例6: addActions
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
public void addActions(DetailsOverviewRow detailRow){
detailRow.addAction(new Action(ACTION_OPEN, getResources().getString(R.string.open_indexed_folder)));
detailRow.addAction(new Action(ACTION_REINDEX, getResources().getString(R.string.network_reindex)));
detailRow.addAction(new Action(ACTION_REMOVE, getResources().getString(R.string.remove_from_indexed_folders)));
detailRow.setImageDrawable(getResources().getDrawable(R.drawable.filetype_new_folder_indexed));
}
示例7: 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);
}
示例8: 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);
}
示例9: setupUi
import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupUi() {
Bundle extras = getActivity().getIntent().getExtras();
Card.Type cardType = Card.Type.DEFAULT;
if (extras != null && extras.containsKey("abouttype")) {
int ordinal = extras.getInt("abouttype", 0);
cardType = Card.Type.values()[ordinal];
}
IconCard card = IconCardHelper.getAboutCardByType(getActivity(), cardType);
ClassPresenterSelector selector = new ClassPresenterSelector();
FullWidthDetailsOverviewRowPresenter rowPresenter = new FullWidthDetailsOverviewRowPresenter(
new AboutDetailsPresenter(getActivity())) {
@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
// Customize Actionbar and Content by using custom colors.
RowPresenter.ViewHolder viewHolder = super.createRowViewHolder(parent);
View actionsView = viewHolder.view.
findViewById(R.id.details_overview_actions_background);
actionsView.setBackgroundColor(getActivity().getResources().
getColor(R.color.color_primary_dark));
View detailsView = viewHolder.view.findViewById(R.id.details_frame);
detailsView.setBackgroundColor(
getResources().getColor(R.color.color_primary_dark));
return viewHolder;
}
};
selector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
selector.addClassPresenter(ListRow.class,
new ListRowPresenter());
ArrayObjectAdapter mRowsAdapter = new ArrayObjectAdapter(selector);
Resources res = getActivity().getResources();
DetailsOverviewRow detailsOverview = new DetailsOverviewRow(
card);
// Add images and action buttons to the details view
detailsOverview.setImageDrawable(res.getDrawable(R.drawable.ic_logo_ring_white));
mRowsAdapter.add(detailsOverview);
setAdapter(mRowsAdapter);
initializeBackground();
}