Better notice when not logged in in library

This commit is contained in:
Blatzar 2023-01-26 18:09:22 +01:00
parent 26320bb535
commit 0aca996bc0
3 changed files with 19 additions and 3 deletions

View file

@ -253,6 +253,12 @@ class LibraryFragment : Fragment() {
activity?.loadSearchResult( activity?.loadSearchResult(
searchClickCallback.card searchClickCallback.card
) )
} else {
// Search when no provider can open
QuickSearchFragment.pushSearch(
activity,
searchClickCallback.card.name
)
} }
} }
LibraryOpenerType.None -> {} LibraryOpenerType.None -> {}
@ -283,7 +289,16 @@ class LibraryFragment : Fragment() {
when (resource) { when (resource) {
is Resource.Success -> { is Resource.Success -> {
val pages = resource.value val pages = resource.value
empty_list_textview?.isVisible = pages.all { it.items.isEmpty() } val showNotice = pages.all { it.items.isEmpty() }
empty_list_textview?.isVisible = showNotice
if (showNotice) {
if (libraryViewModel.availableApiNames.size > 1) {
empty_list_textview?.setText(R.string.empty_library_logged_in_message)
} else {
empty_list_textview?.setText(R.string.empty_library_no_accounts_message)
}
}
(viewpager.adapter as? ViewpagerAdapter)?.pages = pages (viewpager.adapter as? ViewpagerAdapter)?.pages = pages
// Using notifyItemRangeChanged keeps the animations when sorting // Using notifyItemRangeChanged keeps the animations when sorting
viewpager.adapter?.notifyItemRangeChanged(0, viewpager.adapter?.itemCount ?: 0) viewpager.adapter?.notifyItemRangeChanged(0, viewpager.adapter?.itemCount ?: 0)
@ -303,6 +318,7 @@ class LibraryFragment : Fragment() {
} }
is Resource.Loading -> { is Resource.Loading -> {
loading_indicator?.show() loading_indicator?.show()
empty_list_textview?.isVisible = false
} }
is Resource.Failure -> { is Resource.Failure -> {
// No user indication it failed :( // No user indication it failed :(

View file

@ -14,7 +14,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="30dp" android:layout_margin="30dp"
android:gravity="center" android:gravity="center"
android:text="@string/empty_library_message"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />

View file

@ -627,5 +627,6 @@
<string name="sort_alphabetical_z">Alphabetical (Z to A)</string> <string name="sort_alphabetical_z">Alphabetical (Z to A)</string>
<string name="select_library">Select Library</string> <string name="select_library">Select Library</string>
<string name="open_with">Open with</string> <string name="open_with">Open with</string>
<string name="empty_library_message">Looks like your library is empty :(\nLogin to a library account or add shows to your local library</string> <string name="empty_library_no_accounts_message">Looks like your library is empty :(\nLogin to a library account or add shows to your local library</string>
<string name="empty_library_logged_in_message">Looks like this list is empty, try switching to another one</string>
</resources> </resources>