mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-25 14:08:00 +01:00
add a play outline on videos
This commit is contained in:
parent
728afc915c
commit
b676bc7ca4
9 changed files with 31 additions and 2 deletions
|
@ -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;
|
||||||
|
|
|
@ -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"
|
22
app/src/main/res/layout/video_item.xml
Normal file
22
app/src/main/res/layout/video_item.xml
Normal 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>
|
BIN
app/src/main/res/mipmap-hdpi/play_outline.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/play_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,023 B |
BIN
app/src/main/res/mipmap-mdpi/play_outline.png
Normal file
BIN
app/src/main/res/mipmap-mdpi/play_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 699 B |
BIN
app/src/main/res/mipmap-xhdpi/play_outline.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/play_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/play_outline.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/play_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/play_outline.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/play_outline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue