[Android] Fix list not refresh after adding customDirectory

Habib Kazemi git at videolan.org
Thu Aug 30 10:10:08 CEST 2018


vlc-android | branch: master | Habib Kazemi <kazemihabib1996 at gmail.com> | Wed Aug 29 21:45:11 2018 +0430| [c826c49c2b379dab0a0d29d67554d082209a08c2] | committer: Geoffrey Métais

Fix list not refresh after adding customDirectory

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

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

 .../src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt        | 2 +-
 vlc-android/src/org/videolan/vlc/repository/DirectoryRepository.kt    | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
index 94333558f..ae27e7cec 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
@@ -224,7 +224,7 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
 
             launch(UI.immediate + CoroutineExceptionHandler{ _, _ ->}) {
                 viewModel.addCustomDirectory(f.canonicalPath).join()
-                (activity as AudioPlayerContainerActivity).updateLib()
+                viewModel.browserRoot()
             }
         })
         mAlertDialog = builder.show()
diff --git a/vlc-android/src/org/videolan/vlc/repository/DirectoryRepository.kt b/vlc-android/src/org/videolan/vlc/repository/DirectoryRepository.kt
index 755901543..b49ff7b3b 100644
--- a/vlc-android/src/org/videolan/vlc/repository/DirectoryRepository.kt
+++ b/vlc-android/src/org/videolan/vlc/repository/DirectoryRepository.kt
@@ -22,10 +22,8 @@ import java.io.File
 
 class DirectoryRepository (private val customDirectoryDao: CustomDirectoryDao) {
 
-    fun addCustomDirectory(path: String): Job {
-        return launch(VLCIO) {
+    fun addCustomDirectory(path: String): Job = launch(VLCIO) {
             customDirectoryDao.insert(CustomDirectory(path))
-        }
     }
 
     suspend fun getCustomDirectories() = withContext(VLCIO) { customDirectoryDao.getAll() }



More information about the Android mailing list