diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 54fbf8d23..d2c9bc440 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,22 +21,6 @@ android:localeConfig="@xml/locales_config" android:enableOnBackInvokedCallback="true"> - - - - - - - - - - - + android:exported="true" + android:theme="@style/SplashTheme"> + + + + + @@ -101,6 +91,9 @@ + diff --git a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java index 52f1dc7a4..dc9c42e35 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java @@ -102,6 +102,8 @@ public abstract class BaseActivity extends AppCompatActivity { Log.d("activeTheme", theme); if (ThemeUtils.isBlack(getResources().getConfiguration(), theme)) { setTheme(R.style.TuskyBlackTheme); + } else { + setTheme(R.style.TuskyTheme); } /* set the taskdescription programmatically, the theme would turn it blue */ @@ -207,9 +209,9 @@ public abstract class BaseActivity extends AppCompatActivity { protected void redirectIfNotLoggedIn() { AccountEntity account = accountManager.getActiveAccount(); if (account == null) { - Intent intent = new Intent(this, LoginActivity.class); + Intent intent = LoginActivity.getIntent(this, LoginActivity.MODE_DEFAULT); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); - ActivityExtensions.startActivityWithSlideInAnimation(this, intent); + startActivity(intent); finish(); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index 36b37967b..305ce07c3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -46,6 +46,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import androidx.core.content.pm.ShortcutManagerCompat +import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.MenuProvider import androidx.core.view.forEach import androidx.core.view.isVisible @@ -203,10 +204,15 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { @SuppressLint("RestrictedApi") override fun onCreate(savedInstanceState: Bundle?) { + val splashScreen = installSplashScreen() super.onCreate(savedInstanceState) val activeAccount = accountManager.activeAccount - ?: return // will be redirected to LoginActivity by BaseActivity + if (activeAccount == null) { + splashScreen.setKeepOnScreenCondition { true } + // will be redirected to LoginActivity by BaseActivity + return + } if (explodeAnimationWasRequested()) { overrideActivityTransitionCompat( diff --git a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt deleted file mode 100644 index 6acabf03f..000000000 --- a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2018 Conny Duck - * - * This file is a part of Tusky. - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Tusky; if not, - * see . */ - -package com.keylesspalace.tusky - -import android.annotation.SuppressLint -import android.content.Intent -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import com.keylesspalace.tusky.components.login.LoginActivity -import com.keylesspalace.tusky.db.AccountManager -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?) { - 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) { - Intent(this, MainActivity::class.java) - } else { - LoginActivity.getIntent(this, LoginActivity.MODE_DEFAULT) - } - startActivity(intent) - finish() - } -} diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index db118da3f..8b061dcb9 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -33,7 +33,6 @@