From 0053d676db18e7068cda85b190219a10c1cddafb Mon Sep 17 00:00:00 2001 From: Christophe Beyls Date: Wed, 15 May 2024 18:44:43 +0200 Subject: [PATCH] Disable SplashScreen compat implementation on API 31+ (#4447) API 31+ devices don't need to install the compat SplashScreen because they have their own native splash screen implementation. Furthermore, we don't need to customize the splash screen so there is no need to call the library. On API 31+, the SplashScreen compat library registers some kind of listener which causes display bugs with the Tusky theme on some Android versions. Disabling the library on API 31+ solves this issue. Fixes #4446. --- .../java/com/keylesspalace/tusky/MainActivity.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index 305ce07c3..0c8ad5516 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -204,15 +204,15 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { @SuppressLint("RestrictedApi") override fun onCreate(savedInstanceState: Bundle?) { - val splashScreen = installSplashScreen() + // Newer Android versions don't need to install the compat Splash Screen + // and it can cause theming bugs. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { + installSplashScreen() + } super.onCreate(savedInstanceState) - val activeAccount = accountManager.activeAccount - if (activeAccount == null) { - splashScreen.setKeepOnScreenCondition { true } - // will be redirected to LoginActivity by BaseActivity - return - } + // will be redirected to LoginActivity by BaseActivity + val activeAccount = accountManager.activeAccount ?: return if (explodeAnimationWasRequested()) { overrideActivityTransitionCompat(