Fix search history preference

pull/26/head
Koitharu 6 years ago
parent 84ef2af82f
commit b27bc86141

@ -1,6 +1,5 @@
package org.koitharu.kotatsu.ui.details package org.koitharu.kotatsu.ui.details
import android.util.Log
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.* import kotlinx.coroutines.flow.*

@ -42,7 +42,7 @@ class HistorySettingsFragment : BasePreferenceFragment(R.string.history_and_cach
} }
override fun onPreferenceTreeClick(preference: Preference): Boolean { override fun onPreferenceTreeClick(preference: Preference): Boolean {
return when(preference.key) { return when (preference.key) {
getString(R.string.key_pages_cache_clear) -> { getString(R.string.key_pages_cache_clear) -> {
clearCache(preference, Cache.PAGES) clearCache(preference, Cache.PAGES)
true true
@ -53,8 +53,13 @@ class HistorySettingsFragment : BasePreferenceFragment(R.string.history_and_cach
} }
getString(R.string.key_search_history_clear) -> { getString(R.string.key_search_history_clear) -> {
MangaSuggestionsProvider.clearHistory(preference.context) MangaSuggestionsProvider.clearHistory(preference.context)
preference.context.resources.getQuantityString(R.plurals.items, 0, 0) preference.summary = preference.context.resources
Snackbar.make(view ?: return true, R.string.search_history_cleared, Snackbar.LENGTH_SHORT).show() .getQuantityString(R.plurals.items, 0, 0)
Snackbar.make(
view ?: return true,
R.string.search_history_cleared,
Snackbar.LENGTH_SHORT
).show()
true true
} }
else -> super.onPreferenceTreeClick(preference) else -> super.onPreferenceTreeClick(preference)

Loading…
Cancel
Save