[Android] Show protocol for favorites in main browse fragment

Nicolas Pomepuy git at videolan.org
Thu Apr 16 15:43:21 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Apr  1 11:01:40 2020 +0200| [6106559c5d7851af5b8f29f1d79f6c51c5e77b7d] | committer: Nicolas Pomepuy

Show protocol for favorites in main browse fragment

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

 .../resources/src/main/java/org/videolan/resources/AndroidDevices.kt   | 2 ++
 application/resources/src/main/res/values/strings.xml                  | 1 +
 application/vlc-android/res/layout/main_browser_fragment.xml           | 3 +--
 .../src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt            | 2 +-
 .../src/org/videolan/vlc/viewmodels/browser/BrowserFavoritesModel.kt   | 3 +++
 5 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt b/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt
index f715c9c6c..7782e62cd 100644
--- a/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt
+++ b/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt
@@ -214,6 +214,8 @@ object AndroidDevices {
             }
 
         }
+
+        fun isOneOfMediaFolders(uri: Uri) = EXTERNAL_PUBLIC_MOVIES_DIRECTORY_URI == uri || EXTERNAL_PUBLIC_MUSIC_DIRECTORY_URI == uri || EXTERNAL_PUBLIC_PODCAST_DIRECTORY_URI == uri || EXTERNAL_PUBLIC_DOWNLOAD_DIRECTORY_URI == uri || EXTERNAL_PUBLIC_DCIM_DIRECTORY_URI == uri || WHATSAPP_VIDEOS_FILE == uri
     }
 
     fun close(closeable: Closeable?): Boolean {
diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 06fd7ff76..275960fa4 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -824,4 +824,5 @@
     <string name="new_title">New title</string>
     <string name="browse">Browse</string>
     <string name="more">More</string>
+    <string name="favorites">Favorites</string>
 </resources>
diff --git a/application/vlc-android/res/layout/main_browser_fragment.xml b/application/vlc-android/res/layout/main_browser_fragment.xml
index ee5b9fef6..2489830c9 100644
--- a/application/vlc-android/res/layout/main_browser_fragment.xml
+++ b/application/vlc-android/res/layout/main_browser_fragment.xml
@@ -27,8 +27,7 @@
         android:background="?attr/background_default"
         android:layout_height="match_parent">
 
-    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            xmlns:app="http://schemas.android.com/apk/res-auto"
+    <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
index d581f818f..13c3a398d 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
@@ -150,7 +150,7 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
 
 
         favoritesEntry = view.findViewById(R.id.fav_browser_entry)
-        favoritesEntry.findViewById<TextView>(R.id.title).text = getString(R.string.favorite)
+        favoritesEntry.findViewById<TextView>(R.id.title).text = getString(R.string.favorites)
         favoritesList = favoritesEntry.findViewById(R.id.list)
         favoritesList.layoutManager = LinearLayoutManager(requireActivity(), RecyclerView.HORIZONTAL, false)
         val favoritesBrowserContainer = MainBrowserContainer(isNetwork = false, isFile = true)
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserFavoritesModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserFavoritesModel.kt
index d849b7c3b..3a0d682ed 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserFavoritesModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserFavoritesModel.kt
@@ -30,10 +30,13 @@ import androidx.lifecycle.AndroidViewModel
 import androidx.lifecycle.LiveData
 import androidx.lifecycle.MutableLiveData
 import androidx.lifecycle.Observer
+import kotlinx.coroutines.CoroutineScope
 import org.videolan.medialibrary.interfaces.media.MediaWrapper
+import org.videolan.tools.CoroutineContextProvider
 import org.videolan.vlc.mediadb.models.BrowserFav
 import org.videolan.vlc.repository.BrowserFavRepository
 import org.videolan.vlc.util.convertFavorites
+import kotlin.coroutines.CoroutineContext
 
 class BrowserFavoritesModel(context: Context) : AndroidViewModel(context.applicationContext as Application) {
     private val browserFavRepository = BrowserFavRepository.getInstance(context)



More information about the Android mailing list