Search in sources :

Example 1 with DeleteFormsTask

use of org.odk.collect.android.tasks.DeleteFormsTask in project collect by opendatakit.

the class FormManagerList method deleteSelectedForms.

/**
 * Deletes the selected files.First from the database then from the file
 * system
 */
private void deleteSelectedForms() {
    // only start if no other task is running
    if (backgroundTasks.deleteFormsTask == null) {
        backgroundTasks.deleteFormsTask = new DeleteFormsTask();
        backgroundTasks.deleteFormsTask.setContentResolver(getActivity().getContentResolver());
        backgroundTasks.deleteFormsTask.setDeleteListener(this);
        backgroundTasks.deleteFormsTask.execute(getCheckedIdObjects());
    } else {
        ToastUtils.showLongToast(R.string.file_delete_in_progress);
    }
}
Also used : DeleteFormsTask(org.odk.collect.android.tasks.DeleteFormsTask)

Example 2 with DeleteFormsTask

use of org.odk.collect.android.tasks.DeleteFormsTask in project collect by opendatakit.

the class BlankFormListFragment method deleteSelectedForms.

/**
 * Deletes the selected files.First from the database then from the file
 * system
 */
private void deleteSelectedForms() {
    // only start if no other task is running
    if (backgroundTasks.deleteFormsTask == null) {
        MaterialProgressDialogFragment progressDialogFragment = new MaterialProgressDialogFragment();
        progressDialogFragment.setMessage(getResources().getString(R.string.form_delete_message));
        progressDialogFragment.setCancelable(false);
        DialogFragmentUtils.showIfNotShowing(progressDialogFragment, MaterialProgressDialogFragment.class, getActivity().getSupportFragmentManager());
        backgroundTasks.deleteFormsTask = new DeleteFormsTask(formsRepositoryProvider.get(), instancesRepositoryProvider.get());
        backgroundTasks.deleteFormsTask.setDeleteListener(this);
        backgroundTasks.deleteFormsTask.execute(getCheckedIdObjects());
    } else {
        ToastUtils.showLongToast(requireContext(), R.string.file_delete_in_progress);
    }
}
Also used : DeleteFormsTask(org.odk.collect.android.tasks.DeleteFormsTask) MaterialProgressDialogFragment(org.odk.collect.material.MaterialProgressDialogFragment)

Aggregations

DeleteFormsTask (org.odk.collect.android.tasks.DeleteFormsTask)2 MaterialProgressDialogFragment (org.odk.collect.material.MaterialProgressDialogFragment)1