I am having a password field which is OutlinedTextField, I want to restrict the user from copying/ Pasting (or) Both of the value that they provided in the filed, below is my code kindly let me know how to approach on this
val passwordFieldValue = remember { mutableStateOf("") }
OutlinedTextField(
modifier = Modifier
.padding(bottom = 32.dp)
.fillMaxWidth()
.semantics {
contentDescription = context.getString(R.string.password_login)
},
value = passwordFieldValue.value,
textStyle = TextStyle(
color = colorResource(id = R.color.text_field_grey),
fontSize = 16.sp,
fontFamily = robotoFont,
fontWeight = FontWeight.Normal
),
enabled = !isInternetError.value && !isSyncError.value && !loginViewModel.loginState.value.isLoading,
singleLine = true,
onValueChange = {
loginViewModel.loginState.value.hasError = false
isLoginError.value = false
passwordFieldValue.value = it
},
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Password
),
keyboardActions = KeyboardActions(onDone = {
keyboardController?.hide()
if(userNameFieldValue.value.isNotEmpty() && passwordFieldValue.value.isNotEmpty() && !isInternetError.value && !isSyncError.value) {
userTapAction(
Pair(userNameFieldValue.value, passwordFieldValue.value),
context.getString(R.string.login_btn_action)
)
}
}),
label = { Text(text = stringResource(id = R.string.password)) }
})