Fix issue #641 - Conversation only shows one media when they are several ones.
This commit is contained in:
parent
5937c48d55
commit
c03489b0da
|
@ -1099,7 +1099,6 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return APIResponse
|
||||
*/
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private APIResponse getArtTimeline(boolean local, String tag, String max_id){
|
||||
if( tag == null)
|
||||
tag = "mastoart";
|
||||
|
@ -1112,19 +1111,13 @@ public class API {
|
|||
if( apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0){
|
||||
for( Status status: apiResponse.getStatuses()){
|
||||
if( status.getMedia_attachments() != null ) {
|
||||
if (status.getMedia_attachments().size() > 1) {
|
||||
String statusSerialized = Helper.statusToStringStorage(status);
|
||||
for (Attachment attachment : status.getMedia_attachments()) {
|
||||
ArrayList<Attachment> attachments = new ArrayList<>();
|
||||
attachments.add(attachment);
|
||||
Status newStatus = Helper.restoreStatusFromString(statusSerialized);
|
||||
if (newStatus == null)
|
||||
break;
|
||||
newStatus.setMedia_attachments(attachments);
|
||||
apiResponseReply.getStatuses().add(newStatus);
|
||||
}
|
||||
} else if (status.getMedia_attachments().size() == 1) {
|
||||
apiResponseReply.getStatuses().add(status);
|
||||
String statusSerialized = Helper.statusToStringStorage(status);
|
||||
for (Attachment attachment : status.getMedia_attachments()) {
|
||||
Status newStatus = Helper.restoreStatusFromString(statusSerialized);
|
||||
if (newStatus == null)
|
||||
break;
|
||||
newStatus.setArt_attachment(attachment);
|
||||
apiResponseReply.getStatuses().add(newStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public class Status implements Parcelable{
|
|||
private boolean attachmentShown = false;
|
||||
private boolean spoilerShown = false;
|
||||
private ArrayList<Attachment> media_attachments;
|
||||
private Attachment art_attachment;
|
||||
private List<Mention> mentions;
|
||||
private List<Emojis> emojis;
|
||||
private List<Tag> tags;
|
||||
|
@ -1190,4 +1191,12 @@ public class Status implements Parcelable{
|
|||
public void setFavAnimated(boolean favAnimated) {
|
||||
isFavAnimated = favAnimated;
|
||||
}
|
||||
|
||||
public Attachment getArt_attachment() {
|
||||
return art_attachment;
|
||||
}
|
||||
|
||||
public void setArt_attachment(Attachment art_attachment) {
|
||||
this.art_attachment = art_attachment;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -462,10 +462,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
Status.transform(context, status);
|
||||
if( !status.isEmojiFound())
|
||||
Status.makeEmojis(context, this, status);
|
||||
|
||||
Glide.with(context)
|
||||
.load(status.getMedia_attachments().get(0).getPreview_url())
|
||||
.into(holder.art_media);
|
||||
if( status.getArt_attachment() != null)
|
||||
Glide.with(context)
|
||||
.load(status.getArt_attachment().getPreview_url())
|
||||
.into(holder.art_media);
|
||||
if( status.getAccount() != null && status.getAccount().getAvatar() != null)
|
||||
Glide.with(context)
|
||||
.load(status.getAccount().getAvatar())
|
||||
|
|
Loading…
Reference in New Issue