]> git.ktnx.net Git - mobile-ledger.git/commitdiff
splash: show forced delay before starting the main activity in debug
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 21 Apr 2021 20:03:50 +0000 (23:03 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 21 Apr 2021 20:03:50 +0000 (23:03 +0300)
we may want to do something useful with this time - preload profile
data?

app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java

index 7ab3e27937214239f06667aaab7f49b6de8ba5e5..b868366b9d94bdf1529a428cd0d5fe2147c1de90 100644 (file)
@@ -28,6 +28,8 @@ import net.ktnx.mobileledger.db.DB;
 import net.ktnx.mobileledger.utils.Logger;
 import net.ktnx.mobileledger.utils.MobileLedgerDatabase;
 
+import java.util.Locale;
+
 public class SplashActivity extends CrashReportingActivity {
     private static final long keepActiveForMS = 400;
     private long startupTime;
@@ -77,8 +79,11 @@ public class SplashActivity extends CrashReportingActivity {
         if (now > startupTime + keepActiveForMS)
             startMainActivity();
         else {
-            new Handler().postDelayed(this::startMainActivity,
-                    keepActiveForMS - (now - startupTime));
+            final long delay = keepActiveForMS - (now - startupTime);
+            Logger.debug("splash",
+                    String.format(Locale.ROOT, "Scheduling main activity start in %d milliseconds",
+                            delay));
+            new Handler().postDelayed(this::startMainActivity, delay);
         }
     }
     private void startMainActivity() {