diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eea144fc7..fe1ee2ffb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,22 +25,6 @@ android:networkSecurityConfig="@xml/network_security_config" android:enableOnBackInvokedCallback="true"> - - - - - - - - - - - + + + android:exported="true" + android:theme="@style/SplashTheme"> + + + + + + @@ -109,6 +102,9 @@ android:name="android.service.chooser.chooser_target_service" android:value="androidx.sharetarget.ChooserTargetServiceCompat" /> + . - */ - -package app.pachli - -import android.annotation.SuppressLint -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen -import app.pachli.core.accounts.AccountManager -import app.pachli.core.navigation.LoginActivityIntent -import app.pachli.core.navigation.LoginActivityIntent.LoginMode -import app.pachli.core.navigation.MainActivityIntent -import dagger.hilt.android.AndroidEntryPoint -import javax.inject.Inject - -@SuppressLint("CustomSplashScreen") -@AndroidEntryPoint -class SplashActivity : AppCompatActivity() { - - @Inject - lateinit var accountManager: AccountManager - - override fun onCreate(savedInstanceState: Bundle?) { - installSplashScreen() - super.onCreate(savedInstanceState) - - /** Determine whether the user is currently logged in, and if so go ahead and load the - * timeline. Otherwise, start the activity_login screen. */ - val intent = if (accountManager.activeAccount != null) { - MainActivityIntent(this) - } else { - LoginActivityIntent(this, LoginMode.DEFAULT) - } - startActivity(intent) - finish() - } -} diff --git a/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt b/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt index 23b0e553b..16de7f288 100644 --- a/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt +++ b/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt @@ -56,6 +56,7 @@ import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.EntryPointAccessors.fromApplication import dagger.hilt.components.SingletonComponent import javax.inject.Inject +import kotlin.properties.Delegates import timber.log.Timber @AndroidEntryPoint @@ -68,13 +69,18 @@ abstract class BaseActivity : AppCompatActivity(), MenuProvider { private var requesters: HashMap = HashMap() + /** The most recent theme ID set with [setTheme]. */ + @get:StyleRes + private var activeThemeId by Delegates.notNull() + @EntryPoint @InstallIn(SingletonComponent::class) interface SharedPreferencesRepositoryEntryPoint { fun sharedPreferencesRepository(): SharedPreferencesRepository } - override fun setTheme(themeId: Int) { + override fun setTheme(@StyleRes themeId: Int) { + activeThemeId = themeId super.setTheme(themeId) if (BuildConfig.DEBUG) { val name = resources.getResourceEntryName(themeId) @@ -97,6 +103,8 @@ abstract class BaseActivity : AppCompatActivity(), MenuProvider { Timber.d("activeTheme: %s", theme) if (theme == AppTheme.BLACK) { setTheme(DR.style.Theme_Pachli_Black) + } else if (activeThemeId == DR.style.SplashTheme) { + setTheme(DR.style.Theme_Pachli) } // Set the task description, the theme would turn it blue diff --git a/core/designsystem/src/main/res/values/styles.xml b/core/designsystem/src/main/res/values/styles.xml index 662299684..b1522e576 100644 --- a/core/designsystem/src/main/res/values/styles.xml +++ b/core/designsystem/src/main/res/values/styles.xml @@ -58,7 +58,6 @@