Merge "[CredManUi] Dismiss system bars immediately upon bottom sheet dismissal" into udc-dev
This commit is contained in:
@@ -22,6 +22,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import com.android.compose.rememberSystemUiController
|
||||||
import com.android.credentialmanager.common.material.ModalBottomSheetLayout
|
import com.android.credentialmanager.common.material.ModalBottomSheetLayout
|
||||||
import com.android.credentialmanager.common.material.ModalBottomSheetValue
|
import com.android.credentialmanager.common.material.ModalBottomSheetValue
|
||||||
import com.android.credentialmanager.common.material.rememberModalBottomSheetState
|
import com.android.credentialmanager.common.material.rememberModalBottomSheetState
|
||||||
@@ -38,6 +39,12 @@ fun ModalBottomSheet(
|
|||||||
initialValue = ModalBottomSheetValue.Expanded,
|
initialValue = ModalBottomSheetValue.Expanded,
|
||||||
skipHalfExpanded = true
|
skipHalfExpanded = true
|
||||||
)
|
)
|
||||||
|
val sysUiController = rememberSystemUiController()
|
||||||
|
if (state.targetValue == ModalBottomSheetValue.Hidden) {
|
||||||
|
setTransparentSystemBarsColor(sysUiController)
|
||||||
|
} else {
|
||||||
|
setBottomSheetSystemBarsColor(sysUiController)
|
||||||
|
}
|
||||||
ModalBottomSheetLayout(
|
ModalBottomSheetLayout(
|
||||||
sheetBackgroundColor = LocalAndroidColorScheme.current.colorSurfaceBright,
|
sheetBackgroundColor = LocalAndroidColorScheme.current.colorSurfaceBright,
|
||||||
modifier = Modifier.background(Color.Transparent),
|
modifier = Modifier.background(Color.Transparent),
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.platform.LocalAccessibilityManager
|
import androidx.compose.ui.platform.LocalAccessibilityManager
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.android.compose.rememberSystemUiController
|
||||||
import com.android.credentialmanager.R
|
import com.android.credentialmanager.R
|
||||||
import com.android.credentialmanager.common.material.Scrim
|
import com.android.credentialmanager.common.material.Scrim
|
||||||
import com.android.credentialmanager.ui.theme.Shapes
|
import com.android.credentialmanager.ui.theme.Shapes
|
||||||
@@ -49,6 +50,8 @@ fun Snackbar(
|
|||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
dismissOnTimeout: Boolean = false,
|
dismissOnTimeout: Boolean = false,
|
||||||
) {
|
) {
|
||||||
|
val sysUiController = rememberSystemUiController()
|
||||||
|
setTransparentSystemBarsColor(sysUiController)
|
||||||
BoxWithConstraints {
|
BoxWithConstraints {
|
||||||
Box(Modifier.fillMaxSize()) {
|
Box(Modifier.fillMaxSize()) {
|
||||||
Scrim(
|
Scrim(
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
import com.android.compose.rememberSystemUiController
|
|
||||||
import com.android.credentialmanager.CredentialSelectorViewModel
|
import com.android.credentialmanager.CredentialSelectorViewModel
|
||||||
import com.android.credentialmanager.R
|
import com.android.credentialmanager.R
|
||||||
import com.android.credentialmanager.common.BaseEntry
|
import com.android.credentialmanager.common.BaseEntry
|
||||||
@@ -67,7 +66,6 @@ import com.android.credentialmanager.common.ui.MoreOptionTopAppBar
|
|||||||
import com.android.credentialmanager.common.ui.SheetContainerCard
|
import com.android.credentialmanager.common.ui.SheetContainerCard
|
||||||
import com.android.credentialmanager.common.ui.PasskeyBenefitRow
|
import com.android.credentialmanager.common.ui.PasskeyBenefitRow
|
||||||
import com.android.credentialmanager.common.ui.HeadlineText
|
import com.android.credentialmanager.common.ui.HeadlineText
|
||||||
import com.android.credentialmanager.common.ui.setBottomSheetSystemBarsColor
|
|
||||||
import com.android.credentialmanager.logging.CreateCredentialEvent
|
import com.android.credentialmanager.logging.CreateCredentialEvent
|
||||||
import com.android.internal.logging.UiEventLogger.UiEventEnum
|
import com.android.internal.logging.UiEventLogger.UiEventEnum
|
||||||
|
|
||||||
@@ -77,8 +75,6 @@ fun CreateCredentialScreen(
|
|||||||
createCredentialUiState: CreateCredentialUiState,
|
createCredentialUiState: CreateCredentialUiState,
|
||||||
providerActivityLauncher: ManagedActivityResultLauncher<IntentSenderRequest, ActivityResult>
|
providerActivityLauncher: ManagedActivityResultLauncher<IntentSenderRequest, ActivityResult>
|
||||||
) {
|
) {
|
||||||
val sysUiController = rememberSystemUiController()
|
|
||||||
setBottomSheetSystemBarsColor(sysUiController)
|
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
sheetContent = {
|
sheetContent = {
|
||||||
// Hide the sheet content as opposed to the whole bottom sheet to maintain the scrim
|
// Hide the sheet content as opposed to the whole bottom sheet to maintain the scrim
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
import com.android.compose.rememberSystemUiController
|
|
||||||
import com.android.credentialmanager.CredentialSelectorViewModel
|
import com.android.credentialmanager.CredentialSelectorViewModel
|
||||||
import com.android.credentialmanager.R
|
import com.android.credentialmanager.R
|
||||||
import com.android.credentialmanager.common.BaseEntry
|
import com.android.credentialmanager.common.BaseEntry
|
||||||
@@ -62,8 +61,6 @@ import com.android.credentialmanager.common.ui.CredentialListSectionHeader
|
|||||||
import com.android.credentialmanager.common.ui.HeadlineIcon
|
import com.android.credentialmanager.common.ui.HeadlineIcon
|
||||||
import com.android.credentialmanager.common.ui.LargeLabelTextOnSurfaceVariant
|
import com.android.credentialmanager.common.ui.LargeLabelTextOnSurfaceVariant
|
||||||
import com.android.credentialmanager.common.ui.Snackbar
|
import com.android.credentialmanager.common.ui.Snackbar
|
||||||
import com.android.credentialmanager.common.ui.setTransparentSystemBarsColor
|
|
||||||
import com.android.credentialmanager.common.ui.setBottomSheetSystemBarsColor
|
|
||||||
import com.android.credentialmanager.logging.GetCredentialEvent
|
import com.android.credentialmanager.logging.GetCredentialEvent
|
||||||
import com.android.internal.logging.UiEventLogger.UiEventEnum
|
import com.android.internal.logging.UiEventLogger.UiEventEnum
|
||||||
|
|
||||||
@@ -73,9 +70,7 @@ fun GetCredentialScreen(
|
|||||||
getCredentialUiState: GetCredentialUiState,
|
getCredentialUiState: GetCredentialUiState,
|
||||||
providerActivityLauncher: ManagedActivityResultLauncher<IntentSenderRequest, ActivityResult>
|
providerActivityLauncher: ManagedActivityResultLauncher<IntentSenderRequest, ActivityResult>
|
||||||
) {
|
) {
|
||||||
val sysUiController = rememberSystemUiController()
|
|
||||||
if (getCredentialUiState.currentScreenState == GetScreenState.REMOTE_ONLY) {
|
if (getCredentialUiState.currentScreenState == GetScreenState.REMOTE_ONLY) {
|
||||||
setTransparentSystemBarsColor(sysUiController)
|
|
||||||
RemoteCredentialSnackBarScreen(
|
RemoteCredentialSnackBarScreen(
|
||||||
onClick = viewModel::getFlowOnMoreOptionOnSnackBarSelected,
|
onClick = viewModel::getFlowOnMoreOptionOnSnackBarSelected,
|
||||||
onCancel = viewModel::onUserCancel,
|
onCancel = viewModel::onUserCancel,
|
||||||
@@ -84,7 +79,6 @@ fun GetCredentialScreen(
|
|||||||
viewModel.uiMetrics.log(GetCredentialEvent.CREDMAN_GET_CRED_SCREEN_REMOTE_ONLY)
|
viewModel.uiMetrics.log(GetCredentialEvent.CREDMAN_GET_CRED_SCREEN_REMOTE_ONLY)
|
||||||
} else if (getCredentialUiState.currentScreenState
|
} else if (getCredentialUiState.currentScreenState
|
||||||
== GetScreenState.UNLOCKED_AUTH_ENTRIES_ONLY) {
|
== GetScreenState.UNLOCKED_AUTH_ENTRIES_ONLY) {
|
||||||
setTransparentSystemBarsColor(sysUiController)
|
|
||||||
EmptyAuthEntrySnackBarScreen(
|
EmptyAuthEntrySnackBarScreen(
|
||||||
authenticationEntryList =
|
authenticationEntryList =
|
||||||
getCredentialUiState.providerDisplayInfo.authenticationEntryList,
|
getCredentialUiState.providerDisplayInfo.authenticationEntryList,
|
||||||
@@ -95,7 +89,6 @@ fun GetCredentialScreen(
|
|||||||
viewModel.uiMetrics.log(GetCredentialEvent
|
viewModel.uiMetrics.log(GetCredentialEvent
|
||||||
.CREDMAN_GET_CRED_SCREEN_UNLOCKED_AUTH_ENTRIES_ONLY)
|
.CREDMAN_GET_CRED_SCREEN_UNLOCKED_AUTH_ENTRIES_ONLY)
|
||||||
} else {
|
} else {
|
||||||
setBottomSheetSystemBarsColor(sysUiController)
|
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
sheetContent = {
|
sheetContent = {
|
||||||
// Hide the sheet content as opposed to the whole bottom sheet to maintain the scrim
|
// Hide the sheet content as opposed to the whole bottom sheet to maintain the scrim
|
||||||
|
|||||||
Reference in New Issue
Block a user