[Android] New icons and better image scaling
Geoffrey Métais
git at videolan.org
Thu Feb 19 18:45:42 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 19 18:45:28 2015 +0100| [c547e625645df12aee831b186c2dc4468786e0ec] | committer: Geoffrey Métais
New icons and better image scaling
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c547e625645df12aee831b186c2dc4468786e0ec
---
.../src/org/videolan/vlc/gui/tv/CardPresenter.java | 26 +++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/CardPresenter.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/CardPresenter.java
index b4df948..8fff175 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/CardPresenter.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/CardPresenter.java
@@ -73,14 +73,21 @@ public class CardPresenter extends Presenter {
Bitmap picture = null;
if (MediaWrapper.getType() == MediaWrapper.TYPE_AUDIO) {
picture = AudioUtil.getCover(sContext, MediaWrapper, 320);
- if (picture == null)
- picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_song_big);
- }else if (MediaWrapper.getType() == MediaWrapper.TYPE_VIDEO) {
+ if (picture == null) {
+ mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
+ picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_audio_big_normal);
+ }
+ } else if (MediaWrapper.getType() == MediaWrapper.TYPE_VIDEO) {
picture = sMediaDatabase.getPicture(sContext, MediaWrapper.getLocation());
- if (picture == null)
- picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_video_collection_big);
- } else if (MediaWrapper.getType() == MediaWrapper.TYPE_DIR)
- picture = BitmapFactory.decodeResource(mRes, R.drawable.background_cone);
+ if (picture == null){
+ mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
+ picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_video_big_normal);
+ }
+ } else if (MediaWrapper.getType() == MediaWrapper.TYPE_DIR) {
+ mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
+ picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_menu_network_big);
+ } else
+ mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER_CROP);
if (picture != null && picture.getByteCount() > 4)
mCardView.setMainImage(new BitmapDrawable(mRes, picture));
else
@@ -88,6 +95,7 @@ public class CardPresenter extends Presenter {
}
protected void updateCardViewImage(Drawable image) {
+ mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
mCardView.setMainImage(image);
}
}
@@ -107,7 +115,6 @@ public class CardPresenter extends Presenter {
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
ViewHolder holder = ((ViewHolder) viewHolder);
if (item instanceof MediaWrapper) {
- holder.mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER_CROP);
MediaWrapper MediaWrapper = (MediaWrapper) item;
holder.mCardView.setTitleText(MediaWrapper.getTitle());
holder.mCardView.setContentText(MediaWrapper.getDescription());
@@ -117,19 +124,16 @@ public class CardPresenter extends Presenter {
else
holder.updateCardViewImage(MediaWrapper);
} else if (item instanceof MusicFragment.ListItem) {
- holder.mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER_CROP);
MusicFragment.ListItem listItem = (MusicFragment.ListItem) item;
MediaWrapper MediaWrapper = listItem.mediaList.get(0);
holder.mCardView.setTitleText(listItem.mTitle);
holder.mCardView.setContentText(listItem.mSubTitle);
holder.updateCardViewImage(MediaWrapper);
} else if (item instanceof SimpleCard){
- holder.mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
SimpleCard card = (SimpleCard) item;
holder.mCardView.setTitleText(card.getName());
holder.updateCardViewImage(mRes.getDrawable(card.getImageId()));
}else if (item instanceof String){
- holder.mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
holder.mCardView.setTitleText((String) item);
holder.updateCardViewImage(sDefaultCardImage);
}
More information about the Android
mailing list