[Android] Fix crash and icon tinting on lower Android versions

Nicolas Pomepuy git at videolan.org
Thu Apr 16 15:43:28 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Apr  3 10:29:10 2020 +0200| [382f04a50204da66987f36887575978c46acfe22] | committer: Nicolas Pomepuy

Fix crash and icon tinting on lower Android versions

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

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

diff --git a/application/vlc-android/res/layout/browser_item.xml b/application/vlc-android/res/layout/browser_item.xml
index 39b6ac87b..34d129165 100644
--- a/application/vlc-android/res/layout/browser_item.xml
+++ b/application/vlc-android/res/layout/browser_item.xml
@@ -139,7 +139,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginEnd="8dp"
-            android:background="@drawable/ic_more"
+                app:srcCompat="@drawable/ic_more"
             android:clickable="@{hasContextMenu}"
             android:onClick="@{holder::onMoreClick}"
             android:visibility="@{hasContextMenu ? View.VISIBLE : View.GONE, default=gone}"
diff --git a/application/vlc-android/res/layout/card_browser_item.xml b/application/vlc-android/res/layout/card_browser_item.xml
index 4d89f9fc4..cf64c885b 100644
--- a/application/vlc-android/res/layout/card_browser_item.xml
+++ b/application/vlc-android/res/layout/card_browser_item.xml
@@ -168,7 +168,7 @@
                     android:id="@+id/item_more"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="@drawable/ic_more"
+                    app:srcCompat="@drawable/ic_more"
                     android:clickable="@{hasContextMenu}"
                     android:onClick="@{holder::onMoreClick}"
                     android:visibility="@{hasContextMenu ? View.VISIBLE : View.GONE, default=gone}"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
index b3ede3328..cc8163d8c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
@@ -50,6 +50,7 @@ import com.google.android.material.tabs.TabLayout
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import kotlinx.coroutines.delay
+import org.videolan.libvlc.util.AndroidUtil
 import org.videolan.medialibrary.interfaces.Medialibrary
 import org.videolan.resources.util.getFromMl
 import org.videolan.resources.util.startMedialibrary
@@ -128,7 +129,7 @@ open class AudioPlayerContainerActivity : BaseActivity() {
         bottomBar = findViewById(R.id.navigation)
         tabLayout?.viewTreeObserver?.addOnGlobalLayoutListener {
             //add a shadow if there are tabs
-            appBarLayout.elevation = if (tabLayout?.isVisible() == true) 4.dp.toFloat() else 0.dp.toFloat()
+            if (AndroidUtil.isLolliPopOrLater) appBarLayout.elevation = if (tabLayout?.isVisible() == true) 4.dp.toFloat() else 0.dp.toFloat()
         }
         audioPlayerContainer = findViewById(R.id.audio_player_container)
     }



More information about the Android mailing list