]> git.ktnx.net Git - mobile-ledger.git/commitdiff
MainActivity: always refresh shortcuts, even if the list is empty
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 22 Aug 2021 16:52:09 +0000 (19:52 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 22 Aug 2021 16:52:09 +0000 (19:52 +0300)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index de91ca779f13177acf1148286472333b389c12df..e686d96fdb37233dd2a0ffcd372b6ebdf359ba96 100644 (file)
@@ -345,7 +345,7 @@ public class MainActivity extends ProfileThemedActivity implements FabManager.Fa
             mainModel.scheduleTransactionListRetrieval();
         }
     }
-    private void createShortcuts(List<Profile> list) {
+    private void createShortcuts(@NotNull List<Profile> list) {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1)
             return;
 
@@ -377,8 +377,10 @@ public class MainActivity extends ProfileThemedActivity implements FabManager.Fa
         }
         sm.setDynamicShortcuts(shortcuts);
     }
-    private void onProfileListChanged(List<Profile> newList) {
-        if ((newList == null) || newList.isEmpty()) {
+    private void onProfileListChanged(@NotNull List<Profile> newList) {
+        createShortcuts(newList);
+
+        if (newList.isEmpty()) {
             b.noProfilesLayout.setVisibility(View.VISIBLE);
             b.mainAppLayout.setVisibility(View.GONE);
             return;
@@ -393,8 +395,6 @@ public class MainActivity extends ProfileThemedActivity implements FabManager.Fa
         Logger.debug("profiles", "profile list changed");
         mProfileListAdapter.setProfileList(newList);
 
-        createShortcuts(newList);
-
         final Profile currentProfile = Data.getProfile();
         Profile replacementProfile = null;
         if (currentProfile != null) {