From 0416a2ff15c6adee17f619667bd583d97e472984 Mon Sep 17 00:00:00 2001 From: Eugene Date: Sun, 22 Dec 2019 15:48:36 -0500 Subject: [PATCH] Extract some hardcoded strings (closes #1989) --- .../browse/BrowseCatalogueController.kt | 25 +++++++++++-------- .../tachiyomi/ui/migration/SelectionHeader.kt | 4 +-- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt index b13a403dff..af047a26e9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt @@ -341,19 +341,22 @@ open class BrowseCatalogueController(bundle: Bundle) : adapter.onLoadMoreComplete(null) hideProgressBar() - val message = if (error is NoResultsException) "No results found" else (error.message ?: "") - snack?.dismiss() - snack = catalogue_view?.snack(message, Snackbar.LENGTH_INDEFINITE) { - setAction(R.string.action_retry) { - // If not the first page, show bottom progress bar. - if (adapter.mainItemCount > 0) { - val item = progressItem ?: return@setAction - adapter.addScrollableFooterWithDelay(item, 0, true) - } else { - showProgressBar() + + if (catalogue_view != null) { + val message = if (error is NoResultsException) catalogue_view.context.getString(R.string.no_results_found) else (error.message ?: "") + + snack = catalogue_view.snack(message, Snackbar.LENGTH_INDEFINITE) { + setAction(R.string.action_retry) { + // If not the first page, show bottom progress bar. + if (adapter.mainItemCount > 0) { + val item = progressItem ?: return@setAction + adapter.addScrollableFooterWithDelay(item, 0, true) + } else { + showProgressBar() + } + presenter.requestNext() } - presenter.requestNext() } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt index cb87fcb9ea..d40028050b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt @@ -5,7 +5,7 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.AbstractHeaderItem import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder -import kotlinx.android.synthetic.main.catalogue_main_controller_card.* +import kotlinx.android.synthetic.main.catalogue_main_controller_card.title /** * Item that contains the selection header. @@ -36,7 +36,7 @@ class SelectionHeader : AbstractHeaderItem() { class Holder(view: View, adapter: FlexibleAdapter<*>) : BaseFlexibleViewHolder(view, adapter) { init { - title.text = "Please select a source to migrate from" + title.text = view.context.getString(R.string.migration_selection_prompt) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f72686b4f3..da7bc6b98a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -323,6 +323,7 @@ Select a source Please enable at least one valid source No more results + No results found Local manga Other Default can\'t be selected with other categories @@ -455,6 +456,7 @@ Tap to select the source to migrate from Select data to include + Select a source to migrate from Select Migrate Copy