mirror of
https://github.com/bitwarden/android.git
synced 2024-11-27 20:10:33 +03:00
Use monospace font for generated value on Generator Screen (#422)
This commit is contained in:
parent
c4d4c1d76b
commit
719bf52420
3 changed files with 11 additions and 0 deletions
|
@ -14,6 +14,7 @@ import androidx.compose.ui.semantics.contentDescription
|
|||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.text
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
@ -31,6 +32,7 @@ import com.x8bit.bitwarden.R
|
|||
* @param modifier [Modifier] applied to this layout composable.
|
||||
* @param singleLine when `true`, this text field becomes a single line that horizontally scrolls
|
||||
* instead of wrapping onto multiple lines.
|
||||
* @param textStyle An optional style that may be used to override the default used.
|
||||
* @param visualTransformation Transforms the visual representation of the input [value].
|
||||
* @param actions A lambda containing the set of actions (usually icons or similar) to display
|
||||
* next to the text field. This lambda extends [RowScope],
|
||||
|
@ -42,6 +44,7 @@ fun BitwardenReadOnlyTextFieldWithActions(
|
|||
value: String,
|
||||
modifier: Modifier = Modifier,
|
||||
singleLine: Boolean = true,
|
||||
textStyle: TextStyle? = null,
|
||||
visualTransformation: VisualTransformation = VisualTransformation.None,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
) {
|
||||
|
@ -63,6 +66,7 @@ fun BitwardenReadOnlyTextFieldWithActions(
|
|||
label = label,
|
||||
value = value,
|
||||
onValueChange = {},
|
||||
textStyle = textStyle,
|
||||
visualTransformation = visualTransformation,
|
||||
)
|
||||
BitwardenRowOfActions(actions)
|
||||
|
|
|
@ -2,11 +2,13 @@ package com.x8bit.bitwarden.ui.platform.components
|
|||
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
@ -27,6 +29,7 @@ import com.x8bit.bitwarden.ui.platform.components.model.IconResource
|
|||
* instead of wrapping onto multiple lines.
|
||||
* @param readOnly `true` if the input should be read-only and not accept user interactions.
|
||||
* @param enabled Whether or not the text field is enabled.
|
||||
* @param textStyle An optional style that may be used to override the default used.
|
||||
* @param visualTransformation Transforms the visual representation of the input [value].
|
||||
* @param keyboardType the preferred type of keyboard input.
|
||||
*/
|
||||
|
@ -42,6 +45,7 @@ fun BitwardenTextField(
|
|||
singleLine: Boolean = true,
|
||||
readOnly: Boolean = false,
|
||||
enabled: Boolean = true,
|
||||
textStyle: TextStyle? = null,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
visualTransformation: VisualTransformation = VisualTransformation.None,
|
||||
) {
|
||||
|
@ -73,6 +77,7 @@ fun BitwardenTextField(
|
|||
onValueChange = onValueChange,
|
||||
singleLine = singleLine,
|
||||
readOnly = readOnly,
|
||||
textStyle = textStyle ?: LocalTextStyle.current,
|
||||
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
|
||||
visualTransformation = visualTransformation,
|
||||
)
|
||||
|
|
|
@ -65,6 +65,7 @@ import com.x8bit.bitwarden.ui.platform.components.model.IconResource
|
|||
import com.x8bit.bitwarden.ui.platform.components.model.TooltipData
|
||||
import com.x8bit.bitwarden.ui.platform.components.util.nonLetterColorVisualTransformation
|
||||
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
|
||||
import com.x8bit.bitwarden.ui.platform.theme.LocalNonMaterialTypography
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorState.MainType.Passcode.PasscodeType.Passphrase.Companion.PASSPHRASE_MAX_NUMBER_OF_WORDS
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorState.MainType.Passcode.PasscodeType.Passphrase.Companion.PASSPHRASE_MIN_NUMBER_OF_WORDS
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorState.MainType.Passcode.PasscodeType.Password.Companion.PASSWORD_COUNTER_MAX
|
||||
|
@ -307,6 +308,7 @@ private fun GeneratedStringItem(
|
|||
onClick = onRegenerateClick,
|
||||
)
|
||||
},
|
||||
textStyle = LocalNonMaterialTypography.current.sensitiveInfoSmall,
|
||||
visualTransformation = nonLetterColorVisualTransformation(),
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue