show a toast the first time everything is filtered out too

This commit is contained in:
tibbi 2023-01-10 15:59:15 +01:00
parent 9df5855897
commit 3627e9b2b8
3 changed files with 10 additions and 0 deletions

View File

@ -329,6 +329,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
eventsHelper.getEventTypes(this, false) { eventsHelper.getEventTypes(this, false) {
val quickFilterEventTypes = config.quickFilterEventTypes val quickFilterEventTypes = config.quickFilterEventTypes
quick_event_type_filter.adapter = QuickFilterEventTypeAdapter(this, it, 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() refreshViewPager()
updateWidgets() updateWidgets()
} }

View File

@ -250,4 +250,8 @@ class Config(context: Context) : BaseConfig(context) {
var allowCreatingTasks: Boolean var allowCreatingTasks: Boolean
get() = prefs.getBoolean(ALLOW_CREATING_TASKS, true) get() = prefs.getBoolean(ALLOW_CREATING_TASKS, true)
set(allowCreatingTasks) = prefs.edit().putBoolean(ALLOW_CREATING_TASKS, allowCreatingTasks).apply() 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()
} }

View File

@ -123,6 +123,7 @@ const val HIGHLIGHT_WEEKENDS = "highlight_weekends"
const val HIGHLIGHT_WEEKENDS_COLOR = "highlight_weekends_color" const val HIGHLIGHT_WEEKENDS_COLOR = "highlight_weekends_color"
const val LAST_USED_EVENT_SPAN = "last_used_event_span" const val LAST_USED_EVENT_SPAN = "last_used_event_span"
const val ALLOW_CREATING_TASKS = "allow_creating_tasks" 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 // repeat_rule for monthly and yearly repetition
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition) const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)