Skip to content

Commit

Permalink
Fix issue with strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Feb 3, 2021
1 parent 6d9ed1f commit 368a19c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 49 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/entries/EntriesFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}
}
}
47 changes: 0 additions & 47 deletions app/src/main/res/layout/fragment_bookmarks.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<string name="username">Username</string>
<string name="password">Password</string>
<string name="news_list_is_empty">News list is empty</string>
<string name="you_have_no_starred_news">You have no starred news</string>
<string name="you_have_no_bookmarks">You have no bookmarks</string>
<string name="field_is_empty">Field is empty</string>
<string name="error">Error</string>
<string name="download">Download</string>
Expand Down Expand Up @@ -61,4 +61,5 @@
<string name="bookmarked">Bookmarked</string>
<string name="search">Search</string>
<string name="clear_search_input">Clear search input</string>
<string name="no_results">No results</string>
</resources>

0 comments on commit 368a19c

Please sign in to comment.