mirror of https://github.com/tuskyapp/Tusky.git
Browse Source
The Androidx SplashScreen library is added as a dependency to the project but isn't properly enabled in the current code. This pull request configures the splash screen properly. - Remove `SplashScreenActivity` which is not needed and use `MainActivity` as main entry point to the application. `MainActivity` inherits from `BaseActivity` which already detects if no account is configured and redirects to `LoginActivity` if needed, just like `SplashScreenActivity`. - Initialize the SplashScreen library in `MainActivity.onCreate()`. - Instead of letting the SplashScreen library set the final theme from the `postSplashScreenTheme` attribute in SplashTheme, let `BaseActivity` set it according to the user settings. - When no account is available in `MainActivity.onCreate()`, keep the splash screen shown until `LoginActivity` appears. - Disable the slide-in animation when launching `LoginActivity` when no account is available because the detection happens in `onCreate()` and an Activity that finishes itself in `onCreate()` will not be drawn, so the slide-in animation will not be visible either and only `LoginActivity` will appear. - Upgrade `core-splashscreen` to 1.2.0-alpha01 which contains a fix for corrupted app theme on API 31+.pull/4411/head^2
6 changed files with 22 additions and 69 deletions
@ -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 <http://www.gnu.org/licenses>. */ |
||||
|
||||
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() |
||||
} |
||||
} |
||||
Loading…
Reference in new issue