Closed mohammedGrech closed 1 year ago
To resolve this bug, I have changed the logo to a generic one and every time the user does deleting / filtering, these items do not conflict and anymore:
default: Glide.with(this.context).load(R.drawable.account_24).into(holder.recordLogo); holder.textLogo.setVisibility(View.GONE); break;
To resolve the issue of the shifting items correctly, I have taken the below approach:
//If the database has items if(websiteModels.size()!=0){ //remove database at this position websiteModels.remove(position); // inform the recycle view with the changes notifyItemRemoved(position); // inform the recycle view with the changes based on the range of data notifyItemRangeChanged(position,websiteModels.size()); }
As expected, when an item is being deleted, the rest of the items get updated and shift one position upwards/downwards. However, occasionally the recycling view does not update the list correctly. i.e. If Netflix is deleted from the database, Facebook from the list gets removed. Then once the screen is refreshed, we would only see Netflix deleted as per the initial approach. The issue continues with those items that have the first letter and last letter of the name. These item logos for some reason gets changed by other logos in the list, i.e. Facebook, Netflix, etc... When the home screen is being refreshed, these logos gets updated correctly.