[Android] Defaut player bg if bitmap cannot be blurred

Geoffrey Métais git at videolan.org
Fri Mar 3 10:32:25 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar  3 09:41:48 2017 +0100| [75eb8ea87e0c626bda8786e4c1521f63ff780399] | committer: Geoffrey Métais

Defaut player bg if bitmap cannot be blurred

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

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 10 ++++++++--
 vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java   |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 3e60f54..47702c7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -281,8 +281,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
                 return;
             mCurrentCoverArt = mw.getArtworkMrl();
             if (TextUtils.isEmpty(mw.getArtworkMrl())) {
-                mBinding.songsList.setBackgroundResource(DEFAULT_BACKGROUND_ID);
-                mBinding.backgroundView.setVisibility(View.INVISIBLE);
+                setDefaultBackground();
             } else {
                 VLCApplication.runBackground(new Runnable() {
                     @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@@ -302,6 +301,8 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
                                     mBinding.songsList.setBackgroundResource(0);
                                 }
                             });
+                        else
+                            setDefaultBackground();
                     }
                 });
             }
@@ -311,6 +312,11 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
 
     }
 
+    private void setDefaultBackground() {
+        mBinding.songsList.setBackgroundResource(DEFAULT_BACKGROUND_ID);
+        mBinding.backgroundView.setVisibility(View.INVISIBLE);
+    }
+
     public void updateList() {
         hideSearchField();
         if (mService != null)
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
index fa18fb6..aef69d0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
@@ -273,8 +273,8 @@ public class UiTools {
     }
 
     @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
-    public static Bitmap blurBitmap(Bitmap bitmap){
-        if (bitmap == null)
+    public static Bitmap blurBitmap(Bitmap bitmap) {
+        if (bitmap == null || bitmap.getConfig() == null)
             return null;
 
 		//Let's create an empty bitmap with the same size of the bitmap we want to blur



More information about the Android mailing list