Skip to content

Commit

Permalink
Improved edge-to-edge (#136)
Browse files Browse the repository at this point in the history
* improved edge-to-edge

* added scrim back
  • Loading branch information
acszo authored Jan 9, 2025
1 parent 135bda4 commit 864eee9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/org/samo_lego/canta/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
window.isNavigationBarContrastEnforced = false
super.onCreate(savedInstanceState)

setContent {
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/org/samo_lego/canta/ui/CantaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
Expand Down Expand Up @@ -108,7 +110,9 @@ fun CantaApp(
AppsType.UNINSTALLED -> MaterialTheme.colorScheme.tertiaryContainer
},
shape = RoundedCornerShape(32.dp),
modifier = Modifier.padding(16.dp),
modifier = Modifier
.padding(16.dp)
.navigationBarsPadding(),
onClick = {
if (selectedAppsType == AppsType.INSTALLED) {
showUninstallConfirmDialog = appListViewModel.selectedApps.isNotEmpty()
Expand Down Expand Up @@ -140,6 +144,7 @@ fun CantaApp(

},
floatingActionButtonPosition = FabPosition.End,
contentWindowInsets = WindowInsets(0, 0, 0, 0)
) { innerPadding ->
Column(
modifier = Modifier
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/org/samo_lego/canta/ui/component/AppList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
Expand Down Expand Up @@ -83,8 +86,8 @@ fun AppList(
}
if (appList.isNotEmpty()) {
LazyColumn(
modifier = Modifier
.fillMaxSize(),
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets.navigationBars.asPaddingValues()
) {
items(appList, key = { it.packageName }) { appInfo ->
AppTile(
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/org/samo_lego/canta/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ fun CantaTheme(
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}

Expand Down

0 comments on commit 864eee9

Please sign in to comment.