Display photo attachments as a grid
This commit is contained in:
@@ -22,12 +22,15 @@ public class PhotoStatusDisplayItem extends StatusDisplayItem{
|
||||
private ImageLoaderRequest request;
|
||||
private Fragment parentFragment;
|
||||
private Status status;
|
||||
public PhotoStatusDisplayItem(String parentID, Status status, Attachment photo, Fragment parentFragment){
|
||||
public final int index, totalPhotos;
|
||||
public PhotoStatusDisplayItem(String parentID, Status status, Attachment photo, Fragment parentFragment, int index, int totalPhotos){
|
||||
super(parentID);
|
||||
this.status=status;
|
||||
this.attachment=photo;
|
||||
request=new UrlImageLoaderRequest(photo.url, 1000, 1000);
|
||||
this.parentFragment=parentFragment;
|
||||
this.index=index;
|
||||
this.totalPhotos=totalPhotos;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,9 +54,17 @@ public abstract class StatusDisplayItem{
|
||||
items.add(new HeaderStatusDisplayItem(parentID, statusForContent.account, statusForContent.createdAt, fragment, accountID));
|
||||
if(!TextUtils.isEmpty(statusForContent.content))
|
||||
items.add(new TextStatusDisplayItem(parentID, HtmlParser.parse(statusForContent.content, statusForContent.emojis), fragment));
|
||||
int photoIndex=0;
|
||||
int totalPhotos=0;
|
||||
for(Attachment attachment:statusForContent.mediaAttachments){
|
||||
if(attachment.type==Attachment.Type.IMAGE){
|
||||
items.add(new PhotoStatusDisplayItem(parentID, status, attachment, fragment));
|
||||
totalPhotos++;
|
||||
}
|
||||
}
|
||||
for(Attachment attachment:statusForContent.mediaAttachments){
|
||||
if(attachment.type==Attachment.Type.IMAGE){
|
||||
items.add(new PhotoStatusDisplayItem(parentID, status, attachment, fragment, photoIndex, totalPhotos));
|
||||
photoIndex++;
|
||||
}
|
||||
}
|
||||
items.add(new FooterStatusDisplayItem(parentID, status, accountID));
|
||||
|
||||
Reference in New Issue
Block a user