[Android] Fix Android TV interface crash on API 19

Nicolas Pomepuy git at videolan.org
Tue Nov 30 06:28:32 UTC 2021


vlc-android | branch: 3.4.x | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Nov 26 11:09:18 2021 +0100| [a20ab0534c1e9c119f432246b65e59644701fd8e] | committer: Nicolas Pomepuy

Fix Android TV interface crash on API 19

(cherry picked from commit 3f12d7c81465fe1fb79d7db71ed9a7da7783d9e6)

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

 application/vlc-android/res/layout/view_empty_loading.xml             | 3 +--
 .../src/org/videolan/vlc/gui/view/EmptyLoadingStateView.kt            | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/res/layout/view_empty_loading.xml b/application/vlc-android/res/layout/view_empty_loading.xml
index ee84037bc..4debdcfb0 100644
--- a/application/vlc-android/res/layout/view_empty_loading.xml
+++ b/application/vlc-android/res/layout/view_empty_loading.xml
@@ -49,8 +49,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             app:barrierDirection="bottom"
-            app:constraint_referenced_ids="emptyTextView"
-            tools:layout_editor_absoluteY="199dp" />
+            app:constraint_referenced_ids="emptyTextView"/>
 
     <TextView
             android:id="@+id/emptyTextView"
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 bdf0c356e..5bf431a9a 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
@@ -44,6 +44,8 @@ import kotlinx.android.synthetic.main.view_empty_loading.view.*
 import org.videolan.resources.ACTIVITY_RESULT_PREFERENCES
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.SecondaryActivity
+import org.videolan.vlc.gui.helpers.BitmapUtil
+import org.videolan.vlc.gui.helpers.getBitmapFromDrawable
 import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate.Companion.askStoragePermission
 
 class EmptyLoadingStateView : FrameLayout {
@@ -64,7 +66,7 @@ class EmptyLoadingStateView : FrameLayout {
             loadingTitle.visibility = if (value == EmptyLoadingState.LOADING) View.VISIBLE else View.GONE
             emptyTextView.visibility = if (value == EmptyLoadingState.EMPTY) View.VISIBLE else View.GONE
             emptyImageView.visibility = if (value == EmptyLoadingState.EMPTY || value == EmptyLoadingState.MISSING_PERMISSION) View.VISIBLE else View.GONE
-            emptyImageView.setImageDrawable(ContextCompat.getDrawable(context, if (value == EmptyLoadingState.EMPTY) R.drawable.ic_empty else R.drawable.ic_empty_warning))
+            emptyImageView.setImageBitmap(context.getBitmapFromDrawable(if (value == EmptyLoadingState.EMPTY) 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



More information about the Android mailing list