Search in sources :

Example 1 with MovingBackwardsDialog

use of org.odk.collect.android.fragments.dialogs.MovingBackwardsDialog in project collect by opendatakit.

the class FormEntryAccessPreferencesFragment method onCreatePreferences.

@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
    super.onCreatePreferences(savedInstanceState, rootKey);
    addPreferencesFromResource(R.xml.form_entry_access_preferences);
    findPreference(KEY_MOVING_BACKWARDS).setOnPreferenceChangeListener((preference, newValue) -> {
        if (((CheckBoxPreference) preference).isChecked()) {
            new MovingBackwardsDialog().show(getActivity().getSupportFragmentManager(), MOVING_BACKWARDS_DIALOG_TAG);
        } else {
            SimpleDialog.newInstance(getActivity().getString(R.string.moving_backwards_enabled_title), 0, getActivity().getString(R.string.moving_backwards_enabled_message), getActivity().getString(R.string.ok), false).show(((CollectAbstractActivity) getActivity()).getSupportFragmentManager(), SimpleDialog.COLLECT_DIALOG_TAG);
            onMovingBackwardsEnabled();
        }
        return true;
    });
    findPreference(KEY_JUMP_TO).setEnabled(settingsProvider.getProtectedSettings().getBoolean(ALLOW_OTHER_WAYS_OF_EDITING_FORM));
    findPreference(KEY_SAVE_MID).setEnabled(settingsProvider.getProtectedSettings().getBoolean(ALLOW_OTHER_WAYS_OF_EDITING_FORM));
}
Also used : MovingBackwardsDialog(org.odk.collect.android.fragments.dialogs.MovingBackwardsDialog) CheckBoxPreference(androidx.preference.CheckBoxPreference)

Aggregations

CheckBoxPreference (androidx.preference.CheckBoxPreference)1 MovingBackwardsDialog (org.odk.collect.android.fragments.dialogs.MovingBackwardsDialog)1