mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 10:17:18 +00:00
Small optimization
This commit is contained in:
parent
9b85d88447
commit
2f62075e10
2 changed files with 9 additions and 1 deletions
|
@ -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…
Reference in a new issue