Fix media profiles
This commit is contained in:
parent
a96299ab70
commit
866920933e
|
@ -162,19 +162,22 @@ public class FragmentMediaProfile extends Fragment {
|
||||||
flagLoading = fetched_statuses.pagination.max_id == null;
|
flagLoading = fetched_statuses.pagination.max_id == null;
|
||||||
binding.noAction.setVisibility(View.GONE);
|
binding.noAction.setVisibility(View.GONE);
|
||||||
//We have to split media in different statuses
|
//We have to split media in different statuses
|
||||||
List<Status> mediaStatusesNew = new ArrayList<>();
|
|
||||||
|
int added = 0;
|
||||||
for (Status status : fetched_statuses.statuses) {
|
for (Status status : fetched_statuses.statuses) {
|
||||||
if (status.media_attachments.size() > 1) {
|
|
||||||
for (Attachment attachment : status.media_attachments) {
|
for (Attachment attachment : status.media_attachments) {
|
||||||
status.media_attachments = new ArrayList<>();
|
try {
|
||||||
status.media_attachments.add(0, attachment);
|
Status statusTmp = (Status) status.clone();
|
||||||
mediaStatusesNew.add(status);
|
statusTmp.art_attachment = attachment;
|
||||||
|
mediaStatuses.add(statusTmp);
|
||||||
|
added++;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int position = this.mediaStatuses.size();
|
|
||||||
this.mediaStatuses.addAll(mediaStatusesNew);
|
imageAdapter.notifyItemRangeInserted(this.mediaStatuses.size() - added, this.mediaStatuses.size());
|
||||||
imageAdapter.notifyItemRangeChanged(position, mediaStatusesNew.size());
|
|
||||||
if (fetched_statuses.pagination.max_id == null) {
|
if (fetched_statuses.pagination.max_id == null) {
|
||||||
flagLoading = true;
|
flagLoading = true;
|
||||||
} else if (max_id == null || fetched_statuses.pagination.max_id.compareTo(max_id) < 0) {
|
} else if (max_id == null || fetched_statuses.pagination.max_id.compareTo(max_id) < 0) {
|
||||||
|
|
Loading…
Reference in New Issue