0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-19 19:52:14 +02:00

Replace Accompanist Systemuicontroller with edge-to-edge from AndroidX Activity

This commit is contained in:
Wolf-Martell Montwé 2024-02-21 14:56:42 +01:00
parent 6b51d63c7a
commit 177ffc2a2a
No known key found for this signature in database
GPG Key ID: 6D45B21512ACBF72
6 changed files with 22 additions and 16 deletions

View File

@ -124,7 +124,6 @@ com.github.bumptech.glide:annotations:4.16.0
com.github.bumptech.glide:disklrucache:4.16.0
com.github.bumptech.glide:gifdecoder:4.16.0
com.github.bumptech.glide:glide:4.16.0
com.google.accompanist:accompanist-systemuicontroller:0.32.0
com.google.android.flexbox:flexbox:3.0.0
com.google.android.material:material:1.9.0
com.google.errorprone:error_prone_annotations:2.15.0

View File

@ -9,7 +9,8 @@ android {
dependencies {
api(projects.core.ui.compose.common)
implementation(libs.accompanist.systemuicontroller)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material.icons.extended)
implementation(libs.androidx.activity)
}

View File

@ -31,7 +31,10 @@ fun MainTheme(
lightImages
}
SetSystemBarsColor(color = colors.toolbar)
SetSystemBarsColor(
darkTheme = darkTheme,
color = colors.toolbar,
)
val shapes = MainTheme.shapes

View File

@ -1,19 +1,24 @@
package app.k9mail.core.ui.compose.theme.color
import android.app.Activity
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
@Composable
fun SetSystemBarsColor(
color: Color,
darkTheme: Boolean,
color: Color = Color.Transparent,
) {
val systemUiController = rememberSystemUiController()
DisposableEffect(Unit) {
systemUiController.setSystemBarsColor(color = color)
onDispose { }
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = color.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}
}

View File

@ -3,7 +3,7 @@ package app.k9mail.feature.launcher
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.core.view.WindowCompat
import androidx.activity.enableEdgeToEdge
import app.k9mail.core.ui.compose.common.activity.setActivityContent
import app.k9mail.core.ui.compose.common.navigation.toDeepLinkUri
import app.k9mail.feature.account.edit.navigation.NAVIGATION_ROUTE_ACCOUNT_EDIT_SERVER_SETTINGS_INCOMING
@ -19,7 +19,7 @@ class FeatureLauncherActivity : K9Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge()
setActivityContent {
FeatureLauncherApp()

View File

@ -11,7 +11,6 @@
# 4. Run the app and check for any issues.
[versions]
accompanist = "0.32.0"
androidDesugar = "2.0.4"
androidMaterial = "1.9.0"
# AGP and tools should be updated together
@ -113,7 +112,6 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "kotlinKsp" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotlessPlugin" }
[libraries]
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
android-desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "androidDesugar" }
android-material = { module = "com.google.android.material:material", version.ref = "androidMaterial" }
android-tools-common = { module = "com.android.tools:common", version.ref = "androidTools" }