]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
properly detect when profile list hasn't loaded yet
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index e7e534fedefc3c7c11d287442975440f64376339..484bcb018f3faef03af558a8bf8ac75703e5d679 100644 (file)
@@ -342,6 +342,14 @@ public class MainActivity extends ProfileThemedActivity {
         sm.setDynamicShortcuts(shortcuts);
     }
     private void onProfileListChanged(List<MobileLedgerProfile> newList) {
+        if (newList == null) {
+            // profiles not yet loaded from DB
+            findViewById(R.id.loading_layout).setVisibility(View.VISIBLE);
+            findViewById(R.id.no_profiles_layout).setVisibility(View.GONE);
+            findViewById(R.id.pager_layout).setVisibility(View.GONE);
+            return;
+        }
+
         if (newList.isEmpty()) {
             findViewById(R.id.no_profiles_layout).setVisibility(View.VISIBLE);
             findViewById(R.id.pager_layout).setVisibility(View.GONE);