实现效果,图片列表的图片按照日期进行分组
方法:
1.图片列表的entity
2.分组的entity extends SectionEntity<图片列表的entity>
如:由于是按日期分组,所以间隔图片用的是时间段
public class PhotoSectionEntity extends SectionEntity<PhotoEntity> {
public final long startTime;
public final long endTime;
public PhotoSectionEntity(String header, long startTime, long endTime) {
super(true, header);
this.startTime = startTime;
this.endTime = endTime;
}
public PhotoSectionEntity(PhotoEntity entity) {
super(entity);
startTime = 0;
endTime = 0;
}
}
3.适配器 extends BaseSectionQuickAdapter<PhotoSectionEntity, BaseViewHolder>
构造里有两个条目:一个是图片的,一个是标题的
public PhotoAdapter2(PhotoSelector selector) {
super(R.layout.item_photo, R.layout.item_photo_header, null);
mPhotoSelector = selector;
}