From 3627e9b2b85df938bf0d699b87edd6de379f8c2b Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 10 Jan 2023 15:59:15 +0100 Subject: [PATCH] show a toast the first time everything is filtered out too --- .../calendar/pro/activities/MainActivity.kt | 5 +++++ .../com/simplemobiletools/calendar/pro/helpers/Config.kt | 4 ++++ .../com/simplemobiletools/calendar/pro/helpers/Constants.kt | 1 + 3 files changed, 10 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index 1218117fb..42912f346 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -329,6 +329,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { eventsHelper.getEventTypes(this, false) { val quickFilterEventTypes = config.quickFilterEventTypes quick_event_type_filter.adapter = QuickFilterEventTypeAdapter(this, it, quickFilterEventTypes) { + if (config.displayEventTypes.isEmpty() && !config.wasFilteredOutWarningShown) { + toast(R.string.everything_filtered_out, Toast.LENGTH_LONG) + config.wasFilteredOutWarningShown = true + } + refreshViewPager() updateWidgets() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt index d09beff4d..fcb435ff4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt @@ -250,4 +250,8 @@ class Config(context: Context) : BaseConfig(context) { var allowCreatingTasks: Boolean get() = prefs.getBoolean(ALLOW_CREATING_TASKS, true) set(allowCreatingTasks) = prefs.edit().putBoolean(ALLOW_CREATING_TASKS, allowCreatingTasks).apply() + + var wasFilteredOutWarningShown: Boolean + get() = prefs.getBoolean(WAS_FILTERED_OUT_WARNING_SHOWN, false) + set(wasFilteredOutWarningShown) = prefs.edit().putBoolean(WAS_FILTERED_OUT_WARNING_SHOWN, wasFilteredOutWarningShown).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 373fb18a2..5bbd77ca9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -123,6 +123,7 @@ const val HIGHLIGHT_WEEKENDS = "highlight_weekends" const val HIGHLIGHT_WEEKENDS_COLOR = "highlight_weekends_color" const val LAST_USED_EVENT_SPAN = "last_used_event_span" const val ALLOW_CREATING_TASKS = "allow_creating_tasks" +const val WAS_FILTERED_OUT_WARNING_SHOWN = "was_filtered_out_warning_shown" // repeat_rule for monthly and yearly repetition const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)