From 804f1fa43c2feb45a80cc281f39cd981953785db Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 21 Apr 2021 23:03:50 +0300 Subject: [PATCH] splash: show forced delay before starting the main activity in debug we may want to do something useful with this time - preload profile data? --- .../ktnx/mobileledger/ui/activity/SplashActivity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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() { -- 2.39.5