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

Commit 9231683d authored by Harini Rajan's avatar Harini Rajan Committed by Android (Google) Code Review
Browse files

Merge "Remove DialogButtonsRow since this component is not present in...

Merge "Remove DialogButtonsRow since this component is not present in http://go/wear-passkey-3p-app-sign-in" into main
parents e9a77684 b981fe61
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -33,8 +33,4 @@
  <string name="dialog_continue_button">Continue</string>
  <!-- Content description for the sign in options button of a screen. [CHAR LIMIT=NONE] -->
  <string name="dialog_sign_in_options_button">Sign-in Options</string>
  <!-- Content description for the cancel button of a screen. [CHAR LIMIT=NONE] -->
  <string name="dialog_cancel_button_cd">Cancel</string>
  <!-- Content description for the OK button of a screen. [CHAR LIMIT=NONE] -->
  <string name="dialog_ok_button_cd">OK</string>
</resources>
 No newline at end of file
+0 −71
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.credentialmanager.ui.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Close
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material.ButtonDefaults
import com.google.android.horologist.compose.material.Button
import com.google.android.horologist.compose.tools.WearPreview
import com.android.credentialmanager.R
import com.google.android.horologist.annotations.ExperimentalHorologistApi

@OptIn(ExperimentalHorologistApi::class)
@Composable
fun DialogButtonsRow(
    onCancelClick: () -> Unit,
    onOKClick: () -> Unit,
    modifier: Modifier = Modifier,
    cancelButtonIcon: ImageVector = Icons.Default.Close,
    okButtonIcon: ImageVector = Icons.Default.Check,
    cancelButtonContentDescription: String = stringResource(R.string.dialog_cancel_button_cd),
    okButtonContentDescription: String = stringResource(R.string.dialog_ok_button_cd),
) {
    Row(
        modifier = modifier,
        horizontalArrangement = Arrangement.Center,
    ) {
        Button(
            imageVector = cancelButtonIcon,
            contentDescription = cancelButtonContentDescription,
            onClick = onCancelClick,
            colors = ButtonDefaults.secondaryButtonColors(),
        )
        Button(
            imageVector = okButtonIcon,
            contentDescription = okButtonContentDescription,
            onClick = onOKClick,
            modifier = Modifier.padding(start = 20.dp)
        )
    }
}

@WearPreview
@Composable
fun DialogButtonsRowPreview() {
    DialogButtonsRow(onCancelClick = {}, onOKClick = {})
}
+1 −39
Original line number Diff line number Diff line
@@ -19,21 +19,12 @@
package com.android.credentialmanager.ui.screens.single

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyListScope
import com.android.credentialmanager.R
import com.android.credentialmanager.ui.components.AccountRow
import com.android.credentialmanager.ui.components.DialogButtonsRow
import com.android.credentialmanager.ui.components.SignInHeader
import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.compose.layout.ScalingLazyColumn
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.belowTimeTextPreview
import com.google.android.horologist.compose.tools.WearPreview

@Composable
fun SingleAccountScreen(
@@ -52,32 +43,3 @@ fun SingleAccountScreen(
        content()
    }
}
 No newline at end of file

@WearPreview
@Composable
fun SingleAccountScreenPreview() {
    SingleAccountScreen(
        headerContent = {
            SignInHeader(
                icon = R.drawable.passkey_icon,
                title = stringResource(R.string.use_passkey_title),
            )
        },
        accountContent = {
            AccountRow(
                name = "Elisa Beckett",
                email = "beckett_bakery@gmail.com",
                modifier = Modifier.padding(top = 10.dp)
            )
        },
        columnState = belowTimeTextPreview(),
    ) {
        item {
            DialogButtonsRow(
                onCancelClick = {},
                onOKClick = {},
                modifier = Modifier.padding(top = 10.dp)
            )
        }
    }
}
+0 −23
Original line number Diff line number Diff line
@@ -25,20 +25,15 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.android.credentialmanager.R
import com.android.credentialmanager.ui.components.AccountRow
import com.android.credentialmanager.ui.components.DialogButtonsRow
import com.android.credentialmanager.ui.components.SignInHeader
import com.android.credentialmanager.ui.screens.single.SingleAccountScreen
import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.belowTimeTextPreview
import com.google.android.horologist.compose.tools.WearPreview

@Composable
fun SinglePasskeyScreen(
    name: String,
    email: String,
    onCancelClick: () -> Unit,
    onOKClick: () -> Unit,
    columnState: ScalingLazyColumnState,
    modifier: Modifier = Modifier,
) {
@@ -60,24 +55,6 @@ fun SinglePasskeyScreen(
        modifier = modifier.padding(horizontal = 10.dp)
    ) {
        item {
            DialogButtonsRow(
                onCancelClick = onCancelClick,
                onOKClick = onOKClick,
                modifier = Modifier.padding(top = 10.dp)
            )
        }
        }
    }

@WearPreview
@Composable
fun SinglePasskeyScreenPreview() {
    SinglePasskeyScreen(
        name = "Elisa Beckett",
        email = "beckett_bakery@gmail.com",
        onCancelClick = {},
        onOKClick = {},
        columnState = belowTimeTextPreview(),
    )
}
+0 −24
Original line number Diff line number Diff line
@@ -33,15 +33,12 @@ import com.android.credentialmanager.CredentialSelectorUiState.Get.SingleEntry
import com.android.credentialmanager.R
import com.android.credentialmanager.TAG
import com.android.credentialmanager.activity.StartBalIntentSenderForResultContract
import com.android.credentialmanager.ui.components.DialogButtonsRow
import com.android.credentialmanager.ui.components.PasswordRow
import com.android.credentialmanager.ui.components.SignInHeader
import com.android.credentialmanager.ui.model.PasswordUiModel
import com.android.credentialmanager.ui.screens.single.SingleAccountScreen
import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.belowTimeTextPreview
import com.google.android.horologist.compose.tools.WearPreview

@Composable
fun SinglePasswordScreen(
@@ -63,8 +60,6 @@ fun SinglePasswordScreen(
        is SinglePasswordScreenUiState.Loaded -> {
            SinglePasswordScreen(
                passwordUiModel = state.passwordUiModel,
                onCancelClick = viewModel::onCancelClick,
                onOKClick = viewModel::onOKClick,
                columnState = columnState,
                modifier = modifier
            )
@@ -102,8 +97,6 @@ fun SinglePasswordScreen(
@Composable
fun SinglePasswordScreen(
    passwordUiModel: PasswordUiModel,
    onCancelClick: () -> Unit,
    onOKClick: () -> Unit,
    columnState: ScalingLazyColumnState,
    modifier: Modifier = Modifier,
) {
@@ -124,23 +117,6 @@ fun SinglePasswordScreen(
        modifier = modifier.padding(horizontal = 10.dp)
    ) {
        item {
            DialogButtonsRow(
                onCancelClick = onCancelClick,
                onOKClick = onOKClick,
                modifier = Modifier.padding(top = 10.dp)
            )
        }
    }
}

@WearPreview
@Composable
fun SinglePasswordScreenPreview() {
    SinglePasswordScreen(
        passwordUiModel = PasswordUiModel(email = "beckett_bakery@gmail.com"),
        onCancelClick = {},
        onOKClick = {},
        columnState = belowTimeTextPreview(),
    )
}