add a play outline on videos

This commit is contained in:
tibbi 2016-06-05 23:49:57 +02:00
parent 728afc915c
commit b676bc7ca4
9 changed files with 31 additions and 2 deletions

View file

@ -26,16 +26,21 @@ public class MediaAdapter extends BaseAdapter {
@Override @Override
public View getView(int position, View view, ViewGroup parent) { public View getView(int position, View view, ViewGroup parent) {
final Media medium = media.get(position);
ViewHolder holder; ViewHolder holder;
if (view == null) { if (view == null) {
view = inflater.inflate(R.layout.medium_item, parent, false); int layout = R.layout.photo_item;
if (medium.getIsVideo()) {
layout = R.layout.video_item;
}
view = inflater.inflate(layout, parent, false);
holder = new ViewHolder(view); holder = new ViewHolder(view);
view.setTag(holder); view.setTag(holder);
} else { } else {
holder = (ViewHolder) view.getTag(); holder = (ViewHolder) view.getTag();
} }
final String path = media.get(position).getPath(); final String path = medium.getPath();
Glide.with(context).load(path).placeholder(R.color.tmb_background).centerCrop().crossFade().into(holder.photoThumbnail); Glide.with(context).load(path).placeholder(R.color.tmb_background).centerCrop().crossFade().into(holder.photoThumbnail);
return view; return view;

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout <FrameLayout
android:id="@+id/photo_item_holder"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/video_item_holder"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/selector">
<com.simplemobiletools.gallery.MyImageView
android:id="@+id/medium_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/play_outline"
android:layout_width="@dimen/play_outline_size"
android:layout_height="@dimen/play_outline_size"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@mipmap/play_outline"/>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -2,5 +2,6 @@
<dimen name="activity_margin">16dp</dimen> <dimen name="activity_margin">16dp</dimen>
<dimen name="dir_tmb_size">150dp</dimen> <dimen name="dir_tmb_size">150dp</dimen>
<dimen name="medium_tmb_size">100dp</dimen> <dimen name="medium_tmb_size">100dp</dimen>
<dimen name="play_outline_size">40dp</dimen>
<dimen name="undo_padding">8dp</dimen> <dimen name="undo_padding">8dp</dimen>
</resources> </resources>