[Android] Fix audio player crash on KitKat

Nicolas Pomepuy git at videolan.org
Tue May 26 10:19:50 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon May 25 07:57:56 2020 +0200| [6c3b5d97ef8ec97ef1d6744215537d95eb578768] | committer: Nicolas Pomepuy

Fix audio player crash on KitKat

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

 ...rounded_corners_bottom_default_darker_dark.xml} |  4 +--
 ...rounded_corners_bottom_default_darker_light.xml | 32 ++++++++++++++++++++++
 .../resources/src/main/res/values/attrs.xml        |  1 +
 .../vlc-android/res/layout-land/audio_player.xml   |  2 +-
 .../vlc-android/res/layout/audio_player.xml        |  2 +-
 application/vlc-android/res/values/styles.xml      |  2 ++
 6 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker.xml b/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker_dark.xml
similarity index 91%
rename from application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker.xml
rename to application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker_dark.xml
index 73e56bfa7..48853298e 100644
--- a/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker.xml
+++ b/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker_dark.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?><!--
   ~ *************************************************************************
-  ~  rounded_corners_bottom_default_darker.xml
+  ~  rounded_corners_bottom_default_darker_dark.xml
   ~ **************************************************************************
   ~ Copyright © 2020 VLC authors and VideoLAN
   ~ Author: Nicolas POMEPUY
@@ -24,7 +24,7 @@
 
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
         android:shape="rectangle">
-    <solid android:color="?attr/background_default_darker"></solid>
+    <solid android:color="@color/grey875" />
     <corners
             android:topLeftRadius="4dp"
             android:topRightRadius="4dp" />
diff --git a/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker_light.xml b/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker_light.xml
new file mode 100644
index 000000000..1ad9210b9
--- /dev/null
+++ b/application/resources/src/main/res/drawable/rounded_corners_bottom_default_darker_light.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+  ~ *************************************************************************
+  ~  rounded_corners_bottom_default_darker_light.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.
+  ~ ***************************************************************************
+  ~
+  ~
+  -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+        android:shape="rectangle">
+    <solid android:color="@color/grey200" />
+    <corners
+            android:topLeftRadius="4dp"
+            android:topRightRadius="4dp" />
+
+</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 6a2e8475f..5e234a57d 100644
--- a/application/resources/src/main/res/values/attrs.xml
+++ b/application/resources/src/main/res/values/attrs.xml
@@ -63,6 +63,7 @@
     <attr name="empty_button" format="reference" />
     <attr name="default_separator" format="color" />
     <attr name="card_border" format="color" />
+    <attr name="rounded_corners_bottom_default_darker" format="reference" />
 
     <!--Main Icons-->
     <attr name="ic_down_style" format="reference" />
diff --git a/application/vlc-android/res/layout-land/audio_player.xml b/application/vlc-android/res/layout-land/audio_player.xml
index 20f4ffffb..5d222ab1a 100644
--- a/application/vlc-android/res/layout-land/audio_player.xml
+++ b/application/vlc-android/res/layout-land/audio_player.xml
@@ -266,7 +266,7 @@
                 android:id="@+id/audio_play_progress"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:background="@drawable/rounded_corners_bottom_default_darker"
+                android:background="?attr/rounded_corners_bottom_default_darker"
                 android:elevation="4dp"
                 android:paddingStart="8dp"
                 android:paddingTop="4dp"
diff --git a/application/vlc-android/res/layout/audio_player.xml b/application/vlc-android/res/layout/audio_player.xml
index f44cc61c3..9107425d3 100644
--- a/application/vlc-android/res/layout/audio_player.xml
+++ b/application/vlc-android/res/layout/audio_player.xml
@@ -259,7 +259,7 @@
                 android:id="@+id/audio_play_progress"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:background="@drawable/rounded_corners_bottom_default_darker"
+                android:background="?attr/rounded_corners_bottom_default_darker"
                 android:elevation="4dp"
                 android:paddingStart="8dp"
                 android:paddingTop="4dp"
diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index 032a7cc1b..aa835776f 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -111,6 +111,7 @@
         <item name="default_separator">@color/grey300</item>
         <item name="empty_button">@style/Widget.MaterialComponents.Button.OutlinedButton</item>
         <item name="card_border">@color/grey300</item>
+        <item name="rounded_corners_bottom_default_darker">@drawable/rounded_corners_bottom_default_darker_light</item>
     </style>
 
     <style name="Theme.VLC.PickerDialog" parent="Theme.MaterialComponents.Dialog">
@@ -237,6 +238,7 @@
         <item name="empty_button">@style/Widget.MaterialComponents.Button.OutlinedButton</item>
 
         <item name="card_border">@color/grey800</item>
+        <item name="rounded_corners_bottom_default_darker">@drawable/rounded_corners_bottom_default_darker_dark</item>
     </style>
 
     <style name="Theme.VLC.Onboarding" parent="Theme.VLC.Black">



More information about the Android mailing list