From: Damyan Ivanov Date: Wed, 21 Apr 2021 20:03:50 +0000 (+0300) Subject: splash: show forced delay before starting the main activity in debug X-Git-Tag: v0.18.0~61 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=804f1fa43c2feb45a80cc281f39cd981953785db;p=mobile-ledger.git splash: show forced delay before starting the main activity in debug we may want to do something useful with this time - preload profile data? --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java index 7ab3e279..b868366b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java @@ -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() {