Skip to content

Commit

Permalink
Update androidx dependecies
Browse files Browse the repository at this point in the history
  • Loading branch information
david-livefront committed Nov 1, 2024
1 parent 51e2999 commit f47e556
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.x8bit.bitwarden.ui.platform.components.appbar

import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.add
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.only
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MediumTopAppBar
import androidx.compose.material3.Text
Expand Down Expand Up @@ -47,6 +52,9 @@ fun BitwardenMediumTopAppBar(
actions: @Composable RowScope.() -> Unit = {},
) {
TopAppBar(
windowInsets = TopAppBarDefaults.windowInsets.add(
WindowInsets.displayCutout.only(WindowInsetsSides.Horizontal),
),
colors = bitwardenTopAppBarColors(),
scrollBehavior = scrollBehavior,
expandedHeight = 56.dp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package com.x8bit.bitwarden.ui.platform.components.appbar

import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.add
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -49,6 +55,9 @@ fun BitwardenSearchTopAppBar(
modifier = modifier
.testTag(tag = "HeaderBarComponent")
.bottomDivider(),
windowInsets = TopAppBarDefaults.windowInsets.add(
WindowInsets.displayCutout.only(WindowInsetsSides.Horizontal),
),
colors = bitwardenTopAppBarColors(),
scrollBehavior = scrollBehavior,
navigationIcon = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.x8bit.bitwarden.ui.platform.components.appbar

import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.add
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.only
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MediumTopAppBar
import androidx.compose.material3.Text
Expand Down Expand Up @@ -129,6 +134,9 @@ fun BitwardenTopAppBar(

if (titleTextHasOverflow) {
MediumTopAppBar(
windowInsets = TopAppBarDefaults.windowInsets.add(
WindowInsets.displayCutout.only(WindowInsetsSides.Horizontal),
),
colors = bitwardenTopAppBarColors(),
scrollBehavior = scrollBehavior,
navigationIcon = navigationIconContent,
Expand All @@ -149,6 +157,9 @@ fun BitwardenTopAppBar(
)
} else {
TopAppBar(
windowInsets = TopAppBarDefaults.windowInsets.add(
WindowInsets.displayCutout.only(WindowInsetsSides.Horizontal),
),
colors = bitwardenTopAppBarColors(),
scrollBehavior = scrollBehavior,
navigationIcon = navigationIconContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ package com.x8bit.bitwarden.ui.platform.components.scaffold
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.displayCutoutPadding
import androidx.compose.foundation.layout.exclude
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FabPosition
import androidx.compose.material3.Scaffold
Expand Down Expand Up @@ -42,7 +47,7 @@ fun BitwardenScaffold(
contentColor: Color = BitwardenTheme.colorScheme.text.primary,
contentWindowInsets: WindowInsets = ScaffoldDefaults
.contentWindowInsets
.exclude(WindowInsets.navigationBars),
.exclude(WindowInsets.navigationBars.only(WindowInsetsSides.Vertical)),
content: @Composable (PaddingValues) -> Unit,
) {
Scaffold(
Expand All @@ -53,7 +58,11 @@ fun BitwardenScaffold(
bottomBar = bottomBar,
snackbarHost = snackbarHost,
floatingActionButton = {
Box(modifier = Modifier.navigationBarsPadding()) {
Box(
modifier = Modifier
.navigationBarsPadding()
.displayCutoutPadding(),
) {
floatingActionButton()
}
},
Expand All @@ -64,12 +73,16 @@ fun BitwardenScaffold(
content = { paddingValues ->
val internalPullToRefreshState = rememberPullToRefreshState()
Box(
modifier = Modifier.pullToRefresh(
state = internalPullToRefreshState,
isRefreshing = pullToRefreshState.isRefreshing,
onRefresh = pullToRefreshState.onRefresh,
enabled = pullToRefreshState.isEnabled,
),
modifier = Modifier
.windowInsetsPadding(
insets = WindowInsets.displayCutout.only(WindowInsetsSides.Horizontal),
)
.pullToRefresh(
state = internalPullToRefreshState,
isRefreshing = pullToRefreshState.isRefreshing,
onRefresh = pullToRefreshState.onRefresh,
enabled = pullToRefreshState.isEnabled,
),
) {
content(paddingValues)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ package com.x8bit.bitwarden.ui.platform.feature.vaultunlockednavbar

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.exclude
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
Expand All @@ -21,6 +20,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavBackStackEntry
Expand Down Expand Up @@ -177,10 +177,9 @@ private fun VaultUnlockedNavBarScaffold(
var shouldDimNavBar by remember { mutableStateOf(false) }

// This scaffold will host screens that contain top bars while not hosting one itself.
// We need to ignore the status bar insets here and let the content screens handle
// it themselves.
// We need to ignore the all insets here and let the content screens handle it themselves.
BitwardenScaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets.exclude(WindowInsets.statusBars),
contentWindowInsets = WindowInsets(0.dp),
bottomBar = {
Box {
var appBarHeightPx by remember { mutableIntStateOf(0) }
Expand Down Expand Up @@ -210,13 +209,13 @@ private fun VaultUnlockedNavBarScaffold(
},
) { innerPadding ->
// Because this Scaffold has a bottom navigation bar, the NavHost will:
// - consume the navigation bar insets.
// - consume the vertical navigation bar insets.
// - consume the IME insets.
NavHost(
navController = navController,
startDestination = VAULT_GRAPH_ROUTE,
modifier = Modifier
.consumeWindowInsets(WindowInsets.navigationBars)
.consumeWindowInsets(WindowInsets.navigationBars.only(WindowInsetsSides.Vertical))
.consumeWindowInsets(WindowInsets.ime)
.padding(innerPadding.max(WindowInsets.ime)),
enterTransition = RootTransitionProviders.Enter.fadeIn,
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[versions]

# SDK Versions
compileSdk = "34"
targetSdk = "34"
compileSdk = "35"
targetSdk = "35"
minSdk = "29"

# Dependency Versions
Expand All @@ -13,17 +13,17 @@ androidXBiometrics = "1.2.0-alpha05"
androidxBrowser = "1.8.0"
androidxCamera = "1.4.0"
androidxComposeBom = "2024.10.01"
androidxCore = "1.13.1"
androidxCore = "1.15.0"
androidxCredentials = "1.3.0"
androidxHiltNavigationCompose = "1.2.0"
androidxLifecycle = "2.8.6"
androidxLifecycle = "2.8.7"
androidxNavigation = "2.8.0"
androidxRoom = "2.6.1"
androidXSecurityCrypto = "1.1.0-alpha06"
androidxSplash = "1.1.0-rc01"
androidXAppCompat = "1.7.0"
androdixAutofill = "1.1.0"
androidxWork = "2.9.1"
androidxWork = "2.10.0"
bitwardenSdk = "1.0.0-20241030.101847-8"
crashlytics = "3.0.2"
detekt = "1.23.7"
Expand Down

0 comments on commit f47e556

Please sign in to comment.