diff --git a/app/src/main/java/com/simplemobiletools/gallery/adapters/MediaAdapter.java b/app/src/main/java/com/simplemobiletools/gallery/adapters/MediaAdapter.java index 0dfa05b1e..571d16117 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/adapters/MediaAdapter.java +++ b/app/src/main/java/com/simplemobiletools/gallery/adapters/MediaAdapter.java @@ -8,11 +8,14 @@ import android.widget.BaseAdapter; import android.widget.ImageView; import com.bumptech.glide.Glide; -import com.simplemobiletools.gallery.models.Medium; import com.simplemobiletools.gallery.R; +import com.simplemobiletools.gallery.models.Medium; import java.util.List; +import butterknife.BindView; +import butterknife.ButterKnife; + public class MediaAdapter extends BaseAdapter { private final Context context; private final List media; @@ -29,17 +32,19 @@ public class MediaAdapter extends BaseAdapter { final Medium medium = media.get(position); ViewHolder holder; if (view == null) { - int layout = R.layout.photo_item; - if (medium.getIsVideo()) { - layout = R.layout.video_item; - } - view = inflater.inflate(layout, parent, false); + view = inflater.inflate(R.layout.video_item, parent, false); holder = new ViewHolder(view); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } + if (medium.getIsVideo()) { + holder.playOutline.setVisibility(View.VISIBLE); + } else { + holder.playOutline.setVisibility(View.GONE); + } + final String path = medium.getPath(); Glide.with(context).load(path).placeholder(R.color.tmb_background).centerCrop().crossFade().into(holder.photoThumbnail); @@ -68,10 +73,11 @@ public class MediaAdapter extends BaseAdapter { } static class ViewHolder { - ImageView photoThumbnail; + @BindView(R.id.medium_thumbnail) ImageView photoThumbnail; + @BindView(R.id.play_outline) ImageView playOutline; public ViewHolder(View view) { - photoThumbnail = (ImageView) view.findViewById(R.id.medium_thumbnail); + ButterKnife.bind(this, view); } } } diff --git a/app/src/main/res/layout/photo_item.xml b/app/src/main/res/layout/photo_item.xml deleted file mode 100644 index d18d298a4..000000000 --- a/app/src/main/res/layout/photo_item.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/app/src/main/res/layout/video_item.xml b/app/src/main/res/layout/video_item.xml index 5b01d90d0..dbbd17e70 100644 --- a/app/src/main/res/layout/video_item.xml +++ b/app/src/main/res/layout/video_item.xml @@ -1,6 +1,6 @@ + android:src="@mipmap/play_outline" + android:visibility="gone"/>