Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Fixes #3263 Provide an item id for the site permissions adapter #3286

Merged
merged 1 commit into from
Apr 29, 2020
Merged
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 @@ -53,7 +53,7 @@ public SitePermissionAdapter(Context aContext, PermissionSiteItemCallback callba
public void setSites(@NonNull List<SitePermission> sites) {
if (mDisplayList == null) {
mDisplayList = sites;
notifyItemRangeChanged(0, sites.size());
notifyDataSetChanged();

} else {
notifyDiff(sites);
Expand All @@ -78,7 +78,7 @@ public int getNewListSize() {

@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
return mDisplayList.get(oldItemPosition).url.equals(newDisplayList.get(newItemPosition).url);
return mDisplayList.get(oldItemPosition).id == newDisplayList.get(newItemPosition).id;
}

@Override
Expand Down Expand Up @@ -125,6 +125,11 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
siteHolder.binding.setItem(site);
}

@Override
public long getItemId(int position) {
return mDisplayList.get(position).id;
}

@Override
public int getItemCount() {
return mDisplayList == null ? 0 : mDisplayList.size();
Expand Down