]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java
migrate to surrogate IDs for all database objects
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / SplashActivity.java
index 921abb7512f7363ed0bca78ea6a140e28d45cd46..2a238adc61333e826c5c5340034e26c311a11f39 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -22,7 +22,6 @@ import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Handler;
 
-import androidx.activity.ComponentActivity;
 import androidx.annotation.Nullable;
 
 import net.ktnx.mobileledger.R;
@@ -32,8 +31,8 @@ import net.ktnx.mobileledger.utils.Logger;
 import net.ktnx.mobileledger.utils.MLDB;
 import net.ktnx.mobileledger.utils.MobileLedgerDatabase;
 
-public class SplashActivity extends ComponentActivity {
-    private static final long keepActiveForMS = 500;
+public class SplashActivity extends CrashReportingActivity {
+    private static final long keepActiveForMS = 400;
     private long startupTime;
     private boolean running = true;
     @Override
@@ -101,12 +100,12 @@ public class SplashActivity extends ComponentActivity {
     private static class DatabaseInitTask extends AsyncTask<Void, Void, Void> {
         @Override
         protected Void doInBackground(Void... voids) {
-            MobileLedgerProfile.loadAllFromDB(null);
+            MobileLedgerProfile.loadAllFromDB(0);
 
-            String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
-            MobileLedgerProfile startupProfile = Data.getProfile(profileUUID);
+            long profileId = MLDB.getLongOption(MLDB.OPT_PROFILE_ID, 0);
+            MobileLedgerProfile startupProfile = Data.getProfile(profileId);
             if (startupProfile != null)
-                Data.setCurrentProfile(startupProfile);
+                Data.postCurrentProfile(startupProfile);
             return null;
         }
         @Override