Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Geoffrey Métais
VLC-Android
Commits
817d19ad
Commit
817d19ad
authored
May 07, 2020
by
Nicolas Pomepuy
Committed by
Geoffrey Métais
May 07, 2020
Browse files
Fix loading states for Audio and Browse tabs
parent
624353da
Pipeline
#17087
passed with stage
in 3 minutes and 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
View file @
817d19ad
...
...
@@ -277,7 +277,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
override
fun
enableSearchOption
()
=
true
private
fun
updateEmptyView
()
{
empty_loading
.
state
=
if
(
empty
)
EmptyLoadingState
.
EMPTY
else
EmptyLoadingState
.
NONE
empty_loading
.
state
=
if
(
viewModel
.
providers
[
currentTab
].
loading
.
value
==
true
)
EmptyLoadingState
.
LOADING
else
if
(
empty
)
EmptyLoadingState
.
EMPTY
else
EmptyLoadingState
.
NONE
setFabPlayShuffleAllVisibility
()
}
...
...
application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
View file @
817d19ad
...
...
@@ -134,7 +134,11 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
localViewModel
.
dataset
.
observe
(
viewLifecycleOwner
,
Observer
<
List
<
MediaLibraryItem
>>
{
list
->
list
?.
let
{
storageBrowserAdapter
.
update
(
it
)
localEntry
.
loading
.
state
=
if
(
list
.
isEmpty
())
EmptyLoadingState
.
EMPTY
else
EmptyLoadingState
.
NONE
localEntry
.
loading
.
state
=
when
{
list
.
isNotEmpty
()
->
EmptyLoadingState
.
NONE
localViewModel
.
loading
.
value
==
true
->
EmptyLoadingState
.
LOADING
else
->
EmptyLoadingState
.
EMPTY
}
}
})
localViewModel
.
loading
.
observe
(
viewLifecycleOwner
,
Observer
{
...
...
@@ -154,12 +158,19 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
favoritesViewModel
=
BrowserFavoritesModel
(
requireContext
())
containerAdapterAssociation
[
favoritesBrowserContainer
]
=
Pair
(
favoritesAdapter
,
favoritesViewModel
)
favoritesViewModel
.
favorites
.
observe
(
viewLifecycleOwner
,
Observer
{
list
->
list
?
.
let
{
list
.
let
{
if
(
list
.
isEmpty
())
favoritesEntry
.
setGone
()
else
favoritesEntry
.
setVisible
()
favoritesAdapter
.
update
(
it
)
favoritesEntry
.
loading
.
state
=
if
(
list
.
isEmpty
())
EmptyLoadingState
.
EMPTY
else
EmptyLoadingState
.
NONE
favoritesEntry
.
loading
.
state
=
when
{
list
.
isNotEmpty
()
->
EmptyLoadingState
.
NONE
localViewModel
.
loading
.
value
==
true
->
EmptyLoadingState
.
LOADING
else
->
EmptyLoadingState
.
EMPTY
}
}
})
favoritesViewModel
.
provider
.
loading
.
observe
(
viewLifecycleOwner
,
Observer
{
if
(
it
)
localEntry
.
loading
.
state
=
EmptyLoadingState
.
LOADING
})
favoritesViewModel
.
provider
.
descriptionUpdate
.
observe
(
viewLifecycleOwner
,
Observer
{
pair
->
if
(
pair
!=
null
)
favoritesAdapter
.
notifyItemChanged
(
pair
.
first
,
pair
.
second
)
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment