]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
remove the distinction between "readable" and "writable" database connections
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index bccdb972fe1e5d5f23fc43e6a435e286e5c3b99f..3e8e9c569747f42ae25df98af2bf546b3793882a 100644 (file)
@@ -166,6 +166,12 @@ public class MainActivity extends ProfileThemedActivity {
                 }
             });
         });
+        Data.profiles.addObserver((o, arg) -> {
+            findViewById(R.id.nav_profile_list).setMinimumHeight(
+                    (int) (getResources().getDimension(R.dimen.thumb_row_height) *
+                           Data.profiles.size()));
+            mProfileListAdapter.notifyDataSetChanged();
+        });
 
         ActionBarDrawerToggle toggle =
                 new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open,
@@ -571,7 +577,7 @@ public class MainActivity extends ProfileThemedActivity {
                 ViewPropertyAnimator animator = arrow.animate();
 
                 acc.toggleExpanded();
-                Data.profile.get().storeAccount(MLDB.getWritableDatabase(), acc);
+                Data.profile.get().storeAccount(MLDB.getDatabase(), acc);
 
                 if (wasExpanded) {
                     Log.d("accounts", String.format("Collapsing account '%s'", acc.getName()));