[Android] Fix iab crash on API 19
Nicolas Pomepuy
git at videolan.org
Wed Aug 12 14:04:20 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Aug 10 08:39:08 2020 +0200| [40bf1872c3ca0471c1828fd669763b0015847fac] | committer: Nicolas Pomepuy
Fix iab crash on API 19
> https://code.videolan.org/videolan/vlc-android/commit/40bf1872c3ca0471c1828fd669763b0015847fac
---
.../main/res/drawable/donate_background_color.xml | 4 +--
.../res/drawable/donate_background_color_dark.xml | 29 +++++++++++++++++++++
.../main/res/drawable/donate_button_background.xml | 2 +-
...t_darker.xml => rectangle_default_grey_200.xml} | 2 +-
.../src/main/res/drawable/rectangle_orange_500.xml | 30 ++++++++++++++++++++++
.../resources/src/main/res/values/attrs.xml | 2 +-
.../vlc-android/res/layout/donation_sku.xml | 2 +-
application/vlc-android/res/layout/donations.xml | 1 -
application/vlc-android/res/values/styles.xml | 4 +--
9 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/application/resources/src/main/res/drawable/donate_background_color.xml b/application/resources/src/main/res/drawable/donate_background_color.xml
index 20580f7e4..ce06515ec 100644
--- a/application/resources/src/main/res/drawable/donate_background_color.xml
+++ b/application/resources/src/main/res/drawable/donate_background_color.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/rectangle_primary" android:state_selected="true"/>
- <item android:drawable="@drawable/rectangle_default_darker"/>
+ <item android:drawable="@drawable/rectangle_orange_500" android:state_selected="true"/>
+ <item android:drawable="@drawable/rectangle_default_grey_200"/>
</selector>
\ No newline at end of file
diff --git a/application/resources/src/main/res/drawable/donate_background_color_dark.xml b/application/resources/src/main/res/drawable/donate_background_color_dark.xml
new file mode 100644
index 000000000..e8ee70cc0
--- /dev/null
+++ b/application/resources/src/main/res/drawable/donate_background_color_dark.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ *************************************************************************
+ ~ donate_background_color_dark.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.
+ ~ ***************************************************************************
+ ~
+ ~
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/rectangle_orange_500" android:state_selected="true"/>
+ <item android:drawable="@drawable/rectangle_grey_700"/>
+</selector>
\ No newline at end of file
diff --git a/application/resources/src/main/res/drawable/donate_button_background.xml b/application/resources/src/main/res/drawable/donate_button_background.xml
index 02392f908..21bf81ec6 100644
--- a/application/resources/src/main/res/drawable/donate_button_background.xml
+++ b/application/resources/src/main/res/drawable/donate_button_background.xml
@@ -4,5 +4,5 @@
<item android:state_pressed="true" android:drawable="@drawable/rectangle_orange_300" />
<item android:state_focused="true" android:drawable="@drawable/rectangle_orange_400" />
<item android:state_enabled="false" android:drawable="@drawable/rectangle_grey_700" />
- <item android:drawable="@drawable/rectangle_primary" />
+ <item android:drawable="@drawable/rectangle_orange_500" />
</selector>
\ No newline at end of file
diff --git a/application/resources/src/main/res/drawable/rectangle_default_darker.xml b/application/resources/src/main/res/drawable/rectangle_default_grey_200.xml
similarity index 71%
rename from application/resources/src/main/res/drawable/rectangle_default_darker.xml
rename to application/resources/src/main/res/drawable/rectangle_default_grey_200.xml
index 08cb3219c..014e944a8 100644
--- a/application/resources/src/main/res/drawable/rectangle_default_darker.xml
+++ b/application/resources/src/main/res/drawable/rectangle_default_grey_200.xml
@@ -2,7 +2,7 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="?attr/donate_item_background">
+ <solid android:color="@color/grey200">
</solid>
</shape>
\ No newline at end of file
diff --git a/application/resources/src/main/res/drawable/rectangle_orange_500.xml b/application/resources/src/main/res/drawable/rectangle_orange_500.xml
new file mode 100644
index 000000000..996cbd936
--- /dev/null
+++ b/application/resources/src/main/res/drawable/rectangle_orange_500.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ *************************************************************************
+ ~ rectangle_orange_500.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/orange500" />
+
+</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 c0635265e..7697fbd24 100644
--- a/application/resources/src/main/res/values/attrs.xml
+++ b/application/resources/src/main/res/values/attrs.xml
@@ -66,7 +66,7 @@
<attr name="card_border" format="color" />
<attr name="rounded_corners_bottom_default_darker" format="reference" />
<attr name="donate_card" format="color" />
- <attr name="donate_item_background" format="color" />
+ <attr name="donate_item_background" format="reference" />
<!--Main Icons-->
<attr name="ic_down_style" format="reference" />
diff --git a/application/vlc-android/res/layout/donation_sku.xml b/application/vlc-android/res/layout/donation_sku.xml
index d698f83df..63829dda9 100644
--- a/application/vlc-android/res/layout/donation_sku.xml
+++ b/application/vlc-android/res/layout/donation_sku.xml
@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:id="@+id/container"
xmlns:tools="http://schemas.android.com/tools"
- android:background="@drawable/donate_background_color">
+ android:background="?attr/donate_item_background">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/skuCheck"
diff --git a/application/vlc-android/res/layout/donations.xml b/application/vlc-android/res/layout/donations.xml
index 7db6b65e2..c8066ec29 100644
--- a/application/vlc-android/res/layout/donations.xml
+++ b/application/vlc-android/res/layout/donations.xml
@@ -191,7 +191,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="1dp"
- android:background="@drawable/donate_background_color"
android:foreground="?android:attr/selectableItemBackground"
app:layout_constraintEnd_toStartOf="@+id/donation_tier_2"
app:layout_constraintHorizontal_bias="0.5"
diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index 8572944af..9daf1d137 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -74,7 +74,7 @@
<item name="list_title_last">@color/list_title_last</item>
<item name="list_title">@color/grey900</item>
<item name="donate_card">@color/orange500</item>
- <item name="donate_item_background">@color/grey200</item>
+ <item name="donate_item_background">@drawable/donate_background_color</item>
<item name="android:windowBackground">@color/white</item>
<item name="ic_playlist">@drawable/ic_playlist</item>
@@ -209,7 +209,7 @@
<item name="list_title_last">@color/list_title_last</item>
<item name="list_title">@color/white</item>
<item name="donate_card">@color/orange500transparent</item>
- <item name="donate_item_background">@color/grey700</item>
+ <item name="donate_item_background">@drawable/donate_background_color_dark</item>
<item name="android:windowBackground">@color/black</item>
<item name="ic_playlist">@drawable/ic_playlist_w</item>
More information about the Android
mailing list