Fix splash screen

This commit is contained in:
zt64 2022-07-04 18:39:27 -04:00
parent c5814b7635
commit a2dbadccd5
3 changed files with 5 additions and 23 deletions

View file

@ -32,7 +32,6 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AliucordManager.SplashScreen"
tools:ignore="AllowBackup">
<service android:name=".installer.service.InstallService" />
<provider
@ -47,7 +46,8 @@
<activity
android:name=".MainActivity"
android:exported="true">
android:exported="true"
android:theme="@style/Theme.AliucordManager.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View file

@ -10,11 +10,9 @@ import android.content.Context
import android.content.Intent
import android.os.*
import android.provider.Settings
import android.view.animation.AccelerateInterpolator
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.core.net.toUri
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.aliucord.manager.preferences.Prefs
@ -22,24 +20,13 @@ import com.aliucord.manager.preferences.sharedPreferences
import com.aliucord.manager.ui.component.ManagerScaffold
import com.aliucord.manager.ui.theme.ManagerTheme
import com.aliucord.manager.ui.theme.Theme
import com.google.accompanist.permissions.ExperimentalPermissionsApi
class MainActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3Api::class, ExperimentalPermissionsApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
installSplashScreen().setOnExitAnimationListener { provider ->
provider.view.animate().apply {
interpolator = AccelerateInterpolator()
duration = 200L
alpha(0f)
withEndAction(provider::remove)
start()
}
}
sharedPreferences = getPreferences(Context.MODE_PRIVATE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !Environment.isExternalStorageManager()) {

View file

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AliucordManager.SplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/Theme.AliucordManager</item>
</style>
<style name="Theme.AliucordManager" parent="Theme.AppCompat">
<item name="colorPrimary">@color/primary</item>
<item name="postSplashScreenTheme">@style/Theme.AppCompat.NoActionBar</item>
</style>
</resources>