@@ -187,7 +187,8 @@ public <T extends BaseMutableData> void addData(T data) {
187
187
return ;
188
188
}
189
189
mDatas .add (data );
190
- doNotifyUI ();
190
+ mDifferHelper .updateInnerList (mDatas );
191
+ notifyItemChanged (mDatas .size ()-1 );
191
192
}
192
193
193
194
@@ -200,7 +201,8 @@ public <T extends BaseMutableData> void addData(List<T> datas) {
200
201
return ;
201
202
}
202
203
mDatas .addAll (datas );
203
- doNotifyUI ();
204
+ mDifferHelper .updateInnerList (mDatas );
205
+ notifyItemChanged (mDatas .size () - datas .size (),datas .size ());
204
206
}
205
207
206
208
@@ -229,7 +231,6 @@ public void updateData(BaseMutableData newData) {
229
231
230
232
}
231
233
}
232
- doNotifyUI ();
233
234
234
235
}
235
236
@@ -239,14 +240,17 @@ public void deleteData(BaseMutableData data) {
239
240
}
240
241
Iterator <BaseMutableData > iterator = mDatas .iterator ();
241
242
243
+ int position = -1 ;
242
244
while (iterator .hasNext ()) {
245
+ position ++;
243
246
244
247
if (data .uniqueItemFeature ().equals (iterator .next ().uniqueItemFeature ())) {
245
248
iterator .remove ();
249
+ mDifferHelper .updateInnerList (mDatas );
250
+ notifyItemRemoved (position );
246
251
break ;
247
252
}
248
253
}
249
- doNotifyUI ();
250
254
251
255
}
252
256
@@ -303,7 +307,7 @@ public void onBindViewHolder(@NonNull BaseDiffViewHolder baseDiffViewHolder, int
303
307
try {
304
308
baseDiffViewHolder .updateItem (mDifferHelper .getCurrentList ().get (position ), position );
305
309
}catch (Exception e ) {
306
- Log .e (TAG ,"onBindViewHolder updateItem error" ,e );
310
+ Log .e (TAG ,"onBindViewHolder updatePartWithPayload error" ,e );
307
311
}
308
312
}
309
313
@@ -323,9 +327,9 @@ public void onBindViewHolder(@NonNull BaseDiffViewHolder holder, int position, @
323
327
this .onBindViewHolder (holder ,position );
324
328
}else {
325
329
try {
326
- holder .updateItem ( mDifferHelper . getCurrentList (). get ( position ), position ,(Bundle ) payloads .get (0 ));
330
+ holder .updatePartWithPayload ( position ,(Bundle ) payloads .get (0 ));
327
331
}catch (Exception e ) {
328
- Log .e (TAG ,"onBindViewHolder updateItem payload error" ,e );
332
+ Log .e (TAG ,"onBindViewHolder updatePartWithPayload payload error" ,e );
329
333
}
330
334
}
331
335
0 commit comments