The second Android 11 Developer Preview is now available, test it out and share your feedback.

PasswordVisualTransformation

class PasswordVisualTransformation : VisualTransformation
kotlin.Any
   ↳ androidx.ui.input.PasswordVisualTransformation

The Visual Filter can be used for password Input Field.

Note that this visual filter only works for ASCII characters.

Summary

Public constructors

<init>(mask: Char = '\u2022')

The Visual Filter can be used for password Input Field.

Public methods

TransformedText

Change the visual output of given text.

Properties

Char

The mask character used instead of original text.

Public constructors

<init>

PasswordVisualTransformation(mask: Char = '\u2022')

The Visual Filter can be used for password Input Field.

Note that this visual filter only works for ASCII characters.

Parameters
mask: Char = '\u2022' The mask character used instead of original text.

Public methods

filter

fun filter(text: AnnotatedString): TransformedText

Change the visual output of given text.

Note that the returned text length can be different length from the given text. The composable will call the offset translator for converting offsets for various reasons, cursor drawing position, text selection by gesture, etc.

Example: The ASCII only password (replacing with '*' chars) original text : thisispassword transformed text: **************


//Unresolved: androidx.ui.text.samples.passwordFilter
Example: Credit Card Visual Output (inserting hyphens each 4 digits)original text : 1234567890123456transformed text: 1234-5678-9012-3456

//Unresolved: androidx.ui.text.samples.creditCardFilter
Parameters
text: AnnotatedString The original text
Return
the pair of filtered text and offset translator.

Properties

mask

val mask: Char

The mask character used instead of original text.