[Android] SubDownload: fix err msg staying at first launch
Duncan McNamara
git at videolan.org
Fri Feb 25 06:39:16 UTC 2022
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Tue Feb 15 17:35:16 2022 +0100| [3a93f9f288c84c93a0b2a756512706eae95bd9e9] | committer: Nicolas Pomepuy
SubDownload: fix err msg staying at first launch
When starting the dialog for the first time in the app's lifecycle, the
coroutine started search will fail, before succeeding. Because of this,
the errror message is displayed, but never removed once search has been
successful, causing an overlap of the different views. This is fixed by
resetting errorObservable and messageObservable.
> https://code.videolan.org/videolan/vlc-android/commit/3a93f9f288c84c93a0b2a756512706eae95bd9e9
---
.../vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
index b71e04e9d..77ddb72c2 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
@@ -167,7 +167,12 @@ class SubtitlesModel(private val context: Context, private val mediaUri: Uri, pr
} ?: listOf()
}
if (isActive) apiResultLiveData.postValue(subs)
- if (subs.isEmpty()) observableMessage.set(context.getString(R.string.no_result))
+ if (subs.isEmpty()) {
+ observableMessage.set(context.getString(R.string.no_result))
+ } else {
+ observableMessage.set("")
+ }
+ observableError.set(false)
} catch (e: Exception) {
Log.e("SubtitlesModel", e.message, e)
observableError.set(true)
More information about the Android
mailing list