]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
async database statement queue
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index bccdb972fe1e5d5f23fc43e6a435e286e5c3b99f..cfceb7ca7f1786d9a9470dd6c0934dbaf5e9b8c6 100644 (file)
@@ -38,6 +38,7 @@ import android.widget.Toast;
 import com.google.android.material.floatingactionbutton.FloatingActionButton;
 
 import net.ktnx.mobileledger.R;
+import net.ktnx.mobileledger.async.DbOpQueue;
 import net.ktnx.mobileledger.async.RefreshDescriptionsTask;
 import net.ktnx.mobileledger.async.RetrieveTransactionsTask;
 import net.ktnx.mobileledger.model.Data;
@@ -166,6 +167,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 +578,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()));