mirror of
https://github.com/bitwarden/android.git
synced 2025-03-15 18:58:59 +03:00
Minor updates to prepare for View Item screen (#289)
This commit is contained in:
parent
5c7241ab1a
commit
3a17462ad8
4 changed files with 26 additions and 2 deletions
|
@ -31,6 +31,11 @@ class IntentHandler(private val context: Context) {
|
|||
* Start an activity to view the given [uri] in an external browser.
|
||||
*/
|
||||
fun launchUri(uri: Uri) {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, uri))
|
||||
val newUri = if (uri.scheme == null) {
|
||||
uri.buildUpon().scheme("https").build()
|
||||
} else {
|
||||
uri.normalizeScheme()
|
||||
}
|
||||
startActivity(Intent(Intent.ACTION_VIEW, newUri))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
* @param placeholder the optional placeholder to be displayed when the text field is in focus and
|
||||
* the [value] is empty.
|
||||
* @param hint optional hint text that will appear below the text input.
|
||||
* @param singleLine when `true`, this text field becomes a single line that horizontally scrolls
|
||||
* 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 keyboardType the preferred type of keyboard input.
|
||||
|
@ -31,6 +33,7 @@ fun BitwardenTextField(
|
|||
modifier: Modifier = Modifier,
|
||||
placeholder: String? = null,
|
||||
hint: String? = null,
|
||||
singleLine: Boolean = true,
|
||||
readOnly: Boolean = false,
|
||||
enabled: Boolean = true,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
|
@ -52,7 +55,7 @@ fun BitwardenTextField(
|
|||
}
|
||||
},
|
||||
onValueChange = onValueChange,
|
||||
singleLine = true,
|
||||
singleLine = singleLine,
|
||||
readOnly = readOnly,
|
||||
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
|
||||
)
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
|
|||
* @param modifier A [Modifier] that you can use to apply custom modifications to the composable.
|
||||
* @param description An optional description label to be displayed below the [label].
|
||||
* @param contentDescription A description of the switch's UI for accessibility purposes.
|
||||
* @param readOnly Disables the click functionality without modifying the other UI characteristics.
|
||||
*/
|
||||
@Composable
|
||||
fun BitwardenWideSwitch(
|
||||
|
@ -44,6 +45,7 @@ fun BitwardenWideSwitch(
|
|||
modifier: Modifier = Modifier,
|
||||
description: String? = null,
|
||||
contentDescription: String? = null,
|
||||
readOnly: Boolean = false,
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
|
@ -54,6 +56,7 @@ fun BitwardenWideSwitch(
|
|||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = rememberRipple(color = MaterialTheme.colorScheme.primary),
|
||||
onClick = { onCheckedChange?.invoke(!isChecked) },
|
||||
enabled = !readOnly,
|
||||
)
|
||||
.semantics(mergeDescendants = true) {
|
||||
toggleableState = ToggleableState(isChecked)
|
||||
|
|
|
@ -206,6 +206,18 @@ val nonMaterialTypography: NonMaterialTypography = NonMaterialTypography(
|
|||
),
|
||||
platformStyle = PlatformTextStyle(includeFontPadding = false),
|
||||
),
|
||||
labelMediumProminent = TextStyle(
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
fontFamily = FontFamily(Font(R.font.roboto_regular)),
|
||||
fontWeight = FontWeight.W600,
|
||||
letterSpacing = 0.5.sp,
|
||||
lineHeightStyle = LineHeightStyle(
|
||||
alignment = LineHeightStyle.Alignment.Center,
|
||||
trim = LineHeightStyle.Trim.None,
|
||||
),
|
||||
platformStyle = PlatformTextStyle(includeFontPadding = false),
|
||||
),
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -213,4 +225,5 @@ val nonMaterialTypography: NonMaterialTypography = NonMaterialTypography(
|
|||
*/
|
||||
data class NonMaterialTypography(
|
||||
val fingerprint: TextStyle,
|
||||
val labelMediumProminent: TextStyle,
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue