Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32b75885 authored by Reema Bajwa's avatar Reema Bajwa Committed by Android (Google) Code Review
Browse files

Merge "Change back button to cross for create flow" into main

parents 289f7b40 77d3276d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -317,6 +317,14 @@ class CredentialSelectorViewModel(
        )
    }

    fun createFlowOnMoreOptionsOnlySelectedOnCreationSelection() {
        uiState = uiState.copy(
                createCredentialUiState = uiState.createCredentialUiState?.copy(
                        currentScreenState = CreateScreenState.MORE_OPTIONS_SELECTION_ONLY,
                )
        )
    }

    fun createFlowOnBackCreationSelectionButtonSelected() {
        uiState = uiState.copy(
            createCredentialUiState = uiState.createCredentialUiState?.copy(
+2 −37
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.outlined.Lock
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@@ -47,7 +46,6 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.input.PasswordVisualTransformation
@@ -55,7 +53,6 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.credentialmanager.R
import com.android.credentialmanager.ui.theme.EntryShape
import com.android.credentialmanager.ui.theme.Shapes

@@ -319,38 +316,6 @@ fun CtaButtonRow(

@Composable
fun MoreOptionTopAppBar(
    text: String,
    onNavigationIconClicked: () -> Unit,
    bottomPadding: Dp,
) {
    Row(
            modifier = Modifier.padding(top = 12.dp, bottom = bottomPadding),
            verticalAlignment = Alignment.CenterVertically,
    ) {
        IconButton(
                modifier = Modifier.padding(top = 8.dp, bottom = 8.dp, start = 4.dp).size(48.dp),
                onClick = onNavigationIconClicked
        ) {
            Box(
                    modifier = Modifier.size(48.dp),
                    contentAlignment = Alignment.Center,
            ) {
                Icon(
                        imageVector = Icons.Filled.ArrowBack,
                        contentDescription = stringResource(
                                R.string.accessibility_back_arrow_button
                        ),
                        modifier = Modifier.size(24.dp).autoMirrored(),
                        tint = LocalAndroidColorScheme.current.onSurfaceVariant,
                )
            }
        }
        LargeTitleText(text = text, modifier = Modifier.padding(horizontal = 4.dp))
    }
}

@Composable
fun MoreOptionTopAppBarWithCustomNavigation(
    text: String,
    onNavigationIconClicked: () -> Unit,
    navigationIcon: ImageVector,
+61 −15
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import androidx.compose.material3.Divider
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.NewReleases
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.outlined.QrCodeScanner
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -107,7 +109,7 @@ fun CreateCredentialScreen(
                                onCancelFlowAndFinish = viewModel::onUserCancel,
                                onIllegalScreenStateAndFinish = viewModel::onIllegalUiState,
                                onMoreOptionSelected =
                                viewModel::createFlowOnMoreOptionsSelectedOnCreationSelection,
                                viewModel::createFlowOnMoreOptionsOnlySelectedOnCreationSelection,
                                requestDisplayInfo = createCredentialUiState.requestDisplayInfo,
                                enabledProviderInfo = createCredentialUiState
                                        .activeEntry?.activeProvider!!,
@@ -120,6 +122,41 @@ fun CreateCredentialScreen(
                                onBiometricPromptStateChange =
                                viewModel::onBiometricPromptStateChange
                            )
                        CreateScreenState.MORE_OPTIONS_SELECTION_ONLY -> MoreOptionsSelectionCard(
                                requestDisplayInfo = createCredentialUiState.requestDisplayInfo,
                                enabledProviderList = createCredentialUiState.enabledProviders,
                                disabledProviderList = createCredentialUiState.disabledProviders,
                                sortedCreateOptionsPairs =
                                createCredentialUiState.sortedCreateOptionsPairs,
                                onBackCreationSelectionButtonSelected =
                                viewModel::createFlowOnBackCreationSelectionButtonSelected,
                                onOptionSelected =
                                viewModel::createFlowOnEntrySelectedFromMoreOptionScreen,
                                onDisabledProvidersSelected =
                                viewModel::createFlowOnLaunchSettings,
                                onRemoteEntrySelected = viewModel::createFlowOnEntrySelected,
                                onLog = { viewModel.logUiEvent(it) },
                                customTopAppBar = { MoreOptionTopAppBar(
                                        text = stringResource(
                                                R.string.save_credential_to_title,
                                                when (createCredentialUiState.requestDisplayInfo
                                                        .type) {
                                                    CredentialType.PASSKEY ->
                                                        stringResource(R.string.passkey)
                                                    CredentialType.PASSWORD ->
                                                        stringResource(R.string.password)
                                                    CredentialType.UNKNOWN -> stringResource(
                                                            R.string.sign_in_info)
                                                }
                                        ),
                                        onNavigationIconClicked = viewModel::onUserCancel,
                                        bottomPadding = 16.dp,
                                        navigationIcon = Icons.Filled.Close,
                                        navigationIconContentDescription = stringResource(
                                                R.string.accessibility_close_button
                                        )
                                )}
                        )
                        CreateScreenState.MORE_OPTIONS_SELECTION -> MoreOptionsSelectionCard(
                                requestDisplayInfo = createCredentialUiState.requestDisplayInfo,
                                enabledProviderList = createCredentialUiState.enabledProviders,
@@ -207,8 +244,12 @@ fun MoreOptionsSelectionCard(
    onDisabledProvidersSelected: () -> Unit,
    onRemoteEntrySelected: (EntryInfo) -> Unit,
    onLog: @Composable (UiEventEnum) -> Unit,
    customTopAppBar: (@Composable() () -> Unit)? = null
) {
    SheetContainerCard(topAppBar = {
        if (customTopAppBar != null) {
            customTopAppBar()
        } else {
            MoreOptionTopAppBar(
                    text = stringResource(
                            R.string.save_credential_to_title,
@@ -222,7 +263,12 @@ fun MoreOptionsSelectionCard(
                    ),
                    onNavigationIconClicked = onBackCreationSelectionButtonSelected,
                    bottomPadding = 16.dp,
                    navigationIcon = Icons.Filled.ArrowBack,
                    navigationIconContentDescription = stringResource(
                            R.string.accessibility_back_arrow_button
                    )
            )
        }
    }) {
        // bottom padding already
        item {
+1 −0
Original line number Diff line number Diff line
@@ -181,4 +181,5 @@ enum class CreateScreenState {
  MORE_OPTIONS_SELECTION,
  DEFAULT_PROVIDER_CONFIRMATION,
  EXTERNAL_ONLY_SELECTION,
  MORE_OPTIONS_SELECTION_ONLY,
}
+6 −3
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.outlined.QrCodeScanner
import androidx.compose.material3.Divider
@@ -71,7 +72,6 @@ import com.android.credentialmanager.common.ui.HeadlineText
import com.android.credentialmanager.common.ui.LargeLabelTextOnSurfaceVariant
import com.android.credentialmanager.common.ui.ModalBottomSheet
import com.android.credentialmanager.common.ui.MoreOptionTopAppBar
import com.android.credentialmanager.common.ui.MoreOptionTopAppBarWithCustomNavigation
import com.android.credentialmanager.common.ui.SheetContainerCard
import com.android.credentialmanager.common.ui.Snackbar
import com.android.credentialmanager.common.ui.SnackbarActionText
@@ -175,7 +175,7 @@ fun GetCredentialScreen(
                                    onBackButtonClicked = viewModel::onUserCancel,
                                    onCancel = viewModel::onUserCancel,
                                    onLog = { viewModel.logUiEvent(it) },
                                    customTopBar = { MoreOptionTopAppBarWithCustomNavigation(
                                    customTopBar = { MoreOptionTopAppBar(
                                            text = stringResource(
                                                    R.string.get_dialog_title_sign_in_options),
                                            onNavigationIconClicked = viewModel::onUserCancel,
@@ -683,7 +683,10 @@ fun AllSignInOptionCard(
                    text = stringResource(R.string.get_dialog_title_sign_in_options),
                    onNavigationIconClicked = onBackButtonClicked,
                    bottomPadding = 0.dp,
            )
                    navigationIcon = Icons.Filled.ArrowBack,
                    navigationIconContentDescription = stringResource(
                            R.string.accessibility_back_arrow_button
            ))
        }
    }) {
        var isFirstSection = true