mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Updated navigation menu on changes only
This commit is contained in:
parent
957f2be75e
commit
aa72560d15
1 changed files with 16 additions and 0 deletions
|
@ -250,11 +250,27 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
||||||
|
|
||||||
DB.getInstance(this).account().liveAccounts(true, threading).observe(this, new Observer<List<TupleAccountEx>>() {
|
DB.getInstance(this).account().liveAccounts(true, threading).observe(this, new Observer<List<TupleAccountEx>>() {
|
||||||
|
private List<TupleAccountEx> last = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable List<TupleAccountEx> accounts) {
|
public void onChanged(@Nullable List<TupleAccountEx> accounts) {
|
||||||
if (accounts == null)
|
if (accounts == null)
|
||||||
accounts = new ArrayList<>();
|
accounts = new ArrayList<>();
|
||||||
|
|
||||||
|
boolean changed = false;
|
||||||
|
if (last.size() == accounts.size()) {
|
||||||
|
for (int i = 0; i < accounts.size(); i++)
|
||||||
|
if (!last.get(i).equals(accounts.get(i))) {
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
changed = true;
|
||||||
|
|
||||||
|
if (!changed)
|
||||||
|
return;
|
||||||
|
last = accounts;
|
||||||
|
|
||||||
ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(ActivityView.this);
|
ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(ActivityView.this);
|
||||||
|
|
||||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||||
|
|
Loading…
Reference in a new issue