[Android] Fix music cover cropping in player

Geoffrey Métais git at videolan.org
Wed Dec 6 14:33:26 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  4 18:20:38 2017 +0100| [618a16e74a5dd333782c417a79b0c017616f53a7] | committer: Geoffrey Métais

Fix music cover cropping in player

(cherry picked from commit d77eb6a8ca38761091eac88f7226c960fbd81e87)

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

 vlc-android/res/layout/audio_player.xml                           | 8 ++++----
 vlc-android/res/values-sw600dp/dimens.xml                         | 2 +-
 vlc-android/res/values/dimens.xml                                 | 2 +-
 vlc-android/src/org/videolan/vlc/gui/view/CoverMediaSwitcher.java | 7 +++----
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index 570e905fe..049fce4b8 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -188,10 +188,10 @@
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/header"
             app:layout_constraintBottom_toTopOf="@+id/timeline"
-            android:paddingLeft="@dimen/audio_player_cover_margin"
-            android:paddingRight="@dimen/audio_player_cover_margin"
-            android:paddingStart="@dimen/audio_player_cover_margin"
-            android:paddingEnd="@dimen/audio_player_cover_margin"
+            android:layout_marginLeft="@dimen/audio_player_cover_margin"
+            android:layout_marginRight="@dimen/audio_player_cover_margin"
+            android:layout_marginStart="@dimen/audio_player_cover_margin"
+            android:layout_marginEnd="@dimen/audio_player_cover_margin"
             android:layout_marginTop="@dimen/default_margin"
             android:layout_marginBottom="@dimen/default_margin"
             android:visibility="@{showCover ? View.VISIBLE : View.GONE}"
diff --git a/vlc-android/res/values-sw600dp/dimens.xml b/vlc-android/res/values-sw600dp/dimens.xml
index d6c0165fc..d1796357f 100644
--- a/vlc-android/res/values-sw600dp/dimens.xml
+++ b/vlc-android/res/values-sw600dp/dimens.xml
@@ -10,5 +10,5 @@
     <dimen name="overlay_margin">10dp</dimen>
 
     <dimen name="file_picker_width">600dip</dimen>
-    <dimen name="audio_player_cover_margin">60dp</dimen>
+    <dimen name="audio_player_cover_margin">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index 881e9c397..93b366eb7 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -69,7 +69,7 @@
     <dimen name="fastscroller_track_height">30dp</dimen>
     <dimen name="fastscroller_track_width">6dp</dimen>
     <dimen name="fastscroller_track_padding">5dp</dimen>
-    <dimen name="audio_player_cover_margin">30dp</dimen>
+    <dimen name="audio_player_cover_margin">8dp</dimen>
     <dimen name="audio_player_elevation">16dp</dimen>
     <dimen name="progress_layout_height">24dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/CoverMediaSwitcher.java b/vlc-android/src/org/videolan/vlc/gui/view/CoverMediaSwitcher.java
index 2eff69a1a..939c5a27d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/CoverMediaSwitcher.java
+++ b/vlc-android/src/org/videolan/vlc/gui/view/CoverMediaSwitcher.java
@@ -37,12 +37,11 @@ public class CoverMediaSwitcher extends AudioMediaSwitcher {
 
     protected void addMediaView(LayoutInflater inflater, String title, String artist, Bitmap cover) {
 
-        if (cover == null)
-            cover = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
+        if (cover == null) cover = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
 
-        ImageView imageView = new ImageView(getContext());
-        imageView.setImageBitmap(cover);
+        final ImageView imageView = new ImageView(getContext());
         imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
+        imageView.setImageBitmap(cover);
         addView(imageView);
     }
 }



More information about the Android mailing list