only show loading cycle when not playing
This commit is contained in:
parent
38ea5560b6
commit
26cb3cf749
|
@ -142,7 +142,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
||||||
super.onIsPlayingChanged(isPlaying)
|
super.onIsPlayingChanged(isPlaying)
|
||||||
Log.d(TAG, "Playing state changed. Is Playing: $isPlaying")
|
Log.d(TAG, "Playing state changed. Is Playing: $isPlaying")
|
||||||
mutableUiState.update {
|
mutableUiState.update {
|
||||||
it.copy(playing = isPlaying)
|
it.copy(playing = isPlaying, isLoading = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,8 +155,10 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
||||||
// TODO: This is not correctly applicable for loading indicator
|
// TODO: This is not correctly applicable for loading indicator
|
||||||
override fun onIsLoadingChanged(isLoading: Boolean) {
|
override fun onIsLoadingChanged(isLoading: Boolean) {
|
||||||
super.onIsLoadingChanged(isLoading)
|
super.onIsLoadingChanged(isLoading)
|
||||||
mutableUiState.update {
|
if(!player.isPlaying) {
|
||||||
it.copy(isLoading = isLoading)
|
mutableUiState.update {
|
||||||
|
it.copy(isLoading = isLoading)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +265,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
|
||||||
private fun resetHideUiDelayedJob() {
|
private fun resetHideUiDelayedJob() {
|
||||||
uiVisibilityJob?.cancel()
|
uiVisibilityJob?.cancel()
|
||||||
uiVisibilityJob = viewModelScope.launch {
|
uiVisibilityJob = viewModelScope.launch {
|
||||||
delay(4000)
|
delay(2000)
|
||||||
hideUi()
|
hideUi()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue