[Android] Fix crash on lower Android versions
Nicolas Pomepuy
git at videolan.org
Mon Jan 6 09:00:04 UTC 2025
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jan 6 09:09:20 2025 +0100| [7cfc12be2d417fce36b517cb8c2c5e3affb1b920] | committer: Duncan McNamara
Fix crash on lower Android versions
> https://code.videolan.org/videolan/vlc-android/commit/7cfc12be2d417fce36b517cb8c2c5e3affb1b920
---
.../src/main/res/drawable/round_background.xml | 2 +-
.../main/res/drawable/round_background_dark.xml | 30 ++++++++++++++++++++++
.../resources/src/main/res/values/attrs.xml | 1 +
.../res/layout/audio_browser_card_item.xml | 2 +-
application/vlc-android/res/values/styles.xml | 2 ++
5 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/application/resources/src/main/res/drawable/round_background.xml b/application/resources/src/main/res/drawable/round_background.xml
index f64d2b7ecf..ba7bbb105a 100644
--- a/application/resources/src/main/res/drawable/round_background.xml
+++ b/application/resources/src/main/res/drawable/round_background.xml
@@ -25,6 +25,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
- <solid android:color="?attr/background_default" />
+ <solid android:color="@color/white" />
</shape>
\ No newline at end of file
diff --git a/application/resources/src/main/res/drawable/round_background_dark.xml b/application/resources/src/main/res/drawable/round_background_dark.xml
new file mode 100644
index 0000000000..d0ce7b2643
--- /dev/null
+++ b/application/resources/src/main/res/drawable/round_background_dark.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ *************************************************************************
+ ~ round_background_dark.xml
+ ~ **************************************************************************
+ ~ Copyright © 2025 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.
+ ~ ***************************************************************************
+ ~
+ ~
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <solid android:color="@color/grey850" />
+
+</shape>
\ No newline at end of file
diff --git a/application/resources/src/main/res/values/attrs.xml b/application/resources/src/main/res/values/attrs.xml
index b5bbc69fb5..b5a9024ccd 100644
--- a/application/resources/src/main/res/values/attrs.xml
+++ b/application/resources/src/main/res/values/attrs.xml
@@ -64,6 +64,7 @@
<attr name="audio_chip_text_color" format="color" />
<attr name="audio_seek_bar" format="reference" />
<attr name="mini_visualizer_color" format="color" />
+ <attr name="round_background" format="reference" />
<attr name="audio_chips_color" format="color" />
<attr name="audio_chips_text_color" format="color" />
<attr name="bookmark_background" format="color" />
diff --git a/application/vlc-android/res/layout/audio_browser_card_item.xml b/application/vlc-android/res/layout/audio_browser_card_item.xml
index 8f9d834f3e..26618d8a85 100644
--- a/application/vlc-android/res/layout/audio_browser_card_item.xml
+++ b/application/vlc-android/res/layout/audio_browser_card_item.xml
@@ -225,7 +225,7 @@
android:layout_height="48dp"
android:padding="8dp"
vlc:bar_color="?attr/mini_visualizer_color"
- android:background="@drawable/round_background"
+ android:background="?attr/round_background"
vlc:layout_constraintBottom_toBottomOf="@+id/media_cover"
vlc:layout_constraintEnd_toEndOf="parent"
vlc:layout_constraintStart_toStartOf="@+id/media_cover"
diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index 349125fd29..bda17fbf42 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -48,6 +48,7 @@
<item name="audio_list_background">@drawable/audio_list_background</item>
<item name="audio_seek_bar">@drawable/audio_seekbar</item>
<item name="mini_visualizer_color">@color/mini_visualizer</item>
+ <item name="round_background">@drawable/round_background</item>
<item name="bottom_sheet_background">@color/white</item>
<item name="bookmark_background">@color/white_transparent_90</item>
<item name="bottom_sheet_radius">16dp</item>
@@ -241,6 +242,7 @@
<item name="audio_list_background">@drawable/audio_list_background_black</item>
<item name="audio_seek_bar">@drawable/audio_seekbar_black</item>
<item name="mini_visualizer_color">@color/white_transparent_75</item>
+ <item name="round_background">@drawable/round_background_dark</item>
<item name="bottom_sheet_background">@color/grey875</item>
<item name="bookmark_background">@color/black_transparent_80</item>
<item name="bottom_sheet_radius">16dp</item>
More information about the Android
mailing list