Search in sources :

Example 1 with SavePointTask

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

the class FormEntryActivity method nonblockingCreateSavePointData.

/**
 * Creates save-points asynchronously in order to not affect swiping performance on larger forms.
 * If moving backwards through a form is disabled, also saves the index of the form element that
 * was last shown to the user so that no matter how the app exits and relaunches, the user can't
 * see previous questions.
 */
private void nonblockingCreateSavePointData() {
    try {
        SavePointTask savePointTask = new SavePointTask(this);
        savePointTask.execute();
        if (!allowMovingBackwards) {
            FormController formController = getFormController();
            if (formController != null) {
                new SaveFormIndexTask(this, formController.getFormIndex()).execute();
            }
        }
    } catch (Exception e) {
        Timber.e("Could not schedule SavePointTask. Perhaps a lot of swiping is taking place?");
    }
}
Also used : FormController(org.odk.collect.android.javarosawrapper.FormController) SaveFormIndexTask(org.odk.collect.android.tasks.SaveFormIndexTask) SavePointTask(org.odk.collect.android.tasks.SavePointTask) RepeatsInFieldListException(org.odk.collect.android.javarosawrapper.RepeatsInFieldListException) JavaRosaException(org.odk.collect.android.exception.JavaRosaException)

Aggregations

JavaRosaException (org.odk.collect.android.exception.JavaRosaException)1 FormController (org.odk.collect.android.javarosawrapper.FormController)1 RepeatsInFieldListException (org.odk.collect.android.javarosawrapper.RepeatsInFieldListException)1 SaveFormIndexTask (org.odk.collect.android.tasks.SaveFormIndexTask)1 SavePointTask (org.odk.collect.android.tasks.SavePointTask)1