add splash screen

1.2-legacy
andrekir 2022-02-04 00:57:27 -03:00
rodzic a0d00a4287
commit 239a22c1bc
4 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -196,5 +196,7 @@ dependencies {
// implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation "androidx.core:core-splashscreen:1.0.0-beta01"
implementation project(':geeksville-androidlib')
}

Wyświetl plik

@ -128,7 +128,7 @@
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden"
android:theme="@style/AppTheme"
android:theme="@style/Theme.App.Starting"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Wyświetl plik

@ -33,6 +33,7 @@ import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.Toolbar
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
@ -477,6 +478,7 @@ class MainActivity : AppCompatActivity(), Logging,
}
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)

Wyświetl plik

@ -73,4 +73,18 @@
<item name="materialThemeOverlay">@style/MyThemeOverlay_Toolbar</item>
</style>
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
// Set the splash screen background, animated icon, and animation duration.
<item name="windowSplashScreenBackground">@color/selectedColor</item>
// Use windowSplashScreenAnimatedIcon to add either a drawable or an
// animated drawable. One of these is required.
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher2_foreground</item>
<item name="windowSplashScreenAnimationDuration">1000</item> # Required for
# animated icons
// Set the theme of the Activity that directly follows your splash screen.
<item name="postSplashScreenTheme">@style/AppTheme</item> # Required.
</style>
</resources>