[Android] Add an empty favorite state in empty view

Nicolas Pomepuy git at videolan.org
Tue Mar 14 11:59:20 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Feb 21 09:39:33 2023 +0100| [f9fa0a1786c510543f422cf56348e0055ac5512b] | committer: Nicolas Pomepuy

Add an empty favorite state in empty view

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

 application/resources/src/main/res/values/strings.xml          |  1 +
 .../src/org/videolan/vlc/gui/view/EmptyLoadingStateView.kt     | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 32a4f5b8e6..1c9544b61a 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -138,6 +138,7 @@
     <string name="loading">Loading</string>
     <string name="please_wait">Please wait…</string>
     <string name="nomedia">No media files found, please transfer some files to your device or adjust your preferences.</string>
+    <string name="nofav">No favorite found.</string>
     <string name="empty_search">No item found for search %s</string>
     <string name="noplaylist">No playlist found.</string>
     <string name="nosubfolder">No subfolder</string>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/view/EmptyLoadingStateView.kt b/application/vlc-android/src/org/videolan/vlc/gui/view/EmptyLoadingStateView.kt
index b8a1d943cd..da94b69768 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/view/EmptyLoadingStateView.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/view/EmptyLoadingStateView.kt
@@ -73,14 +73,14 @@ class EmptyLoadingStateView : FrameLayout {
         set(value) {
             loadingFlipper.visibility = if (value == EmptyLoadingState.LOADING) View.VISIBLE else View.GONE
             loadingTitle.visibility = if (value == EmptyLoadingState.LOADING) View.VISIBLE else View.GONE
-            emptyTextView.visibility = if (value in arrayOf(EmptyLoadingState.EMPTY, EmptyLoadingState.EMPTY_SEARCH)) View.VISIBLE else View.GONE
-            emptyImageView.visibility = if (value in arrayOf(EmptyLoadingState.EMPTY,EmptyLoadingState.MISSING_PERMISSION, EmptyLoadingState.EMPTY_SEARCH)) View.VISIBLE else View.GONE
-            emptyImageView.setImageBitmap(context.getBitmapFromDrawable(if (value in arrayOf(EmptyLoadingState.EMPTY, EmptyLoadingState.EMPTY_SEARCH)) R.drawable.ic_empty else R.drawable.ic_empty_warning))
+            emptyTextView.visibility = if (value in arrayOf(EmptyLoadingState.EMPTY, EmptyLoadingState.EMPTY_SEARCH, EmptyLoadingState.EMPTY_FAVORITES)) View.VISIBLE else View.GONE
+            emptyImageView.visibility = if (value in arrayOf(EmptyLoadingState.EMPTY,EmptyLoadingState.MISSING_PERMISSION, EmptyLoadingState.EMPTY_SEARCH, EmptyLoadingState.EMPTY_FAVORITES)) View.VISIBLE else View.GONE
+            emptyImageView.setImageBitmap(context.getBitmapFromDrawable(if (value in arrayOf(EmptyLoadingState.EMPTY, EmptyLoadingState.EMPTY_SEARCH, EmptyLoadingState.EMPTY_FAVORITES)) R.drawable.ic_empty else R.drawable.ic_empty_warning))
             permissionTitle.visibility = if (value == EmptyLoadingState.MISSING_PERMISSION) View.VISIBLE else View.GONE
             permissionTextView.visibility = if (value == EmptyLoadingState.MISSING_PERMISSION) View.VISIBLE else View.GONE
             grantPermissionButton.visibility = if (value == EmptyLoadingState.MISSING_PERMISSION) View.VISIBLE else View.GONE
             pickFileButton.visibility = if (value == EmptyLoadingState.MISSING_PERMISSION && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) View.VISIBLE else View.GONE
-            noMediaButton.visibility = if (showNoMedia && value == EmptyLoadingState.EMPTY) View.VISIBLE else View.GONE
+            noMediaButton.visibility = if (showNoMedia && value == EmptyLoadingState.EMPTY) View.VISIBLE else if (value == EmptyLoadingState.EMPTY_FAVORITES) View.INVISIBLE else  View.GONE
             field = value
         }
 
@@ -172,5 +172,5 @@ class EmptyLoadingStateView : FrameLayout {
 }
 
 enum class EmptyLoadingState {
-    LOADING, EMPTY, EMPTY_SEARCH, NONE, MISSING_PERMISSION
+    LOADING, EMPTY, EMPTY_SEARCH, NONE, MISSING_PERMISSION, EMPTY_FAVORITES
 }
\ No newline at end of file



More information about the Android mailing list