From 9d383b85d8c5581f12a1a22407ce4615c4d499f3 Mon Sep 17 00:00:00 2001 From: Alexander Bakker Date: Fri, 15 Nov 2024 17:21:17 +0100 Subject: [PATCH] Update sort category radio button state in the menu This has been broken since 46e1421c28857034c135f3c3facbe8b9b5c6483d. I also removed some other logic from ``onCreateOptionsMenu`` that doesn't seem to belong there anymore. --- .../com/beemdevelopment/aegis/ui/MainActivity.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/MainActivity.java b/app/src/main/java/com/beemdevelopment/aegis/ui/MainActivity.java index c3f3b0f9d..971020173 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/MainActivity.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/MainActivity.java @@ -694,8 +694,10 @@ private void importScannedEntries(List entries) { } private void updateSortCategoryMenu() { - SortCategory category = _prefs.getCurrentSortCategory(); - _menu.findItem(category.getMenuItem()).setChecked(true); + if (_menu != null) { + SortCategory category = _prefs.getCurrentSortCategory(); + _menu.findItem(category.getMenuItem()).setChecked(true); + } } private void onIntroResult() { @@ -908,6 +910,7 @@ protected void onStart() { handleIncomingIntent(); updateLockIcon(); + updateSortCategoryMenu(); doShortcutActions(); updateErrorCard(); } @@ -917,14 +920,7 @@ public boolean onCreateOptionsMenu(Menu menu) { _menu = menu; getMenuInflater().inflate(R.menu.menu_main, menu); - updateLockIcon(); - if (_loaded) { - setGroups(_vaultManager.getVault().getUsedGroups()); - updateSortCategoryMenu(); - } - MenuItem searchViewMenuItem = menu.findItem(R.id.mi_search); - _searchView = (SearchView) searchViewMenuItem.getActionView(); _searchView.setMaxWidth(Integer.MAX_VALUE); _searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> {