Commit 0a92e7bb authored by Geoffrey Métais's avatar Geoffrey Métais

Harmonize video thumb display size

- Use resources values
- TV uses the dimension value
parent 139271d6
......@@ -18,7 +18,7 @@
<ImageView
android:id="@+id/ml_item_thumbnail"
android:layout_width="match_parent"
android:layout_width="@dimen/grid_card_thumb_width"
android:layout_height="@dimen/grid_card_thumb_height"
android:layout_alignParentTop="true"
android:background="?attr/background_default_darker"
......
<resources>
<dimen name="grid_card_width">200dp</dimen>
<dimen name="grid_card_height">200dp</dimen>
<dimen name="grid_card_thumb_width">200dp</dimen>
<dimen name="grid_card_thumb_height">125dp</dimen>
<dimen name="grid_card_title_text_size">16sp</dimen>
<dimen name="grid_card_subtitle_text_size">12sp</dimen>
......
......@@ -7,6 +7,7 @@
<dimen name="listview_side_padding">5dp</dimen>
<dimen name="grid_card_width">160dp</dimen>
<dimen name="grid_card_height">160dp</dimen>
<dimen name="grid_card_thumb_width">160dp</dimen>
<dimen name="grid_card_thumb_height">100dp</dimen>
<dimen name="grid_card_title_text_size">12sp</dimen>
<dimen name="grid_card_subtitle_text_size">10sp</dimen>
......
<resources>
<dimen name="tv_card_width">192dp</dimen>
<dimen name="tv_card_height">108dp</dimen>
<dimen name="grid_card_thumb_width">192dp</dimen>
<dimen name="grid_card_thumb_height">108dp</dimen>
<dimen name="tv_overscan_vertical">27dp</dimen>
<dimen name="tv_overscan_horizontal">48dp</dimen>
</resources>
\ No newline at end of file
......@@ -25,6 +25,7 @@ import org.videolan.vlc.R;
import org.videolan.vlc.gui.audio.AudioUtil;
import org.videolan.vlc.gui.tv.browser.GridFragment;
import org.videolan.vlc.gui.tv.browser.MusicFragment;
import org.videolan.vlc.util.BitmapUtil;
import android.content.Context;
import android.content.res.Resources;
......@@ -53,8 +54,8 @@ public class CardPresenter extends Presenter {
sContext = context;
mRes = sContext.getResources();
sDefaultCardImage = mRes.getDrawable(R.drawable.background_cone);
CARD_WIDTH = mRes.getDimensionPixelSize(R.dimen.tv_card_width);
CARD_HEIGHT = mRes.getDimensionPixelSize(R.dimen.tv_card_height);
CARD_WIDTH = mRes.getDimensionPixelSize(R.dimen.grid_card_thumb_width);
CARD_HEIGHT = mRes.getDimensionPixelSize(R.dimen.grid_card_thumb_height);
}
static class ViewHolder extends Presenter.ViewHolder {
......@@ -69,29 +70,21 @@ public class CardPresenter extends Presenter {
return mCardView;
}
protected void updateCardViewImage(MediaWrapper MediaWrapper) {
protected void updateCardViewImage(MediaWrapper mediaWrapper) {
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
Bitmap picture = null;
if (MediaWrapper.getType() == MediaWrapper.TYPE_AUDIO) {
picture = AudioUtil.getCover(sContext, MediaWrapper, 320);
if (picture == null) {
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
if (mediaWrapper.getType() == mediaWrapper.TYPE_AUDIO) {
picture = AudioUtil.getCover(sContext, mediaWrapper, 320);
if (picture == null)
picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_audio_big_normal);
} else
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.FIT_XY);
} else if (MediaWrapper.getType() == MediaWrapper.TYPE_VIDEO) {
picture = sMediaDatabase.getPicture(sContext, MediaWrapper.getLocation());
if (picture == null){
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
} else if (mediaWrapper.getType() == mediaWrapper.TYPE_VIDEO) {
picture = BitmapUtil.getPictureFromCache(mediaWrapper);
if (picture == null)
picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_video_big_normal);
} else
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.FIT_XY);
} else if (MediaWrapper.getType() == MediaWrapper.TYPE_DIR) {
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
} else if (mediaWrapper.getType() == mediaWrapper.TYPE_DIR)
picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_menu_network_big);
} else {
mCardView.getMainImageView().setScaleType(ImageView.ScaleType.CENTER);
else
picture = BitmapFactory.decodeResource(mRes, R.drawable.ic_browser_unknown_big_normal);
}
if (picture != null && picture.getByteCount() > 4)
mCardView.setMainImage(new BitmapDrawable(mRes, picture));
else
......
......@@ -45,8 +45,8 @@ public class StringPresenter extends Presenter {
if (res.getString(R.string.preferences).equals(item.toString())) {
tv.setBackground(res.getDrawable(R.drawable.ic_menu_preferences_big));
}
tv.setHeight(res.getDimensionPixelSize(R.dimen.tv_card_height));
tv.setWidth(res.getDimensionPixelSize(R.dimen.tv_card_width));
tv.setHeight(res.getDimensionPixelSize(R.dimen.grid_card_thumb_height));
tv.setWidth(res.getDimensionPixelSize(R.dimen.grid_card_thumb_width));
}
public void onUnbindViewHolder(ViewHolder viewHolder) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment