forked from recloudstream/cloudstream
Better notice when not logged in in library
This commit is contained in:
parent
26320bb535
commit
0aca996bc0
3 changed files with 19 additions and 3 deletions
|
@ -253,6 +253,12 @@ class LibraryFragment : Fragment() {
|
|||
activity?.loadSearchResult(
|
||||
searchClickCallback.card
|
||||
)
|
||||
} else {
|
||||
// Search when no provider can open
|
||||
QuickSearchFragment.pushSearch(
|
||||
activity,
|
||||
searchClickCallback.card.name
|
||||
)
|
||||
}
|
||||
}
|
||||
LibraryOpenerType.None -> {}
|
||||
|
@ -283,7 +289,16 @@ class LibraryFragment : Fragment() {
|
|||
when (resource) {
|
||||
is Resource.Success -> {
|
||||
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
|
||||
// Using notifyItemRangeChanged keeps the animations when sorting
|
||||
viewpager.adapter?.notifyItemRangeChanged(0, viewpager.adapter?.itemCount ?: 0)
|
||||
|
@ -303,6 +318,7 @@ class LibraryFragment : Fragment() {
|
|||
}
|
||||
is Resource.Loading -> {
|
||||
loading_indicator?.show()
|
||||
empty_list_textview?.isVisible = false
|
||||
}
|
||||
is Resource.Failure -> {
|
||||
// No user indication it failed :(
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_margin="30dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/empty_library_message"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
|
|
@ -627,5 +627,6 @@
|
|||
<string name="sort_alphabetical_z">Alphabetical (Z to A)</string>
|
||||
<string name="select_library">Select Library</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>
|
||||
|
|
Loading…
Reference in a new issue