[Android] Fix filtering

Geoffrey Métais git at videolan.org
Wed Apr 4 18:35:19 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 14 14:59:16 2018 +0100| [c2d1af4e9920f44e34844692e49cf19c0e692235] | committer: Geoffrey Métais

Fix filtering

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java     | 9 ---------
 vlc-android/src/org/videolan/vlc/util/FilterDelegate.kt          | 7 +++----
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index d999987e4..92843f1de 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -415,15 +415,6 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         return true;
     }
 
-    @Override
-    public void filter(String query) {
-        //TODO getCurrentAdapter().getFilter().filter(query);
-    }
-
-    public void restoreList() {
-        if (mViewPager != null) getCurrentAdapter().restoreList();
-    }
-
     private void updateEmptyView(int position) {
         mEmptyView.setVisibility(getCurrentAdapter().isEmpty() ? View.VISIBLE : View.GONE);
         mEmptyView.setText(position == MODE_PLAYLIST ? R.string.noplaylist : R.string.nomedia);
diff --git a/vlc-android/src/org/videolan/vlc/util/FilterDelegate.kt b/vlc-android/src/org/videolan/vlc/util/FilterDelegate.kt
index 7f8da6aea..70424f899 100644
--- a/vlc-android/src/org/videolan/vlc/util/FilterDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/util/FilterDelegate.kt
@@ -15,8 +15,7 @@ class FilterDelegate<T : MediaLibraryItem>(private val dataset: MutableLiveData<
 
     suspend fun filter(charSequence: CharSequence?) = publish(filteringJob(charSequence))
 
-
-    private suspend fun filteringJob(charSequence: CharSequence?) : MutableList<T> {
+    private suspend fun filteringJob(charSequence: CharSequence?) : MutableList<T>? {
         if (charSequence !== null) initSource()?.let {
             return withContext(CommonPool) { mutableListOf<T>().apply {
                 val queryStrings = charSequence.trim().toString().split(" ").filter { it.length > 2 }
@@ -28,12 +27,12 @@ class FilterDelegate<T : MediaLibraryItem>(private val dataset: MutableLiveData<
                 }
             }
         }
-        return mutableListOf()
+        return null
     }
 
     private fun publish(list: MutableList<T>?) {
         sourceSet?.let {
-            if (list?.isEmpty() == false)
+            if (list !== null)
                 dataset.value = list
             else {
                 dataset.value = it



More information about the Android mailing list