[Android] Better scale for images in cardviews

Geoffrey Métais git at videolan.org
Thu Dec 11 18:00:05 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 11 17:59:20 2014 +0100| [6999beb5ec1f607766cd14dbec8d0caa4c73dafc] | committer: Geoffrey Métais

Better scale for images in cardviews

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=6999beb5ec1f607766cd14dbec8d0caa4c73dafc
---

 vlc-android/res/layout/video_grid_card.xml                       |    2 +-
 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/video_grid_card.xml b/vlc-android/res/layout/video_grid_card.xml
index e94566a..04e74ef 100644
--- a/vlc-android/res/layout/video_grid_card.xml
+++ b/vlc-android/res/layout/video_grid_card.xml
@@ -19,7 +19,7 @@
             android:layout_width="match_parent"
             android:layout_height="@dimen/grid_card_thumb_height"
             android:layout_alignParentTop="true"
-            android:scaleType="fitCenter" />
+            android:scaleType="fitXY" />
 
         <TextView
             android:id="@+id/ml_item_title"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 08a4258..f34c3bb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -175,11 +175,13 @@ public class VideoListAdapter extends ArrayAdapter<Media>
         Bitmap thumbnail = BitmapUtil.getPictureFromCache(media);
         if (thumbnail == null) {
             // missing thumbnail
-            thumbnail = BitmapCache.GetFromResource(v, R.drawable.icon_g);
+            thumbnail = BitmapCache.GetFromResource(v, R.drawable.ic_cone_o);
+            holder.thumbnail.setScaleType(ImageView.ScaleType.FIT_CENTER);
         }
         else if (thumbnail.getWidth() == 1 && thumbnail.getHeight() == 1) {
             // dummy thumbnail
-            thumbnail = BitmapCache.GetFromResource(v, R.drawable.icon);
+            thumbnail = BitmapCache.GetFromResource(v, R.drawable.ic_cone_o);
+            holder.thumbnail.setScaleType(ImageView.ScaleType.FIT_CENTER);
         }
         //FIXME Warning: the thumbnails are upscaled in the grid view!
         holder.thumbnail.setImageBitmap(thumbnail);



More information about the Android mailing list