Java 类android.support.v17.leanback.widget.GuidedAction 实例源码

项目:lostfilm-android-client    文件:LoginFragment.java   
@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);
}
项目:androidtv-sample    文件:AuthenticationActivity.java   
@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);
}
项目:androidtv-sample    文件:GuidedStepActivity.java   
@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]);
    }
}
项目:aos-Video    文件:RescanWhenOpeningApplication.java   
@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());
}
项目:aos-Video    文件:RescanFragment.java   
@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());
    }
}
项目:chilly    文件:AuthenticationActivity.java   
@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);
}
项目:chilly    文件:ListSelectActivity.java   
@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++;
            }

        }
项目:chilly    文件:GuidedStepActivity.java   
@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]);
    }
}
项目:android_packages_apps_tv    文件:SetupSourcesFragment.java   
@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));
        }
    }
}
项目:android_packages_apps_tv    文件:SeriesDeletionFragment.java   
@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));
            }
        }
    };
}
项目:android_packages_apps_tv    文件:SeriesDeletionFragment.java   
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;
}
项目:android_packages_apps_tv    文件:DvrForgetStorageErrorFragment.java   
@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();
    }
}
项目:android_packages_apps_tv    文件:DvrInsufficientSpaceErrorFragment.java   
@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());
    }
}
项目:android_packages_apps_tv    文件:DvrStopSeriesRecordingFragment.java   
@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();
}
项目:android_packages_apps_tv    文件:DvrScheduleFragment.java   
@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());
}
项目:android_packages_apps_tv    文件:DvrChannelRecordDurationOptionFragment.java   
@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());
}
项目:android_packages_apps_tv    文件:DvrChannelRecordDurationOptionFragment.java   
@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);
    }
}
项目:android_packages_apps_tv    文件:PrioritySettingsFragment.java   
@Override
public void onGuidedActionFocused(GuidedAction action) {
    super.onGuidedActionFocused(action);
    if (mSelectedRecording == null) {
        return;
    }
    if (action.getId() < 0) {
        int selectedPosition = mSeriesRecordings.indexOf(mSelectedRecording);
        mSelectedRecording = null;
        for (int i = 0; i < mSeriesRecordings.size(); ++i) {
            updateItem(i);
        }
        return;
    }
    int position = (int) action.getId();
    int previousPosition = mSeriesRecordings.indexOf(mSelectedRecording);
    mSeriesRecordings.remove(mSelectedRecording);
    mSeriesRecordings.add(position, mSelectedRecording);
    updateItem(previousPosition);
    updateItem(position);
    notifyActionChanged(previousPosition);
    notifyActionChanged(position);
}
项目:android_packages_apps_tv    文件:DvrAlreadyScheduledFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    Context context = getContext();
    actions.add(new GuidedAction.Builder(context)
            .id(ACTION_RECORD_ANYWAY)
            .title(R.string.dvr_action_record_anyway)
            .build());
    actions.add(new GuidedAction.Builder(context)
            .id(ACTION_RECORD_INSTEAD)
            .title(R.string.dvr_action_record_instead)
            .build());
    actions.add(new GuidedAction.Builder(context)
            .id(ACTION_CANCEL)
            .title(R.string.dvr_action_record_cancel)
            .build());
}
项目:android_packages_apps_tv    文件:SeriesSettingsFragment.java   
@Override
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
    mPriorityGuidedAction = new GuidedAction.Builder(getActivity())
            .id(ACTION_ID_PRIORITY)
            .title(mProrityActionTitle)
            .build();
    updatePriorityGuidedAction(false);
    actions.add(mPriorityGuidedAction);

    mChannelsGuidedAction = new GuidedAction.Builder(getActivity())
            .id(ACTION_ID_CHANNEL)
            .title(mChannelsActionTitle)
            .subActions(buildChannelSubAction())
            .build();
    actions.add(mChannelsGuidedAction);
    updateChannelsGuidedAction(false);
}
项目:android_packages_apps_tv    文件:SeriesSettingsFragment.java   
@Override
public boolean onSubGuidedActionClicked(GuidedAction action) {
    long actionId = action.getId();
    if (actionId == SUB_ACTION_ID_CHANNEL_ALL) {
        mChannelOption = SeriesRecording.OPTION_CHANNEL_ALL;
        mSelectedChannelId = Channel.INVALID_ID;
        updateChannelsGuidedAction(true);
        return true;
    } else if (actionId > SUB_ACTION_ID_CHANNEL_ONE_BASE) {
        mChannelOption = SeriesRecording.OPTION_CHANNEL_ONE;
        mSelectedChannelId = actionId - SUB_ACTION_ID_CHANNEL_ONE_BASE;
        updateChannelsGuidedAction(true);
        return true;
    }
    return false;
}
项目:android_packages_apps_tv    文件:DvrConflictFragment.java   
@Override
public void onGuidedActionClicked(GuidedAction action) {
    if (action.getId() == ACTION_CANCEL) {
        ConflictChecker checker = ((MainActivity) getContext()).getDvrConflictChecker();
        if (checker != null) {
            checker.setCheckedConflictsForChannel(mChannelId, getConflicts());
        }
    } else if (action.getId() == ACTION_DELETE_CONFLICT) {
        for (ScheduledRecording schedule : mConflicts) {
            if (schedule.getState() == ScheduledRecording.STATE_RECORDING_IN_PROGRESS) {
                getDvrManager().stopRecording(schedule);
            } else {
                getDvrManager().removeScheduledRecording(schedule);
            }
        }
    }
    super.onGuidedActionClicked(action);
}
项目:android_packages_apps_tv    文件:DvrAlreadyRecordedFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    Context context = getContext();
    actions.add(new GuidedAction.Builder(context)
            .id(ACTION_RECORD_ANYWAY)
            .title(R.string.dvr_action_record_anyway)
            .build());
    actions.add(new GuidedAction.Builder(context)
            .id(ACTION_WATCH)
            .title(R.string.dvr_action_watch_now)
            .build());
    actions.add(new GuidedAction.Builder(context)
            .id(ACTION_CANCEL)
            .title(R.string.dvr_action_record_cancel)
            .build());
}
项目:android_packages_apps_tv    文件:ScanResultFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions,
        Bundle savedInstanceState) {
    String[] choices;
    int doneActionIndex;
    if (mChannelCountOnPreference > 0) {
        choices = getResources().getStringArray(R.array.ut_result_found_choices);
        doneActionIndex = 0;
    } else {
        choices = getResources().getStringArray(R.array.ut_result_not_found_choices);
        doneActionIndex = 1;
    }
    for (int i = 0; i < choices.length; ++i) {
        if (i == doneActionIndex) {
            actions.add(new GuidedAction.Builder(getActivity()).id(ACTION_DONE)
                    .title(choices[i]).build());
        } else {
            actions.add(new GuidedAction.Builder(getActivity()).id(i).title(choices[i])
                    .build());
        }
    }
}
项目:popcorn-android    文件:PTVPreferencesFragment.java   
private GuidedAction generateAction(long id, PrefItem item) {
    GuidedAction.Builder builder = new GuidedAction.Builder()
            .id(id)
            .hasNext(item.hasNext())
            .enabled(item.isClickable())
            .infoOnly(item.isTitle() || !item.isClickable())
            .title(item.isTitle() ? item.getTitle().toUpperCase(LocaleUtils.getCurrent()) : item.getTitle());

    if (!item.isTitle()) {
        builder.description(item.getSubtitle());
        if(item.getDefaultValue() instanceof Boolean) {
            builder.checked((Boolean) item.getValue());
        }
    }

    return builder.build();
}
项目:popcorn-android    文件:PTVPreferencesListFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    String[] items = getArguments().getStringArray(ITEMS_ARG);
    int current = getArguments().getInt(CURRENT_POS, -1);
    int i = 0;
    if (items != null) {
        for(String item : items) {
            actions.add(
                new GuidedAction.Builder()
                        .id(i)
                        .checked(i == current)
                        .title(item)
                        .build()
            );
            i++;
        }
    }

    super.onCreateActions(actions, savedInstanceState);
}
项目:popcorn-android    文件:PTVWelcomeFragment.java   
@Override
public void onGuidedActionClicked(GuidedAction action) {
    switch ((int) action.getId()) {
        case R.id.action_accept:
            //set first run flag to false, don't show welcome again
            PrefUtils.save(getActivity(), Prefs.FIRST_RUN, false);
            //start main activity

            PTVMainActivity.startActivity(getActivity());
            getActivity().finish();
            return;
        case R.id.action_decline:
            getActivity().finish();
            return;
    }
    super.onGuidedActionClicked(action);
}
项目:leanback-showcase    文件:WizardExample2ndStepFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    boolean rentHighDefinition = getArguments().getBoolean(ARG_HD);

    GuidedAction action = new GuidedAction.Builder(getActivity())
            .id(ACTION_ID_CONFIRM)
            .title(R.string.wizard_example_rent)
            .description(rentHighDefinition ? mMovie.getPriceHd() : mMovie.getPriceSd())
            .editable(false)
            .build();
    action.setEnabled(false);
    actions.add(action);
    List<GuidedAction> subActions = new ArrayList();
    action = new GuidedAction.Builder(getActivity())
            .id(ACTION_ID_PAYMENT_METHOD)
            .title(R.string.wizard_example_payment_method)
            .editTitle("")
            .description(R.string.wizard_example_input_credit)
            .subActions(subActions)
            .build();
    actions.add(action);
}
项目:leanback-showcase    文件:WizardExample2ndStepFragment.java   
@Override
public boolean onSubGuidedActionClicked(GuidedAction action) {

    if (action.isChecked()) {
        String payment = action.getTitle().toString();
        if ( (sSelectedCard = sCards.indexOf(payment)) != -1 ) {
            findActionById(ACTION_ID_PAYMENT_METHOD).setDescription(payment);
            notifyActionChanged(findActionPositionById(ACTION_ID_PAYMENT_METHOD));
            findActionById(ACTION_ID_CONFIRM).setEnabled(true);
            notifyActionChanged(findActionPositionById(ACTION_ID_CONFIRM));
        }
        return true;
    } else {
        FragmentManager fm = getFragmentManager();
        GuidedStepFragment fragment = new WizardNewPaymentStepFragment();
        fragment.setArguments(getArguments());
        add(fm, fragment);
        return false;
    }
}
项目:leanback-showcase    文件:WizardExample1stStepFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    GuidedAction action = new GuidedAction.Builder(getActivity())
            .id(ACTION_ID_BUY_HD)
            .title(R.string.wizard_example_rent_hd)
            .editable(false)
            .description(mMovie.getPriceHd() + " " +
                    getString(R.string.wizard_example_watch_hd))
            .build();
    actions.add(action);
    action = new GuidedAction.Builder(getActivity())
            .id(ACTION_ID_BUY_SD)
            .title(getString(R.string.wizard_example_rent_sd))
            .editable(false)
            .description(mMovie.getPriceSd() + " " +
                    getString(R.string.wizard_example_watch_sd))
            .build();
    actions.add(action);
}
项目:leanback-showcase    文件:WizardNewPaymentStepFragment.java   
@Override
public void onCreateActions(List<GuidedAction> actions, Bundle savedInstanceState) {
    actions.add(new GuidedAction.Builder(getActivity())
                    .id(ACTION_ID_CARD_NUMBER)
                    .title(R.string.wizard_example_input_card)
                    .editTitle("")
                    .description(R.string.wizard_example_input_card)
                    .editDescription("Card number")
                    .editable(true)
                    .build()
    );

    actions.add(new GuidedDatePickerAction.Builder(getActivity())
                    .id(ACTION_ID_PAYMENT_EXP)
                    .title(R.string.wizard_example_expiration_date)
                    .datePickerFormat("MY")
                    .build()
    );
}
项目:leanback-showcase    文件:PublishChannelFragment.java   
/**
 * Helper function to add checked Action to this fragment
 * <p>
 * In this fragment, the checked action is customized as checkbox
 */
