From 56282de6be9bf632fcd9bb7707971e82255d8726 Mon Sep 17 00:00:00 2001 From: pkorove Date: Mon, 15 Jun 2020 17:11:06 +0300 Subject: [PATCH] Corrected some older comments and add the signature comment to the start of the Reset command --- .../common/dialogs/ConfirmResetDialog.java | 2 +- .../list/views/HabitCardListAdapter.java | 13 ++++++++++++ .../core/commands/ResetHabitsCommand.java | 21 ++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/ConfirmResetDialog.java b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/ConfirmResetDialog.java index 04444b629..2241b8307 100644 --- a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/ConfirmResetDialog.java +++ b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/ConfirmResetDialog.java @@ -33,7 +33,7 @@ import org.isoron.uhabits.core.ui.callbacks.*; import butterknife.*; /** - * Dialog that asks the user confirmation before executing a delete operation. + * Dialog that asks the user confirmation before executing a reset operation. */ @AutoFactory(allowSubclasses = true) public class ConfirmResetDialog extends AlertDialog diff --git a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/views/HabitCardListAdapter.java b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/views/HabitCardListAdapter.java index 494dd946b..679810453 100644 --- a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/views/HabitCardListAdapter.java +++ b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/views/HabitCardListAdapter.java @@ -270,6 +270,18 @@ public class HabitCardListAdapter for (Habit h : habits) cache.remove(h.getId()); } + + /** + * Resets a list of habits from the adapter. + *

+ * Note that this only has effect on the adapter cache. The database is not + * modified, and the change is lost when the cache is refreshed. This method + * is useful for making the ListView more responsive: while we wait for the + * database operation to finish, the cache can be modified to reflect the + * changes immediately. + * + * @param habits list of habits to be reset + */ @Override public void performReset(List habits) { @@ -280,6 +292,7 @@ public class HabitCardListAdapter h.getRepetitions().remove(rep); } } + /** * Changes the order of habits on the adapter. *

diff --git a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java index 2e226a882..6f62355be 100644 --- a/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java +++ b/android/uhabits-core/src/main/java/org/isoron/uhabits/core/commands/ResetHabitsCommand.java @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2016 Álinson Santos Xavier + * + * This file is part of Loop Habit Tracker. + * + * Loop Habit Tracker is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Loop Habit Tracker is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + package org.isoron.uhabits.core.commands; import androidx.annotation.NonNull; @@ -18,7 +37,7 @@ public class ResetHabitsCommand extends Command @NonNull final List selected; - +0 public ResetHabitsCommand(@NonNull HabitList habitList, @NonNull List selected) { this.habitList = habitList; this.selected = new LinkedList<>(selected);