use singletonList in getChangePayload (#1486)

This commit is contained in:
Konrad Pozniak 2019-09-17 18:44:33 +02:00 committed by GitHub
parent d6c1893255
commit de4473b2b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View file

@ -83,6 +83,7 @@ import com.keylesspalace.tusky.viewdata.StatusViewData;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -1168,9 +1169,7 @@ public class NotificationsFragment extends SFragment implements
public Object getChangePayload(@NonNull NotificationViewData oldItem, @NonNull NotificationViewData newItem) { public Object getChangePayload(@NonNull NotificationViewData oldItem, @NonNull NotificationViewData newItem) {
if (oldItem.deepEquals(newItem)) { if (oldItem.deepEquals(newItem)) {
//If items are equal - update timestamp only //If items are equal - update timestamp only
List<String> payload = new ArrayList<>(); return Collections.singletonList(StatusBaseViewHolder.Key.KEY_CREATED);
payload.add(StatusBaseViewHolder.Key.KEY_CREATED);
return payload;
} else } else
// If items are different - update a whole view holder // If items are different - update a whole view holder
return null; return null;

View file

@ -1357,9 +1357,7 @@ public class TimelineFragment extends SFragment implements
public Object getChangePayload(@NonNull StatusViewData oldItem, @NonNull StatusViewData newItem) { public Object getChangePayload(@NonNull StatusViewData oldItem, @NonNull StatusViewData newItem) {
if (oldItem.deepEquals(newItem)) { if (oldItem.deepEquals(newItem)) {
//If items are equal - update timestamp only //If items are equal - update timestamp only
List<String> payload = new ArrayList<>(); return Collections.singletonList(StatusBaseViewHolder.Key.KEY_CREATED);
payload.add(StatusBaseViewHolder.Key.KEY_CREATED);
return payload;
} else } else
// If items are different - update a whole view holder // If items are different - update a whole view holder
return null; return null;