Add splash for android < 12 so app is not completely blank during process creation
This commit is contained in:
parent
581d002918
commit
0eed2895f6
7 changed files with 45 additions and 3 deletions
|
|
@ -171,7 +171,7 @@ dependencies {
|
||||||
// https://developer.android.com/studio/write/java8-support#library-desugaring-versions
|
// https://developer.android.com/studio/write/java8-support#library-desugaring-versions
|
||||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.2")
|
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.2")
|
||||||
implementation(libs.appyx.core)
|
implementation(libs.appyx.core)
|
||||||
|
implementation(libs.androidx.splash)
|
||||||
implementation(libs.androidx.corektx)
|
implementation(libs.androidx.corektx)
|
||||||
implementation(libs.androidx.lifecycle.runtime)
|
implementation(libs.androidx.lifecycle.runtime)
|
||||||
implementation(libs.androidx.activity.compose)
|
implementation(libs.androidx.activity.compose)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
tools:targetApi="33">
|
tools:targetApi="33">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
android:theme="@style/Theme.ElementX.Splash"
|
||||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
|
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:windowSoftInputMode="adjustResize"
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
|
|
||||||
|
|
@ -22,18 +22,20 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import com.bumble.appyx.core.integration.NodeHost
|
import com.bumble.appyx.core.integration.NodeHost
|
||||||
import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
|
import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
|
||||||
import io.element.android.libraries.architecture.bindings
|
import io.element.android.libraries.architecture.bindings
|
||||||
import io.element.android.libraries.di.DaggerComponentOwner
|
|
||||||
import io.element.android.libraries.designsystem.ElementXTheme
|
import io.element.android.libraries.designsystem.ElementXTheme
|
||||||
|
import io.element.android.libraries.di.DaggerComponentOwner
|
||||||
import io.element.android.x.di.AppBindings
|
import io.element.android.x.di.AppBindings
|
||||||
import io.element.android.x.node.RootFlowNode
|
import io.element.android.x.node.RootFlowNode
|
||||||
|
|
||||||
class MainActivity : NodeComponentActivity() {
|
class MainActivity : NodeComponentActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
installSplashScreen()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
val appBindings = bindings<AppBindings>()
|
val appBindings = bindings<AppBindings>()
|
||||||
appBindings.matrixClientsHolder().restore(savedInstanceState)
|
appBindings.matrixClientsHolder().restore(savedInstanceState)
|
||||||
|
|
|
||||||
8
app/src/main/res/drawable/splash_icon.xml
Normal file
8
app/src/main/res/drawable/splash_icon.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<inset
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:drawable="@mipmap/ic_launcher_round"
|
||||||
|
android:insetTop="80dp"
|
||||||
|
android:insetRight="80dp"
|
||||||
|
android:insetBottom="80dp"
|
||||||
|
android:insetLeft="80dp" />
|
||||||
26
app/src/main/res/values-night/themes.xml
Normal file
26
app/src/main/res/values-night/themes.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright (c) 2023 New Vector Ltd
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.ElementX.Splash" parent="Theme.SplashScreen">
|
||||||
|
<item name="windowSplashScreenBackground">@color/black</item>
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||||
|
<item name="postSplashScreenTheme">@style/Theme.ElementX</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.ElementX" parent="Theme.ElementAndroid" />
|
||||||
|
</resources>
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
|
<style name="Theme.ElementX.Splash" parent="Theme.SplashScreen.IconBackground">
|
||||||
|
<item name="windowSplashScreenBackground">@color/white</item>
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||||
|
<item name="postSplashScreenTheme">@style/Theme.ElementX</item>
|
||||||
|
</style>
|
||||||
<style name="Theme.ElementX" parent="Theme.ElementAndroid" />
|
<style name="Theme.ElementX" parent="Theme.ElementAndroid" />
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ androidx_recyclerview = { module = "androidx.recyclerview:recyclerview", version
|
||||||
androidx_lifecycle_runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" }
|
androidx_lifecycle_runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" }
|
||||||
androidx_lifecycle_compose = { module = "androidx.lifecycle:compose", version.ref = "lifecycle" }
|
androidx_lifecycle_compose = { module = "androidx.lifecycle:compose", version.ref = "lifecycle" }
|
||||||
androidx_lifecycle_process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle" }
|
androidx_lifecycle_process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle" }
|
||||||
|
androidx_splash = "androidx.core:core-splashscreen:1.0.0"
|
||||||
|
|
||||||
androidx_activity_compose = { module = "androidx.activity:activity-compose", version.ref = "activity_compose" }
|
androidx_activity_compose = { module = "androidx.activity:activity-compose", version.ref = "activity_compose" }
|
||||||
androidx_startup = { module = "androidx.startup:startup-runtime", version.ref = "startup" }
|
androidx_startup = { module = "androidx.startup:startup-runtime", version.ref = "startup" }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue