Changed the default Theme.kt
This commit is contained in:
1 parent
127805bc70
commit
dbf0bd9a58
8 files changed
+171
-75
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package com.anthonyla.livewallpaper.ui
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -7,6 +8,9 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.anthonyla.livewallpaper.navigation.BottomNavScreens
|
||||
@@ -17,15 +21,7 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun LiveWallpaperApp(modifier: Modifier = Modifier) {
|
||||
// Transparent status bar
|
||||
val systemUiController = rememberSystemUiController()
|
||||
SideEffect {
|
||||
systemUiController.setStatusBarColor(
|
||||
color = Color.Transparent,
|
||||
// check if app is in dark mode or not
|
||||
darkIcons = false
|
||||
)
|
||||
}
|
||||
SetTransparentSystemBars()
|
||||
|
||||
// Bottom navigation
|
||||
val navController = rememberNavController()
|
||||
@@ -47,4 +43,20 @@ fun LiveWallpaperApp(modifier: Modifier = Modifier) {
|
||||
bottomNav(navController)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SetTransparentSystemBars() {
|
||||
val systemUiController = rememberSystemUiController()
|
||||
val view = LocalView.current
|
||||
SideEffect {
|
||||
with(view.context as Activity) {
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
systemUiController.setSystemBarsColor(
|
||||
color = Color.Transparent,
|
||||
// check if app is in dark mode or not
|
||||
darkIcons = false
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user