mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 12:38:00 +01:00
add directory thumbnails
This commit is contained in:
parent
c2762ab014
commit
90d5d99c08
4 changed files with 13 additions and 4 deletions
|
@ -23,4 +23,5 @@ dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||||
|
compile 'com.github.bumptech.glide:glide:3.7.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,20 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DirectoryAdapter extends BaseAdapter {
|
public class DirectoryAdapter extends BaseAdapter {
|
||||||
|
private final Context context;
|
||||||
private final List<Directory> dirs;
|
private final List<Directory> dirs;
|
||||||
private final LayoutInflater inflater;
|
private final LayoutInflater inflater;
|
||||||
|
|
||||||
public DirectoryAdapter(Context context, List<Directory> dirs) {
|
public DirectoryAdapter(Context context, List<Directory> dirs) {
|
||||||
|
this.context = context;
|
||||||
this.dirs = dirs;
|
this.dirs = dirs;
|
||||||
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +37,7 @@ public class DirectoryAdapter extends BaseAdapter {
|
||||||
Directory dir = dirs.get(position);
|
Directory dir = dirs.get(position);
|
||||||
holder.dirName.setText(dir.getName());
|
holder.dirName.setText(dir.getName());
|
||||||
holder.photoCnt.setText(String.valueOf(dir.getPhotoCnt()));
|
holder.photoCnt.setText(String.valueOf(dir.getPhotoCnt()));
|
||||||
|
Glide.with(context).load(dir.getThumbnail()).centerCrop().crossFade().into(holder.dirThumbnail);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -54,10 +60,12 @@ public class DirectoryAdapter extends BaseAdapter {
|
||||||
static class ViewHolder {
|
static class ViewHolder {
|
||||||
TextView dirName;
|
TextView dirName;
|
||||||
TextView photoCnt;
|
TextView photoCnt;
|
||||||
|
ImageView dirThumbnail;
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
public ViewHolder(View view) {
|
||||||
dirName = (TextView) view.findViewById(R.id.dir_name);
|
dirName = (TextView) view.findViewById(R.id.dir_name);
|
||||||
photoCnt = (TextView) view.findViewById(R.id.photo_cnt);
|
photoCnt = (TextView) view.findViewById(R.id.photo_cnt);
|
||||||
|
dirThumbnail = (ImageView) view.findViewById(R.id.dir_thumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@android:color/black"
|
android:background="@android:color/black"
|
||||||
android:columnWidth="@dimen/photo_size"
|
android:columnWidth="@dimen/photo_size"
|
||||||
android:horizontalSpacing="1dp"
|
android:horizontalSpacing="2dp"
|
||||||
android:numColumns="auto_fit"
|
android:numColumns="auto_fit"
|
||||||
android:stretchMode="columnWidth"
|
android:stretchMode="columnWidth"
|
||||||
android:verticalSpacing="1dp"/>
|
android:verticalSpacing="2dp"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<gallery.simplemobiletools.com.MyImageView
|
<gallery.simplemobiletools.com.MyImageView
|
||||||
android:id="@+id/photo"
|
android:id="@+id/dir_thumbnail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/white"/>
|
android:background="@android:color/white"/>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="#44444444"
|
android:background="#55000000"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
|
|
Loading…
Reference in a new issue