本文整理汇总了Java中android.support.v17.leanback.widget.SparseArrayObjectAdapter.set方法的典型用法代码示例。如果您正苦于以下问题:Java SparseArrayObjectAdapter.set方法的具体用法?Java SparseArrayObjectAdapter.set怎么用?Java SparseArrayObjectAdapter.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v17.leanback.widget.SparseArrayObjectAdapter
的用法示例。
在下文中一共展示了SparseArrayObjectAdapter.set方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateActionsAdapter
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的package包/类
@Override
protected SparseArrayObjectAdapter onCreateActionsAdapter() {
mActionsAdapter = new SparseArrayObjectAdapter(new ActionPresenterSelector());
Resources res = getResources();
updateWatchAction();
mActionsAdapter.set(ACTION_SERIES_SCHEDULES, new Action(ACTION_SERIES_SCHEDULES,
getString(R.string.dvr_detail_view_schedule), null,
res.getDrawable(R.drawable.ic_schedule_32dp, null)));
mDeleteAction = new Action(ACTION_DELETE,
getString(R.string.dvr_detail_series_delete), null,
res.getDrawable(R.drawable.ic_delete_32dp, null));
if (!mRecordedPrograms.isEmpty()) {
mActionsAdapter.set(ACTION_DELETE, mDeleteAction);
}
return mActionsAdapter;
}
示例2: onCreateActionsAdapter
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的package包/类
@Override
protected SparseArrayObjectAdapter onCreateActionsAdapter() {
SparseArrayObjectAdapter adapter =
new SparseArrayObjectAdapter(new ActionPresenterSelector());
Resources res = getResources();
if (!mHideViewSchedule) {
mScheduleAction = new Action(ACTION_VIEW_SCHEDULE,
res.getString(R.string.dvr_detail_view_schedule), null,
res.getDrawable(getScheduleIconId()));
adapter.set(ACTION_VIEW_SCHEDULE, mScheduleAction);
}
adapter.set(ACTION_CANCEL, new Action(ACTION_CANCEL,
res.getString(R.string.epg_dvr_dialog_message_remove_recording_schedule), null,
res.getDrawable(R.drawable.ic_dvr_cancel_32dp)));
return adapter;
}
示例3: onCreateActionsAdapter
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的package包/类
@Override
protected SparseArrayObjectAdapter onCreateActionsAdapter() {
SparseArrayObjectAdapter adapter =
new SparseArrayObjectAdapter(new ActionPresenterSelector());
Resources res = getResources();
if (mDvrWatchedPositionManager.getWatchedStatus(mRecordedProgram)
== DvrWatchedPositionManager.DVR_WATCHED_STATUS_WATCHING) {
adapter.set(ACTION_RESUME_PLAYING, new Action(ACTION_RESUME_PLAYING,
res.getString(R.string.dvr_detail_resume_play), null,
res.getDrawable(R.drawable.lb_ic_play)));
adapter.set(ACTION_PLAY_FROM_BEGINNING, new Action(ACTION_PLAY_FROM_BEGINNING,
res.getString(R.string.dvr_detail_play_from_beginning), null,
res.getDrawable(R.drawable.lb_ic_replay)));
} else {
adapter.set(ACTION_PLAY_FROM_BEGINNING, new Action(ACTION_PLAY_FROM_BEGINNING,
res.getString(R.string.dvr_detail_watch), null,
res.getDrawable(R.drawable.lb_ic_play)));
}
adapter.set(ACTION_DELETE_RECORDING, new Action(ACTION_DELETE_RECORDING,
res.getString(R.string.dvr_detail_delete), null,
res.getDrawable(R.drawable.ic_delete_32dp)));
return adapter;
}
示例4: doInBackground
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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;
}
示例5: setupDetailsOverviewRow
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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);
}
示例6: setupDetailsOverviewRow
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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);
}
示例7: setupDetailsOverviewRow
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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);
}
示例8: onCreateActionsAdapter
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的package包/类
@Override
protected SparseArrayObjectAdapter onCreateActionsAdapter() {
SparseArrayObjectAdapter adapter =
new SparseArrayObjectAdapter(new ActionPresenterSelector());
Resources res = getResources();
adapter.set(ACTION_STOP_RECORDING, new Action(ACTION_STOP_RECORDING,
res.getString(R.string.epg_dvr_dialog_message_stop_recording), null,
res.getDrawable(R.drawable.lb_ic_stop)));
return adapter;
}
示例9: onCreatePrimaryActions
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的package包/类
@Override
protected void onCreatePrimaryActions(SparseArrayObjectAdapter primaryActionsAdapter) {
this.primaryActionsAdapter = primaryActionsAdapter;
closedCaptionAction = new PlaybackControlsRow.ClosedCaptioningAction(getContext());
closedCaptionAction.setIndex(PlaybackControlsRow.ClosedCaptioningAction.ON);
primaryActionsAdapter.notifyArrayItemRangeChanged(primaryActionsAdapter.indexOf(closedCaptionAction), 1);
primaryActionsAdapter.set(ACTION_CUSTOM_RIGHT_FIRST, closedCaptionAction);
}
示例10: setupDetailsOverviewRow
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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);
}
示例11: setupDetailsOverviewRow
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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);
}
示例12: createActions
import android.support.v17.leanback.widget.SparseArrayObjectAdapter; //导入方法依赖的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);
}