Re-does commit 5754a3a177
because those changes were stomped by merging in commit fc1a24be11
.
This commit is contained in:
parent
cf90be5225
commit
a23cca7047
2 changed files with 8 additions and 8 deletions
|
@ -40,7 +40,6 @@ import com.keylesspalace.tusky.adapter.NotificationsAdapter;
|
|||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.entity.Notification;
|
||||
import com.keylesspalace.tusky.entity.Status;
|
||||
import com.keylesspalace.tusky.interfaces.AdapterItemRemover;
|
||||
import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
||||
import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
||||
import com.keylesspalace.tusky.util.HttpHeaderLink;
|
||||
|
@ -51,8 +50,8 @@ import com.keylesspalace.tusky.view.EndlessOnScrollListener;
|
|||
import com.keylesspalace.tusky.viewdata.NotificationViewData;
|
||||
import com.keylesspalace.tusky.viewdata.StatusViewData;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
|
@ -440,8 +439,8 @@ public class NotificationsFragment extends SFragment implements
|
|||
topId = uptoId;
|
||||
}
|
||||
if (notifications.isEmpty()) {
|
||||
// This construction removes duplicates.
|
||||
notifications.addAll(new HashSet<>(newNotifications));
|
||||
// This construction removes duplicates while preserving order.
|
||||
notifications.addAll(new LinkedHashSet<>(newNotifications));
|
||||
} else {
|
||||
int index = notifications.indexOf(newNotifications.get(newNotifications.size() - 1));
|
||||
for (int i = 0; i < index; i++) {
|
||||
|
|
|
@ -43,14 +43,15 @@ import com.keylesspalace.tusky.interfaces.StatusActionListener;
|
|||
import com.keylesspalace.tusky.network.MastodonApi;
|
||||
import com.keylesspalace.tusky.receiver.TimelineReceiver;
|
||||
import com.keylesspalace.tusky.util.HttpHeaderLink;
|
||||
import com.keylesspalace.tusky.util.ListUtils;
|
||||
import com.keylesspalace.tusky.util.PairedList;
|
||||
import com.keylesspalace.tusky.util.ThemeUtils;
|
||||
import com.keylesspalace.tusky.util.ViewDataUtils;
|
||||
import com.keylesspalace.tusky.view.EndlessOnScrollListener;
|
||||
import com.keylesspalace.tusky.viewdata.StatusViewData;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -589,7 +590,7 @@ public class TimelineFragment extends SFragment implements
|
|||
|
||||
private void updateStatuses(List<Status> newStatuses, @Nullable String fromId,
|
||||
@Nullable String toId) {
|
||||
if (newStatuses == null || newStatuses.isEmpty()) {
|
||||
if (ListUtils.isEmpty(newStatuses)) {
|
||||
return;
|
||||
}
|
||||
if (fromId != null) {
|
||||
|
@ -599,8 +600,8 @@ public class TimelineFragment extends SFragment implements
|
|||
upToId = toId;
|
||||
}
|
||||
if (statuses.isEmpty()) {
|
||||
// This construction removes duplicates.
|
||||
statuses.addAll(new HashSet<>(newStatuses));
|
||||
// This construction removes duplicates while preserving order.
|
||||
statuses.addAll(new LinkedHashSet<>(newStatuses));
|
||||
} else {
|
||||
Status lastOfNew = newStatuses.get(newStatuses.size() - 1);
|
||||
int index = statuses.indexOf(lastOfNew);
|
||||
|
|
Loading…
Reference in a new issue