private static void addCheckedAction(List<GuidedAction> actions,
                                     int iconResId,
                                     Context context,
                                     String title,
                                     String desc,
                                     int id,
                                     boolean isActionChecked) {
    GuidedAction guidedAction = new GuidedAction.Builder(context)
            .title(title)
            .description(desc)
            .checkSetId(GuidedAction.CHECKBOX_CHECK_SET_ID)
            .icon(context.getResources().getDrawable(iconResId))
            .build();
    guidedAction.setId(id);
    /**
     * Set checkbox status to false initially
     */
    guidedAction.setChecked(isActionChecked);
    actions.add(guidedAction);
}
项目:leanback-showcase    文件:PublishChannelFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    ChannelContents.initializePlaylists(this.getActivity());

    mChannelContents = ChannelContents.sChannelContents;

    /**
     * The id of check box was set to the index of current channel
     */
    for (int i = 0; i < mChannelContents.size(); i++) {
        addCheckedAction(actions,
                OPTION_DRAWABLE,
                getActivity(),
                mChannelContents.get(i).getName(),
                mChannelContents.get(i).getDescription(),
                i,
                mChannelContents.get(i).isChannelPublished());
    }
}
项目:danish-media-license    文件:AboutFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
  actions.add(new GuidedAction.Builder(getContext())
      .id(CONTENT_ID)
      .title(R.string.ondemand_settings_about_content)
      .description(R.string.ondemand_settings_about_content_description)
      .build());
  actions.add(new GuidedAction.Builder(getContext())
      .id(THIRD_PARTY_ID)
      .title(R.string.ondemand_settings_about_thirdparty)
      .description(R.string.ondemand_settings_about_thirdparty_description)
      .build());
  actions.add(new GuidedAction.Builder(getContext())
      .infoOnly(true)
      .title(R.string.ondemand_settings_about_version)
      .description(BuildConfig.VERSION_NAME)
      .build());
}
项目:danish-media-license    文件:SetupFragment.java   
private void createActions() {
  List<GuidedAction> actions = new ArrayList<>(channels.size() + 2);
  Context context = getContext();
  for (Channel channel : channels) {
    actions.add(new GuidedAction.Builder(context)
        .enabled(false)
        .title(channel.getTitle())
        .build());
  }
  actions.add(new GuidedAction.Builder(context)
      .id(OK_ID)
      .title(R.string.live_setup_ok)
      .build());
  actions.add(new GuidedAction.Builder(context)
      .id(CANCEL_ID)
      .title(R.string.live_setup_cancel)
      .build());
  setActions(actions);
}
项目:ring-client-android    文件:TVRingAccountCreationFragment.java   
@Override
public void enableNextButton(boolean enabled) {
    Log.d(TAG, "enableNextButton(" + enabled + ")");
    GuidedAction actionCheck = findActionById(CHECK);
    GuidedAction actionContinue = findActionById(CONTINUE);

    if (enabled) {
        actionCheck.setIcon(getResources().getDrawable(R.drawable.ic_good));
        actionCheck.setTitle(getString(R.string.no_registered_name_for_account));
        actionCheck.setDescription("");
        actionContinue.setIcon(null);
        actionCheck.setDescription("");
    }
    actionContinue.setEnabled(enabled);
    notifyActionChanged(findActionPositionById(CHECK));
    notifyActionChanged(findActionPositionById(CONTINUE));
}
项目:ring-client-android    文件:TVRingLinkAccountFragment.java   
@Override
public long onGuidedActionEditedAndProceed(GuidedAction action) {
    String password = action.getEditDescription().toString();
    if (password.length() > 0) {
        action.setDescription(StringUtils.toPassword(password));
    } else {
        action.setDescription(getString(R.string.account_enter_password));
    }
    if (action.getId() == PASSWORD) {
        notifyActionChanged(findActionPositionById(PASSWORD));
        presenter.passwordChanged(password);
    } else if (action.getId() == PIN) {
        notifyActionChanged(findActionPositionById(PIN));
        presenter.pinChanged(action.getEditDescription().toString());
    }
    return GuidedAction.ACTION_ID_NEXT;
}
项目:androidtv-Leanback    文件:AuthenticationActivity.java   
@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);
}
项目:androidtv-Leanback    文件:GuidedStepActivity.java   
@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]);
    }
}
项目:BuildingForAndroidTV    文件:SettingsFragment.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    actions.add(new GuidedAction.Builder()
            .id(R.id.settings_category_id)
            .infoOnly(true)
            .title(getString(R.string.settings_category))
            .build());

    actions.add(new GuidedAction.Builder()
            .id(R.id.settings_toggle_nav_id)
            .title(getString(R.string.settings_toggle_nav_title))
            .checked(!MainActivity.isUsingStandardBrowseFragment())
            .description(getString(R.string.settings_toggle_nav_desc))
            .build());

    super.onCreateActions(actions, savedInstanceState);
}