Closed chenfgit closed 6 years ago
public void addAll(List list, boolean notifyDataChange) { if (list == null || list.isEmpty()) { return; } mItemList.addAll(list); //(1) if(notifyDataChange) { try { notifyItemRangeInserted(mHeaderSize + getBasicItemCount(), list.size());//(2) } catch (Exception e) { Log.w(TAG, "notifyItemRangeInserted failure"); e.printStackTrace(); notifyDataSetChanged(); } notifyDataSetChanged(); } }
in addAll method, after notifyItemRangeInserted method ,call notifyDataSetChanged is redundant.
public void addAll(List list, boolean notifyDataChange) {
if (list == null || list.isEmpty()) {
return;
}
mItemList.addAll(list); //(1)
if(notifyDataChange) {
try {
notifyItemRangeInserted(mHeaderSize + getBasicItemCount(), list.size());//(2)
} catch (Exception e) {
Log.w(TAG, "notifyItemRangeInserted failure");
e.printStackTrace();
notifyDataSetChanged();
}
notifyDataSetChanged();
}
}
in addAll method, after notifyItemRangeInserted method ,call notifyDataSetChanged is redundant.