Small optimization

pull/194/merge
M66B 3 years ago
parent 9b85d88447
commit 2f62075e10

@ -874,7 +874,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
public void onChanged(TupleOperationStats stats) {
navOperations.setWarning(stats != null && stats.errors != null && stats.errors > 0);
navOperations.setCount(stats == null ? 0 : stats.pending);
adapterNavMenu.notifyDataSetChanged();
int pos = adapterNavMenu.getPosition(navOperations);
if (pos < 0)
adapterNavMenu.notifyDataSetChanged();
else
adapterNavMenu.notifyItemChanged(pos);
}
});

@ -194,6 +194,10 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
return items.get(pos);
}
int getPosition(NavMenuItem item) {
return items.indexOf(item);
}
private static class DiffCallback extends DiffUtil.Callback {
private List<NavMenuItem> prev = new ArrayList<>();
private List<NavMenuItem> next = new ArrayList<>();

Loading…
Cancel
Save