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.
This commit is contained in:
Christophe Beyls 2024-05-15 18:44:43 +02:00 committed by GitHub
parent 952f9a8614
commit 0053d676db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 7 deletions

View File

@ -204,15 +204,15 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
override fun onCreate(savedInstanceState: Bundle?) { 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) super.onCreate(savedInstanceState)
val activeAccount = accountManager.activeAccount // will be redirected to LoginActivity by BaseActivity
if (activeAccount == null) { val activeAccount = accountManager.activeAccount ?: return
splashScreen.setKeepOnScreenCondition { true }
// will be redirected to LoginActivity by BaseActivity
return
}
if (explodeAnimationWasRequested()) { if (explodeAnimationWasRequested()) {
overrideActivityTransitionCompat( overrideActivityTransitionCompat(