Issue #4513: added isLoading to bookmark state
This was added to the state object as a top level param because it could reasonably coexist with any value of `tree` or `mode`. Even if we don't now, we may someday want to display a loading indicator while also showing cached bookmarks. For now, we set isLoading to false whenever we receive any bookmarks
This commit is contained in:
parent
5e8798e89c
commit
ca6c324f29
|
@ -73,7 +73,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler, Accou
|
|||
val view = inflater.inflate(R.layout.fragment_bookmark, container, false)
|
||||
|
||||
bookmarkStore = StoreProvider.get(this) {
|
||||
BookmarkFragmentStore(BookmarkFragmentState(null))
|
||||
BookmarkFragmentStore(BookmarkFragmentState(null, isLoading = true))
|
||||
}
|
||||
bookmarkInteractor = BookmarkFragmentInteractor(
|
||||
bookmarkStore = bookmarkStore,
|
||||
|
|
|
@ -20,7 +20,11 @@ class BookmarkFragmentStore(
|
|||
* @property tree The current tree of bookmarks, if one is loaded
|
||||
* @property mode The current bookmark multi-selection mode
|
||||
*/
|
||||
data class BookmarkFragmentState(val tree: BookmarkNode?, val mode: Mode = Mode.Normal) : State {
|
||||
data class BookmarkFragmentState(
|
||||
val tree: BookmarkNode?,
|
||||
val mode: Mode = Mode.Normal,
|
||||
val isLoading: Boolean
|
||||
) : State {
|
||||
sealed class Mode {
|
||||
open val selectedItems = emptySet<BookmarkNode>()
|
||||
|
||||
|
@ -58,7 +62,8 @@ private fun bookmarkFragmentStateReducer(
|
|||
BookmarkFragmentState.Mode.Normal
|
||||
} else {
|
||||
BookmarkFragmentState.Mode.Selecting(items.toSet())
|
||||
}
|
||||
},
|
||||
isLoading = false
|
||||
)
|
||||
}
|
||||
is BookmarkFragmentAction.Select ->
|
||||
|
|
Loading…
Reference in New Issue
Block a user