[Android] Prevent pull to refresh to search when name is empty

Habib Kazemi git at videolan.org
Wed Dec 5 11:10:37 CET 2018


vlc-android | branch: master | Habib Kazemi <kazemihabib1996 at gmail.com> | Mon Nov 26 00:10:57 2018 +0330| [19657da2a744890425d664e47d6611a0b411c16b] | committer: Geoffrey Métais

Prevent pull to refresh to search when name is empty

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

> https://code.videolan.org/videolan/vlc-android/commit/19657da2a744890425d664e47d6611a0b411c16b
---

 vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
index f5f438d3b..04188cdf1 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/SubtitlesModel.kt
@@ -115,6 +115,14 @@ class SubtitlesModel(private val context: Context, private val mediaPath: String
     }
 
     fun onRefresh() {
+        if (manualSearchEnabled.get() && observableSearchName.get().isNullOrEmpty()) {
+            isApiLoading.set(false)
+            // As it's already false we need to notify it to
+            // disable refreshing animation
+            isApiLoading.notifyChange()
+            return
+        }
+
         search(!manualSearchEnabled.get())
     }
 



More information about the Android mailing list