Prepare for Restore button

This commit is contained in:
BONNEVILLE Geoffroy
2018-11-13 12:05:03 +01:00
parent a3f7e08543
commit b05f711f02
5 changed files with 7 additions and 1 deletions

View File

@@ -135,6 +135,10 @@ public class Task {
return todayDate != null && todayDate.isEqual(LocalDate.now());
}
public boolean isHistory () {
return getDone() == 1 || getDeleted() == 1;
}
// Will be used by the ArrayAdapter in the ListView
@NonNull
@Override

View File

@@ -66,7 +66,7 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
mButtonCount = args.getInt("button_count");
mPositiveButtonString = getString(R.string.new_task_save);
mNegativeButtonString = getString(R.string.new_task_cancel);
mNeutralButtonString = getString(R.string.new_task_delete);
mNeutralButtonString = getString(mTask.isHistory() ? R.string.new_task_restore : R.string.new_task_delete);
listId = args.getInt("list");
isToday = args.getBoolean("today");
}

View File

@@ -69,4 +69,5 @@
<string name="today_no_tasks">Rien à faire aujourd\'hui</string>
<string name="create_tasks">Créez-en une là</string>
<string name="today_create_tasks">Ajoutez des tâches là</string>
<string name="new_task_restore">Restaurer</string>
</resources>

View File

@@ -34,6 +34,7 @@
<string name="new_task_save">Save</string>
<string name="new_task_cancel">Cancel</string>
<string name="new_task_delete">Delete</string>
<string name="new_task_restore">Restore</string>
<!-- Strings related to task details activity -->
<string name="task_no_tasks">No tasks here!</string>