mirror of https://github.com/readrops/Readrops.git
Enable edge to edge
This commit is contained in:
parent
02fb320123
commit
b1e8f25c6c
|
@ -25,7 +25,8 @@
|
|||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
android:exported="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package com.readrops.app.compose
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBarDefaults
|
||||
import androidx.compose.material3.surfaceColorAtElevation
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import cafe.adriel.voyager.navigator.CurrentScreen
|
||||
import cafe.adriel.voyager.navigator.Navigator
|
||||
import cafe.adriel.voyager.navigator.NavigatorDisposeBehavior
|
||||
|
@ -27,6 +34,18 @@ class MainActivity : ComponentActivity(), KoinComponent {
|
|||
setContent {
|
||||
KoinAndroidContext {
|
||||
ReadropsTheme {
|
||||
val navigationBarElevation = NavigationBarDefaults.Elevation
|
||||
|
||||
enableEdgeToEdge(
|
||||
statusBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT),
|
||||
navigationBarStyle = SystemBarStyle.light(
|
||||
MaterialTheme.colorScheme.surfaceColorAtElevation(navigationBarElevation)
|
||||
.toArgb(),
|
||||
MaterialTheme.colorScheme.surfaceColorAtElevation(navigationBarElevation)
|
||||
.toArgb()
|
||||
)
|
||||
)
|
||||
|
||||
Navigator(
|
||||
screen = if (accountExists) HomeScreen() else AccountSelectionScreen(),
|
||||
disposeBehavior = NavigatorDisposeBehavior(
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.readrops.app.compose.home
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.AccountCircle
|
||||
|
@ -29,6 +32,7 @@ import com.readrops.app.compose.util.components.AndroidScreen
|
|||
|
||||
class HomeScreen : AndroidScreen() {
|
||||
|
||||
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
|
||||
@Composable
|
||||
override fun Content() {
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
|
@ -91,7 +95,10 @@ class HomeScreen : AndroidScreen() {
|
|||
},
|
||||
) { paddingValues ->
|
||||
Box(
|
||||
modifier = Modifier.padding(paddingValues)
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.consumeWindowInsets(paddingValues)
|
||||
) {
|
||||
CurrentTab()
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
|
@ -144,6 +145,7 @@ class ItemScreen(
|
|||
state = state.bottomBarState,
|
||||
accentColor = accentColor,
|
||||
modifier = Modifier
|
||||
.navigationBarsPadding()
|
||||
.height(bottomBarHeight)
|
||||
.offset {
|
||||
if (isScrollable) {
|
||||
|
|
|
@ -19,7 +19,7 @@ compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
|
|||
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
|
||||
# specify material3 version is required for gradle to find the dependency
|
||||
compose-material3 = { module = "androidx.compose.material3:material3", version = "1.2.1" }
|
||||
compose-activity = "androidx.activity:activity-compose:1.8.2"
|
||||
compose-activity = "androidx.activity:activity-compose:1.9.0"
|
||||
|
||||
voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
|
||||
voyager-screenmodel = { module = "cafe.adriel.voyager:voyager-screenmodel", version.ref = "voyager" }
|
||||
|
|
Loading…
Reference in New Issue