Add ListHabitsBehavior to show 'Habit dismissed' popup message.

pull/558/head
Scrimbly 6 years ago
parent 2951f85097
commit ad6990d353

@ -184,6 +184,7 @@ class ListHabitsScreen
DATABASE_REPAIRED -> R.string.database_repaired DATABASE_REPAIRED -> R.string.database_repaired
COULD_NOT_GENERATE_BUG_REPORT -> R.string.bug_report_failed COULD_NOT_GENERATE_BUG_REPORT -> R.string.bug_report_failed
FILE_NOT_RECOGNIZED -> R.string.file_not_recognized FILE_NOT_RECOGNIZED -> R.string.file_not_recognized
HABIT_DISMISSED -> R.string.toast_habit_dismissed
}) })
} }

@ -49,6 +49,7 @@ class HabitCardListController @Inject constructor(
override fun onSwiped(position: Int, direction: Int) { override fun onSwiped(position: Int, direction: Int) {
adapter.dismiss(position) adapter.dismiss(position)
behavior.onDismissedHabit(adapter.getItem(position))
} }
override fun drop(from: Int, to: Int) { override fun drop(from: Int, to: Int) {

@ -31,6 +31,7 @@
<string name="color_picker_default_title">Change color</string> <string name="color_picker_default_title">Change color</string>
<string name="toast_habit_created">Habit created</string> <string name="toast_habit_created">Habit created</string>
<string name="toast_habit_dismissed">Habit dismissed</string>
<string name="toast_habit_deleted">Habits deleted</string> <string name="toast_habit_deleted">Habits deleted</string>
<string name="toast_habit_restored">Habits restored</string> <string name="toast_habit_restored">Habits restored</string>
<string name="toast_nothing_to_undo">Nothing to undo</string> <string name="toast_nothing_to_undo">Nothing to undo</string>

@ -113,6 +113,11 @@ public class ListHabitsBehavior
screen.showIntroScreen(); screen.showIntroScreen();
} }
public void onDismissedHabit(Habit habit)
{
screen.showMessage(Message.HABIT_DISMISSED);
}
public void onReorderHabit(@NonNull Habit from, @NonNull Habit to) public void onReorderHabit(@NonNull Habit from, @NonNull Habit to)
{ {
taskRunner.execute(() -> habitList.reorder(from, to)); taskRunner.execute(() -> habitList.reorder(from, to));
@ -159,7 +164,7 @@ public class ListHabitsBehavior
public enum Message public enum Message
{ {
COULD_NOT_EXPORT, IMPORT_SUCCESSFUL, IMPORT_FAILED, DATABASE_REPAIRED, COULD_NOT_EXPORT, IMPORT_SUCCESSFUL, IMPORT_FAILED, DATABASE_REPAIRED,
COULD_NOT_GENERATE_BUG_REPORT, FILE_NOT_RECOGNIZED COULD_NOT_GENERATE_BUG_REPORT, FILE_NOT_RECOGNIZED, HABIT_DISMISSED
} }
public interface BugReporter public interface BugReporter

Loading…
Cancel
Save