kunfei 4 lat temu
rodzic
commit
b18d428456

+ 14 - 0
app/build.gradle

@@ -157,6 +157,20 @@ dependencies {
     implementation('com.google.code.gson:gson:2.9.0')
     implementation('com.google.code.gson:gson:2.9.0')
     implementation('androidx.webkit:webkit:1.4.0')
     implementation('androidx.webkit:webkit:1.4.0')
 
 
+    //compose
+    // Integration with activities
+    implementation 'androidx.activity:activity-compose:1.4.0'
+    // Compose Material Design
+    implementation 'androidx.compose.material:material:1.1.1'
+    // Animations
+    implementation 'androidx.compose.animation:animation:1.1.1'
+    // Tooling support (Previews, etc.)
+    implementation 'androidx.compose.ui:ui-tooling:1.1.1'
+    // Integration with ViewModels
+    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1'
+    // UI Tests
+    androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.1.1'
+
     //firebase
     //firebase
     //implementation platform('com.google.firebase:firebase-bom:29.1.0')
     //implementation platform('com.google.firebase:firebase-bom:29.1.0')
     //implementation 'com.google.firebase:firebase-analytics-ktx'
     //implementation 'com.google.firebase:firebase-analytics-ktx'

+ 3 - 3
app/src/main/java/io/legado/app/base/BaseActivity.kt

@@ -66,10 +66,10 @@ abstract class BaseActivity<VB : ViewBinding>(
     override fun onCreate(savedInstanceState: Bundle?) {
     override fun onCreate(savedInstanceState: Bundle?) {
         window.decorView.disableAutoFill()
         window.decorView.disableAutoFill()
         initTheme()
         initTheme()
-        upBackgroundImage()
         super.onCreate(savedInstanceState)
         super.onCreate(savedInstanceState)
-        setContentView(binding.root)
         setupSystemBar()
         setupSystemBar()
+        setContentView(binding.root)
+        upBackgroundImage()
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
             findViewById<TitleBar>(R.id.title_bar)
             findViewById<TitleBar>(R.id.title_bar)
                 ?.onMultiWindowModeChanged(isInMultiWindowMode, fullScreen)
                 ?.onMultiWindowModeChanged(isInMultiWindowMode, fullScreen)
@@ -158,7 +158,7 @@ abstract class BaseActivity<VB : ViewBinding>(
         }
         }
     }
     }
 
 
-    private fun setupSystemBar() {
+    open fun setupSystemBar() {
         if (fullScreen && !isInMultiWindow) {
         if (fullScreen && !isInMultiWindow) {
             fullScreen()
             fullScreen()
         }
         }

+ 8 - 1
app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt

@@ -12,6 +12,7 @@ import io.legado.app.help.config.AppConfig
 import io.legado.app.help.coroutine.Coroutine
 import io.legado.app.help.coroutine.Coroutine
 import io.legado.app.help.storage.AppWebDav
 import io.legado.app.help.storage.AppWebDav
 import io.legado.app.lib.theme.accentColor
 import io.legado.app.lib.theme.accentColor
+import io.legado.app.lib.theme.backgroundColor
 import io.legado.app.ui.book.read.ReadBookActivity
 import io.legado.app.ui.book.read.ReadBookActivity
 import io.legado.app.ui.main.MainActivity
 import io.legado.app.ui.main.MainActivity
 import io.legado.app.utils.*
 import io.legado.app.utils.*
@@ -47,10 +48,16 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
         if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0) {
         if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0) {
             finish()
             finish()
         } else {
         } else {
-            binding.root.postDelayed({ startMainActivity() }, 500)
+            binding.root.postDelayed({ startMainActivity() }, 600)
         }
         }
     }
     }
 
 
+    override fun setupSystemBar() {
+        fullScreen()
+        setStatusBarColorAuto(backgroundColor, true, fullScreen)
+        upNavigationBarColor()
+    }
+
     override fun upBackgroundImage() {
     override fun upBackgroundImage() {
         if (getPrefBoolean(PreferKey.customWelcome)) {
         if (getPrefBoolean(PreferKey.customWelcome)) {
             kotlin.runCatching {
             kotlin.runCatching {