Conditionally update navigation menu

This commit is contained in:
M66B 2018-12-31 06:53:07 +00:00
parent 37b124fe4c
commit 9ab964e659
1 changed files with 17 additions and 0 deletions

View File

@ -250,11 +250,28 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
getSupportFragmentManager().addOnBackStackChangedListener(this);
DB.getInstance(this).account().liveAccounts(true, threading).observe(this, new Observer<List<TupleAccountEx>>() {
private List<TupleAccountEx> last = new ArrayList<>();
@Override
public void onChanged(@Nullable List<TupleAccountEx> accounts) {
if (accounts == null)
accounts = new ArrayList<>();
boolean same = true;
if (accounts.size() == last.size()) {
for (int i = 0; i < accounts.size(); i++)
if (accounts.get(i).equals(last.get((i)))) {
same = false;
break;
}
} else
same = false;
if (same)
return;
else
last = accounts;
ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(ActivityView.this);
final Collator collator = Collator.getInstance(Locale.getDefault());