Search in sources :

Example 1 with MaterialProgressDialogFragment

use of org.odk.collect.material.MaterialProgressDialogFragment 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)

Example 2 with MaterialProgressDialogFragment

use of org.odk.collect.material.MaterialProgressDialogFragment in project collect by opendatakit.

the class BlankFormListFragment method progressUpdate.

@Override
public void progressUpdate(Integer progress, Integer total) {
    String message = String.format(getResources().getString(R.string.deleting_form_dialog_update_message), progress, total);
    MaterialProgressDialogFragment existingDialog = (MaterialProgressDialogFragment) requireActivity().getSupportFragmentManager().findFragmentByTag(MaterialProgressDialogFragment.class.getName());
    if (existingDialog != null) {
        existingDialog.setMessage(message);
    }
}
Also used : MaterialProgressDialogFragment(org.odk.collect.material.MaterialProgressDialogFragment)

Aggregations

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