From b27bc86141fa5b47e7b3966b324e2a539fe8ba2b Mon Sep 17 00:00:00 2001 From: Koitharu Date: Mon, 29 Jun 2020 13:28:25 +0300 Subject: [PATCH] Fix search history preference --- .../kotatsu/ui/details/MangaDetailsPresenter.kt | 1 - .../kotatsu/ui/settings/HistorySettingsFragment.kt | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/koitharu/kotatsu/ui/details/MangaDetailsPresenter.kt b/app/src/main/java/org/koitharu/kotatsu/ui/details/MangaDetailsPresenter.kt index 9c234551e..a380926e7 100644 --- a/app/src/main/java/org/koitharu/kotatsu/ui/details/MangaDetailsPresenter.kt +++ b/app/src/main/java/org/koitharu/kotatsu/ui/details/MangaDetailsPresenter.kt @@ -1,6 +1,5 @@ package org.koitharu.kotatsu.ui.details -import android.util.Log import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.* diff --git a/app/src/main/java/org/koitharu/kotatsu/ui/settings/HistorySettingsFragment.kt b/app/src/main/java/org/koitharu/kotatsu/ui/settings/HistorySettingsFragment.kt index c1f436edc..92ba5f549 100644 --- a/app/src/main/java/org/koitharu/kotatsu/ui/settings/HistorySettingsFragment.kt +++ b/app/src/main/java/org/koitharu/kotatsu/ui/settings/HistorySettingsFragment.kt @@ -42,7 +42,7 @@ class HistorySettingsFragment : BasePreferenceFragment(R.string.history_and_cach } override fun onPreferenceTreeClick(preference: Preference): Boolean { - return when(preference.key) { + return when (preference.key) { getString(R.string.key_pages_cache_clear) -> { clearCache(preference, Cache.PAGES) true @@ -53,8 +53,13 @@ class HistorySettingsFragment : BasePreferenceFragment(R.string.history_and_cach } getString(R.string.key_search_history_clear) -> { MangaSuggestionsProvider.clearHistory(preference.context) - preference.context.resources.getQuantityString(R.plurals.items, 0, 0) - Snackbar.make(view ?: return true, R.string.search_history_cleared, Snackbar.LENGTH_SHORT).show() + preference.summary = preference.context.resources + .getQuantityString(R.plurals.items, 0, 0) + Snackbar.make( + view ?: return true, + R.string.search_history_cleared, + Snackbar.LENGTH_SHORT + ).show() true } else -> super.onPreferenceTreeClick(preference)