[Android] Fix the favorite icon on TV
Nicolas Pomepuy
git at videolan.org
Fri May 28 08:46:00 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu May 27 08:29:34 2021 +0200| [b85af7af80ce539cb28694d11e33bb4c066ab846] | committer: Nicolas Pomepuy
Fix the favorite icon on TV
> https://code.videolan.org/videolan/vlc-android/commit/b85af7af80ce539cb28694d11e33bb4c066ab846
---
.../svg/{ic_bookmark.svg => ic_favorite.svg} | 0
...ookmark_outline.svg => ic_favorite_outline.svg} | 0
.../src/main/res/drawable/ic_bookmark_outline.xml | 40 ----------------------
.../src/main/res/drawable/ic_favorite.xml | 14 ++++++++
.../src/main/res/drawable/ic_favorite_outline.xml | 16 +++++++++
.../television/ui/browser/FileBrowserTvFragment.kt | 4 +--
6 files changed, 32 insertions(+), 42 deletions(-)
diff --git a/application/resources/assets/images/svg/ic_bookmark.svg b/application/resources/assets/images/svg/ic_favorite.svg
similarity index 100%
rename from application/resources/assets/images/svg/ic_bookmark.svg
rename to application/resources/assets/images/svg/ic_favorite.svg
diff --git a/application/resources/assets/images/svg/ic_bookmark_outline.svg b/application/resources/assets/images/svg/ic_favorite_outline.svg
similarity index 100%
rename from application/resources/assets/images/svg/ic_bookmark_outline.svg
rename to application/resources/assets/images/svg/ic_favorite_outline.svg
diff --git a/application/resources/src/main/res/drawable/ic_bookmark_outline.xml b/application/resources/src/main/res/drawable/ic_bookmark_outline.xml
deleted file mode 100644
index 4b8fc8036..000000000
--- a/application/resources/src/main/res/drawable/ic_bookmark_outline.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- ~ *************************************************************************
- ~ ic_bookmark_outline.xml
- ~ **************************************************************************
- ~ Copyright © 2020 VLC authors and VideoLAN
- ~ Author: Nicolas POMEPUY
- ~ This program is free software; you can redistribute it and/or modify
- ~ it under the terms of the GNU General Public License as published by
- ~ the Free Software Foundation; either version 2 of the License, or
- ~ (at your option) any later version.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ~ GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU General Public License
- ~ along with this program; if not, write to the Free Software
- ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- ~ ***************************************************************************
- ~
- ~
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="36dp"
- android:height="36dp"
- android:viewportWidth="48"
- android:viewportHeight="48">
- <path
- android:pathData="M24,8 L20.0625,20H8L17.668,27.2969 13.5,40 24,32.0762 34.5,40 30.332,27.2969 40,20H27.9375ZM24,14.416 L26.4883,22h7.543l-6.0449,4.5625 2.623,7.9961L24,29.5703 17.3906,34.5586 20.0137,26.5625 13.9688,22h7.543z"
- android:strokeAlpha="1"
- android:strokeLineJoin="miter"
- android:strokeWidth="4"
- android:fillColor="@color/tv_menu_selection"
- android:strokeColor="#00000000"
- android:fillType="evenOdd"
- android:fillAlpha="1"
- android:strokeLineCap="butt" />
-</vector>
diff --git a/application/resources/src/main/res/drawable/ic_favorite.xml b/application/resources/src/main/res/drawable/ic_favorite.xml
new file mode 100644
index 000000000..c318ed57d
--- /dev/null
+++ b/application/resources/src/main/res/drawable/ic_favorite.xml
@@ -0,0 +1,14 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="36dp"
+ android:height="36dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <path
+ android:pathData="m24,8 l3.9375,12H40L30.3318,27.2968 34.5,40 24,32.0755 13.5,40 17.6682,27.2968 8,20h12.0625z"
+ android:strokeLineJoin="miter"
+ android:strokeWidth="1"
+ android:fillColor="@color/tv_menu_selection"
+ android:strokeColor="#00000000"
+ android:fillType="evenOdd"
+ android:strokeLineCap="butt"/>
+</vector>
diff --git a/application/resources/src/main/res/drawable/ic_favorite_outline.xml b/application/resources/src/main/res/drawable/ic_favorite_outline.xml
new file mode 100644
index 000000000..63bfbb74f
--- /dev/null
+++ b/application/resources/src/main/res/drawable/ic_favorite_outline.xml
@@ -0,0 +1,16 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="36dp"
+ android:height="36dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <path
+ android:pathData="M24,8 L20.0625,20H8L17.668,27.2969 13.5,40 24,32.0762 34.5,40 30.332,27.2969 40,20H27.9375ZM24,14.416 L26.4883,22h7.543l-6.0449,4.5625 2.623,7.9961L24,29.5703 17.3906,34.5586 20.0137,26.5625 13.9688,22h7.543z"
+ android:strokeAlpha="1"
+ android:strokeLineJoin="miter"
+ android:strokeWidth="4"
+ android:fillColor="@color/tv_menu_selection"
+ android:strokeColor="#00000000"
+ android:fillType="evenOdd"
+ android:fillAlpha="1"
+ android:strokeLineCap="butt" />
+</vector>
diff --git a/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt b/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt
index 0966eb814..5f1f0c40b 100644
--- a/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt
@@ -198,7 +198,7 @@ class FileBrowserTvFragment : BaseBrowserTvFragment<MediaLibraryItem>(), PathAda
animationDelegate.setVisibility(binding.imageButtonFavorite, View.VISIBLE)
animationDelegate.setVisibility(binding.favoriteDescription, View.VISIBLE)
favExists = (currentItem as? MediaWrapper)?.let { browserFavRepository.browserFavExists(it.uri) } ?: false
- binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_bookmark else R.drawable.ic_bookmark_outline)
+ binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_favorite else R.drawable.ic_favorite_outline)
binding.imageButtonFavorite.setImageResource(if (favExists) R.drawable.ic_fabtvmini_bookmark else R.drawable.ic_fabtvmini_bookmark_outline)
}
binding.favoriteButton.setOnClickListener(favoriteClickListener)
@@ -272,7 +272,7 @@ class FileBrowserTvFragment : BaseBrowserTvFragment<MediaLibraryItem>(), PathAda
}
}
favExists = browserFavRepository.browserFavExists(mw.uri)
- binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_bookmark else R.drawable.ic_bookmark_outline)
+ binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_favorite else R.drawable.ic_favorite_outline)
binding.imageButtonFavorite.setImageResource(if (favExists) R.drawable.ic_fabtvmini_bookmark else R.drawable.ic_fabtvmini_bookmark_outline)
}
}
More information about the Android
mailing list