themed icon (android 13) and fixed status bar color
@ -63,8 +63,10 @@ dependencies {
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||
|
||||
implementation "androidx.navigation:navigation-compose:2.6.0-alpha04"
|
||||
implementation 'com.google.accompanist:accompanist-permissions:0.22.0-rc'
|
||||
implementation 'com.google.accompanist:accompanist-insets:0.22.0-rc'
|
||||
implementation 'com.google.accompanist:accompanist-permissions:0.23.1'
|
||||
implementation 'com.google.accompanist:accompanist-insets:0.23.1'
|
||||
|
||||
implementation "com.google.accompanist:accompanist-systemuicontroller:0.23.1"
|
||||
|
||||
implementation 'com.github.squti:Android-Wave-Recorder:1.7.0'
|
||||
implementation("com.squareup.okhttp3:okhttp:4.9.3")
|
||||
|
@ -4,21 +4,15 @@ import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.animation.core.withInfiniteAnimationFrameMillis
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import ch.broillet.jarvis.android.nav.Navigation
|
||||
import ch.broillet.jarvis.android.ui.theme.JarvisclientappTheme
|
||||
import com.google.android.material.elevation.SurfaceColors
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@ -26,12 +20,18 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
setContent {
|
||||
JarvisclientappTheme {
|
||||
window.navigationBarColor = MaterialTheme.colorScheme.background.hashCode() // Set color of system navigationBar same as BottomNavigationView
|
||||
|
||||
// Fullscreen
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
)
|
||||
|
||||
// A surface container using the 'background' color from the theme
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.surface
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
DefaultPreview()
|
||||
}
|
||||
|
@ -3,17 +3,13 @@ package ch.broillet.jarvis.android.ui.theme
|
||||
import android.app.Activity
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = md_theme_dark_primary,
|
||||
@ -80,6 +76,7 @@ fun JarvisclientappTheme(
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
|
||||
val colorScheme = when {
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
val context = LocalContext.current
|
||||
@ -88,11 +85,15 @@ fun JarvisclientappTheme(
|
||||
darkTheme -> DarkColorScheme
|
||||
else -> LightColorScheme
|
||||
}
|
||||
|
||||
val view = LocalView.current
|
||||
if (!view.isInEditMode) {
|
||||
SideEffect {
|
||||
(view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb()
|
||||
ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme
|
||||
(view.context as Activity).window.statusBarColor = Color.Transparent.hashCode()
|
||||
WindowCompat.getInsetsController(
|
||||
(view.context as Activity).window,
|
||||
view
|
||||
).isAppearanceLightStatusBars = !darkTheme
|
||||
}
|
||||
}
|
||||
|
||||
|
1476
app/src/main/res/drawable/logo_transparent.xml
Normal file
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 679 B |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1018 B |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 26 KiB |
@ -2,4 +2,5 @@
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
|
||||
<monochrome android:drawable="@drawable/logo_transparent"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |