本文整理汇总了Java中android.support.v17.leanback.widget.GuidedAction类的典型用法代码示例。如果您正苦于以下问题:Java GuidedAction类的具体用法?Java GuidedAction怎么用?Java GuidedAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuidedAction类属于android.support.v17.leanback.widget包,在下文中一共展示了GuidedAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
GuidedAction enterUsername = new GuidedAction.Builder()
.title(getString(R.string.pref_title_username))
.descriptionEditable(true)
.build();
GuidedAction enterPassword = new GuidedAction.Builder()
.title(getString(R.string.pref_title_password))
.descriptionEditable(true)
.descriptionInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT)
.build();
GuidedAction login = new GuidedAction.Builder()
.id(CONTINUE)
.title(getString(R.string.guidedstep_continue))
.build();
actions.add(enterUsername);
actions.add(enterPassword);
actions.add(login);
}
示例2: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
GuidedAction enterUsername = new GuidedAction.Builder(getActivity())
.id(EMAIL)
.title(R.string.email)
.descriptionEditable(true)
.build();
GuidedAction enterPassword = new GuidedAction.Builder(getActivity())
.id(PASSWORD)
.title(R.string.password)
.descriptionEditable(true)
.descriptionInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT)
.build();
GuidedAction login = new GuidedAction.Builder(getActivity())
.id(LOGIN_ACTION)
.title(R.string.login)
.build();
actions.add(enterUsername);
actions.add(enterPassword);
actions.add(login);
}
示例3: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
String desc = getResources().getString(R.string.guidedstep_action_description);
actions.add(new GuidedAction.Builder()
.title(getResources().getString(R.string.guidedstep_action_title))
.description(desc)
.multilineDescription(true)
.infoOnly(true)
.enabled(false)
.build());
for (int i = 0; i < OPTION_NAMES.length; i++) {
addCheckedAction(actions,
OPTION_DRAWABLES[i],
getActivity(),
OPTION_NAMES[i],
OPTION_DESCRIPTIONS[i],
OPTION_CHECKED[i]);
}
}
示例4: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
sGeneralSwitch = NetworkAutoRefresh.autoRescanAtStart(getActivity());
actions.add(new GuidedAction.Builder()
.id(RESCAN_WHEN_OPENING_NO_ID)
.checkSetId(RescanFragment.RESCAN_WHEN_OPENING_ID)
.checked(!isOn())
.title(getString(R.string.no))
.build());
actions.add(new GuidedAction.Builder()
.id(RESCAN_WHEN_OPENING_YES_ID)
.checkSetId(RescanFragment.RESCAN_WHEN_OPENING_ID)
.checked(isOn())
.title(getString(R.string.yes))
.build());
}
示例5: onGuidedActionClicked
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onGuidedActionClicked(GuidedAction action) {
if(action.getId()==MANUAL_RESCAN_ID){
NetworkAutoRefresh.forceRescan(getActivity());
}
if(action.getId()==LAST_RESCAN_ID){
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.rescan_error_wifi_info_standby).setPositiveButton(android.R.string.ok, null);
builder.create().show();
}
else if (action.getId()==SCHEDULED_RESCAN_PERIOD_ID) {
add(getFragmentManager(), new ScheduledRescanPeriod());
}
else if (action.getId()==RESCAN_WHEN_OPENING_ID) {
add(getFragmentManager(), new RescanWhenOpeningApplication());
}
}
示例6: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
// for (int i = 0; i < MOVIE_LISTS.length; i++) {
// addAction(actions, i, MOVIE_LISTS[i], "");
// }
long x = 0;
for(Iterator<ListElem> i = lists.iterator(); i.hasNext();) {
ListElem elem = i.next();
if(elem.slug.equals("play-video")) {
addAction(actions, x, elem.title, "Stream: " + elem.action);
src_list.add(elem.videoType);
} else {
addAction(actions, x, elem.title, "");
}
x++;
}
}
示例7: onBindViewHolder
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder vh, GuidedAction action) {
super.onBindViewHolder(vh, action);
TextView descriptionView = vh.getDescriptionView();
if (descriptionView != null) {
if (action.getId() == ACTION_HEADER) {
descriptionView.setAlpha(ALPHA_CATEGORY);
descriptionView.setTextColor(getResources().getColor(R.color.setup_category,
null));
descriptionView.setTypeface(Typeface.create(
getString(R.string.condensed_font), 0));
} else {
descriptionView.setAlpha(ALPHA_INPUT_DESCRIPTION);
descriptionView.setTextColor(getResources().getColor(
R.color.common_setup_input_description, null));
descriptionView.setTypeface(Typeface.create(getString(R.string.font), 0));
}
}
}
示例8: onCreateActionsStylist
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public GuidedActionsStylist onCreateActionsStylist() {
return new GuidedActionsStylistWithDivider() {
@Override
public void onBindViewHolder(ViewHolder vh, GuidedAction action) {
super.onBindViewHolder(vh, action);
if (action.getId() == ACTION_DIVIDER) {
return;
}
LayoutParams lp = vh.itemView.getLayoutParams();
if (action.getCheckSetId() != GuidedAction.CHECKBOX_CHECK_SET_ID) {
lp.height = mOneLineActionHeight;
} else {
vh.itemView.setLayoutParams(
new LayoutParams(lp.width, LayoutParams.WRAP_CONTENT));
}
}
};
}
示例9: updateSelectAllState
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
private boolean updateSelectAllState() {
for (GuidedAction guidedAction : getActions()) {
if (guidedAction.getCheckSetId() == GuidedAction.CHECKBOX_CHECK_SET_ID) {
if (!guidedAction.isChecked()) {
if (mAllSelected) {
updateSelectAllState(findActionById(ACTION_ID_SELECT_ALL), false);
}
return false;
}
}
}
if (!mAllSelected) {
updateSelectAllState(findActionById(ACTION_ID_SELECT_ALL), true);
}
return true;
}
示例10: onGuidedActionClicked
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onGuidedActionClicked(GuidedAction action) {
if (action.getId() != ACTION_FORGET_STORAGE) {
dismissDialog();
return;
}
DvrManager dvrManager = TvApplication.getSingletons(getContext()).getDvrManager();
dvrManager.forgetStorage(mInputId);
Activity activity = getActivity();
if (activity instanceof DvrDetailsActivity) {
// Since we removed everything, just finish the activity.
activity.finish();
} else {
dismissDialog();
}
}
示例11: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
Activity activity = getActivity();
actions.add(new GuidedAction.Builder(activity)
.id(ACTION_DONE)
.title(getResources().getString(R.string.dvr_action_error_done))
.build());
DvrDataManager dvrDataManager = TvApplication.getSingletons(getContext())
.getDvrDataManager();
if (!(dvrDataManager.getRecordedPrograms().isEmpty()
&& dvrDataManager.getStartedRecordings().isEmpty()
&& dvrDataManager.getNonStartedScheduledRecordings().isEmpty()
&& dvrDataManager.getSeriesRecordings().isEmpty())) {
actions.add(new GuidedAction.Builder(activity)
.id(ACTION_OPEN_DVR)
.title(getResources().getString(R.string.dvr_action_error_open_dvr))
.build());
}
}
示例12: onGuidedActionClicked
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onGuidedActionClicked(GuidedAction action) {
if (action.getId() == ACTION_STOP_SERIES_RECORDING) {
ApplicationSingletons singletons = TvApplication.getSingletons(getContext());
DvrManager dvrManager = singletons.getDvrManager();
DvrDataManager dataManager = singletons.getDvrDataManager();
List<ScheduledRecording> toDelete = new ArrayList<>();
for (ScheduledRecording r : dataManager.getAvailableScheduledRecordings()) {
if (r.getSeriesRecordingId() == mSeriesRecording.getId()) {
if (r.getState() == ScheduledRecording.STATE_RECORDING_NOT_STARTED) {
toDelete.add(r);
} else {
dvrManager.stopRecording(r);
}
}
}
if (!toDelete.isEmpty()) {
dvrManager.forceRemoveScheduledRecording(ScheduledRecording.toArray(toDelete));
}
dvrManager.updateSeriesRecording(SeriesRecording.buildFrom(mSeriesRecording)
.setState(SeriesRecording.STATE_SERIES_STOPPED).build());
}
dismissDialog();
}
示例13: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
Context context = getContext();
String description;
if (mProgram.getStartTimeUtcMillis() <= System.currentTimeMillis()) {
description = getString(R.string.dvr_action_record_episode_from_now_description,
DateUtils.formatDateTime(context, mProgram.getEndTimeUtcMillis(),
DateUtils.FORMAT_SHOW_TIME));
} else {
description = Utils.getDurationString(context, mProgram.getStartTimeUtcMillis(),
mProgram.getEndTimeUtcMillis(), true);
}
actions.add(new GuidedAction.Builder(context)
.id(ACTION_RECORD_EPISODE)
.title(R.string.dvr_action_record_episode)
.description(description)
.build());
actions.add(new GuidedAction.Builder(context)
.id(ACTION_RECORD_SERIES)
.title(R.string.dvr_action_record_series)
.description(mProgram.getTitle())
.build());
}
示例14: onCreateActions
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
int actionId = -1;
mDurations.clear();
mDurations.add(TimeUnit.MINUTES.toMillis(10));
mDurations.add(TimeUnit.MINUTES.toMillis(30));
mDurations.add(TimeUnit.HOURS.toMillis(1));
mDurations.add(TimeUnit.HOURS.toMillis(3));
actions.add(new GuidedAction.Builder(getContext())
.id(++actionId)
.title(R.string.recording_start_dialog_10_min_duration)
.build());
actions.add(new GuidedAction.Builder(getContext())
.id(++actionId)
.title(R.string.recording_start_dialog_30_min_duration)
.build());
actions.add(new GuidedAction.Builder(getContext())
.id(++actionId)
.title(R.string.recording_start_dialog_1_hour_duration)
.build());
actions.add(new GuidedAction.Builder(getContext())
.id(++actionId)
.title(R.string.recording_start_dialog_3_hours_duration)
.build());
}
示例15: onGuidedActionClicked
import android.support.v17.leanback.widget.GuidedAction; //导入依赖的package包/类
@Override
public void onGuidedActionClicked(GuidedAction action) {
DvrManager dvrManager = TvApplication.getSingletons(getContext()).getDvrManager();
long duration = mDurations.get((int) action.getId());
long startTimeMs = System.currentTimeMillis();
long endTimeMs = System.currentTimeMillis() + duration;
List<ScheduledRecording> conflicts = dvrManager.getConflictingSchedules(
mChannel.getId(), startTimeMs, endTimeMs);
dvrManager.addSchedule(mChannel, startTimeMs, endTimeMs);
if (conflicts.isEmpty()) {
dismissDialog();
} else {
GuidedStepFragment fragment = new DvrChannelRecordConflictFragment();
Bundle args = new Bundle();
args.putLong(DvrHalfSizedDialogFragment.KEY_CHANNEL_ID, mChannel.getId());
args.putLong(DvrHalfSizedDialogFragment.KEY_START_TIME_MS, startTimeMs);
args.putLong(DvrHalfSizedDialogFragment.KEY_END_TIME_MS, endTimeMs);
fragment.setArguments(args);
GuidedStepFragment.add(getFragmentManager(), fragment,
R.id.halfsized_dialog_host);
}
}