Search in sources :

Example 1 with DeleteInstancesTask

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

the class DataManagerList method deleteSelectedInstances.

/**
 * Deletes the selected files. Content provider handles removing the files
 * from the filesystem.
 */
private void deleteSelectedInstances() {
    if (deleteInstancesTask == null) {
        progressDialog = new ProgressDialog(getContext());
        progressDialog.setMessage(getResources().getString(R.string.form_delete_message));
        progressDialog.setIndeterminate(true);
        progressDialog.setCancelable(false);
        progressDialog.show();
        deleteInstancesTask = new DeleteInstancesTask();
        deleteInstancesTask.setContentResolver(getActivity().getContentResolver());
        deleteInstancesTask.setDeleteListener(this);
        deleteInstancesTask.execute(getCheckedIdObjects());
    } else {
        ToastUtils.showLongToast(R.string.file_delete_in_progress);
    }
}
Also used : ProgressDialog(android.app.ProgressDialog) DeleteInstancesTask(org.odk.collect.android.tasks.DeleteInstancesTask)

Example 2 with DeleteInstancesTask

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

the class SavedFormListFragment method deleteSelectedInstances.

/**
 * Deletes the selected files. Content provider handles removing the files
 * from the filesystem.
 */
private void deleteSelectedInstances() {
    if (deleteInstancesTask == null) {
        progressDialog = new DayNightProgressDialog(getContext());
        progressDialog.setMessage(getResources().getString(R.string.form_delete_message));
        progressDialog.setIndeterminate(true);
        progressDialog.setCancelable(false);
        progressDialog.show();
        deleteInstancesTask = new DeleteInstancesTask(instancesRepositoryProvider.get(), formsRepositoryProvider.get());
        deleteInstancesTask.setDeleteListener(this);
        deleteInstancesTask.execute(getCheckedIdObjects());
    } else {
        ToastUtils.showLongToast(requireContext(), R.string.file_delete_in_progress);
    }
}
Also used : DayNightProgressDialog(org.odk.collect.android.views.DayNightProgressDialog) DeleteInstancesTask(org.odk.collect.android.tasks.DeleteInstancesTask)

Aggregations

DeleteInstancesTask (org.odk.collect.android.tasks.DeleteInstancesTask)2 ProgressDialog (android.app.ProgressDialog)1 DayNightProgressDialog (org.odk.collect.android.views.DayNightProgressDialog)1