From 368a19c92998354957f4a164bcbc92d46f86a19e Mon Sep 17 00:00:00 2001 From: Igor Bubelov Date: Thu, 4 Feb 2021 02:44:01 +0700 Subject: [PATCH] Fix issue with strings --- app/src/main/java/entries/EntriesFragment.kt | 8 ++++ .../main/res/layout/fragment_bookmarks.xml | 47 ------------------- app/src/main/res/layout/fragment_search.xml | 2 +- app/src/main/res/values/strings.xml | 3 +- 4 files changed, 11 insertions(+), 49 deletions(-) delete mode 100644 app/src/main/res/layout/fragment_bookmarks.xml diff --git a/app/src/main/java/entries/EntriesFragment.kt b/app/src/main/java/entries/EntriesFragment.kt index 11439f3d..e6c82c27 100644 --- a/app/src/main/java/entries/EntriesFragment.kt +++ b/app/src/main/java/entries/EntriesFragment.kt @@ -324,6 +324,7 @@ class EntriesFragment : Fragment() { binding.empty.isVisible = model.isInitialSyncCompleted() .first() && !model.loadingEntries.first() && entries.isEmpty() + binding.empty.text = getEmptyMessage() adapter.submitList(entries) { if (shouldScrollToTop) { @@ -351,4 +352,11 @@ class EntriesFragment : Fragment() { else -> false } } + + private fun getEmptyMessage(): String { + return when (args.filter) { + is EntriesFilter.OnlyBookmarked -> getString(R.string.you_have_no_bookmarks) + else -> getString(R.string.news_list_is_empty) + } + } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_bookmarks.xml b/app/src/main/res/layout/fragment_bookmarks.xml deleted file mode 100644 index 72df91f4..00000000 --- a/app/src/main/res/layout/fragment_bookmarks.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 5e7e7fba..0333c461 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -92,7 +92,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="16dp" - android:text="No results" + android:text="@string/no_results" android:textAppearance="?textAppearanceBody1" android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 863d3cd4..e8c9f2de 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -18,7 +18,7 @@ Username Password News list is empty - You have no starred news + You have no bookmarks Field is empty Error Download @@ -61,4 +61,5 @@ Bookmarked Search Clear search input + No results \ No newline at end of file