Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,19 @@ public boolean isNotificationSelected(LbryNotification notification) {
return selectedItems.contains(notification);
}

public void insertNotification(LbryNotification notification, int index) {
if (!items.contains(notification)) {
items.add(index, notification);
}
notifyDataSetChanged();
}

public void addNotification(LbryNotification notification) {
if (!items.contains(notification)) {
items.add(notification);
}
notifyDataSetChanged();
}
public void removeNotifications(List<LbryNotification> notifications) {
for (LbryNotification notification : notifications) {
int itemPosition = getItems().indexOf(notification);
items.remove(notification);
notifyItemRemoved(itemPosition);
}
notifyDataSetChanged();
}

public void clearNotifications() {
// Using a for-each loop will throw an exception, so a simple for should be used
for (Iterator<LbryNotification> iterator = getItems().iterator(); iterator.hasNext();) {
LbryNotification notification = iterator.next();
iterator.remove();
}
int listSize = getItemCount();
getItems().clear();

notifyDataSetChanged();
notifyItemRangeRemoved(0, listSize);
}

public List<String> getAuthorUrls() {
Expand Down Expand Up @@ -293,7 +278,7 @@ private void toggleSelectedNotification(LbryNotification notification) {
}
}

notifyDataSetChanged();
notifyItemChanged(items.indexOf(notification));
}

public interface NotificationClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public PlaylistCollectionListAdapter(List<OdyseeCollection> collections, Context
}

public void clear() {
int itemsSize = items.size();
items.clear();
notifyDataSetChanged();
notifyItemRangeRemoved(0, itemsSize);
}

public List<OdyseeCollection> getItems() {
Expand All @@ -54,9 +55,9 @@ public void updateCollectionThumbnailUrls(Map<String, String> collectionIdThumbn
String collectionId = collection.getId();
if (collectionIdThumbnailUrlMap.containsKey(collectionId)) {
collection.setFirstItemThumbnailUrl(collectionIdThumbnailUrlMap.get(collectionId));
notifyItemChanged(i);
}
}
notifyDataSetChanged();
}

@Override
Expand Down