mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Avoid empty timelines
This commit is contained in:
parent
0854642d81
commit
8613f57c87
3 changed files with 26 additions and 0 deletions
|
@ -39,6 +39,7 @@ import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Conversation;
|
import app.fedilab.android.client.entities.api.Conversation;
|
||||||
import app.fedilab.android.client.entities.api.Conversations;
|
import app.fedilab.android.client.entities.api.Conversations;
|
||||||
|
import app.fedilab.android.client.entities.api.Pagination;
|
||||||
import app.fedilab.android.client.entities.app.StatusCache;
|
import app.fedilab.android.client.entities.app.StatusCache;
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
import app.fedilab.android.client.entities.app.Timeline;
|
||||||
import app.fedilab.android.databinding.FragmentPaginationBinding;
|
import app.fedilab.android.databinding.FragmentPaginationBinding;
|
||||||
|
@ -89,6 +90,14 @@ public class FragmentMastodonConversation extends Fragment implements Conversati
|
||||||
isViewInitialized = true;
|
isViewInitialized = true;
|
||||||
if (initialConversations != null && initialConversations.conversations != null && initialConversations.conversations.size() > 0) {
|
if (initialConversations != null && initialConversations.conversations != null && initialConversations.conversations.size() > 0) {
|
||||||
initializeConversationCommonView(initialConversations);
|
initializeConversationCommonView(initialConversations);
|
||||||
|
} else {
|
||||||
|
Conversations conversations = new Conversations();
|
||||||
|
if (conversationList != null && conversationList.size() > 0) {
|
||||||
|
conversations.pagination = new Pagination();
|
||||||
|
conversations.pagination.max_id = conversationList.get(conversationList.size() - 1).id;
|
||||||
|
conversations.pagination.min_id = conversationList.get(0).id;
|
||||||
|
}
|
||||||
|
initializeConversationCommonView(conversations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.client.entities.api.Notification;
|
import app.fedilab.android.client.entities.api.Notification;
|
||||||
import app.fedilab.android.client.entities.api.Notifications;
|
import app.fedilab.android.client.entities.api.Notifications;
|
||||||
|
import app.fedilab.android.client.entities.api.Pagination;
|
||||||
import app.fedilab.android.client.entities.api.Status;
|
import app.fedilab.android.client.entities.api.Status;
|
||||||
import app.fedilab.android.client.entities.app.StatusCache;
|
import app.fedilab.android.client.entities.app.StatusCache;
|
||||||
import app.fedilab.android.client.entities.app.Timeline;
|
import app.fedilab.android.client.entities.app.Timeline;
|
||||||
|
@ -299,6 +300,14 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
isViewInitialized = true;
|
isViewInitialized = true;
|
||||||
if (initialNotifications != null && initialNotifications.notifications != null && initialNotifications.notifications.size() > 0) {
|
if (initialNotifications != null && initialNotifications.notifications != null && initialNotifications.notifications.size() > 0) {
|
||||||
initializeNotificationView(initialNotifications);
|
initializeNotificationView(initialNotifications);
|
||||||
|
} else {
|
||||||
|
Notifications notifications = new Notifications();
|
||||||
|
if (notificationList != null && notificationList.size() > 0) {
|
||||||
|
notifications.pagination = new Pagination();
|
||||||
|
notifications.pagination.max_id = notificationList.get(notificationList.size() - 1).id;
|
||||||
|
notifications.pagination.min_id = notificationList.get(0).id;
|
||||||
|
}
|
||||||
|
initializeNotificationView(notifications);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,14 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
isViewInitialized = true;
|
isViewInitialized = true;
|
||||||
if (initialStatuses != null && initialStatuses.statuses != null && initialStatuses.statuses.size() > 0) {
|
if (initialStatuses != null && initialStatuses.statuses != null && initialStatuses.statuses.size() > 0) {
|
||||||
initializeStatusesCommonView(initialStatuses);
|
initializeStatusesCommonView(initialStatuses);
|
||||||
|
} else {
|
||||||
|
Statuses statuses = new Statuses();
|
||||||
|
if (timelineStatuses != null && timelineStatuses.size() > 0) {
|
||||||
|
statuses.pagination = new Pagination();
|
||||||
|
statuses.pagination.max_id = timelineStatuses.get(timelineStatuses.size() - 1).id;
|
||||||
|
statuses.pagination.min_id = timelineStatuses.get(0).id;
|
||||||
|
}
|
||||||
|
initializeStatusesCommonView(statuses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (timelineStatuses != null && timelineStatuses.size() > 0) {
|
if (timelineStatuses != null && timelineStatuses.size() > 0) {
|
||||||
|
|
Loading…
Reference in a new issue