Refactored inputTypeExceptions
This commit is contained in:
parent
a7f194793d
commit
b97fa7b0e8
1 changed files with 10 additions and 6 deletions
|
@ -12,6 +12,14 @@ enum class ShiftState {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val MIN_TEXT_LENGTH = 2
|
private const val MIN_TEXT_LENGTH = 2
|
||||||
|
private val inputTypeExceptions = listOf(
|
||||||
|
InputType.TYPE_TEXT_VARIATION_PASSWORD,
|
||||||
|
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
|
||||||
|
InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD,
|
||||||
|
InputType.TYPE_NUMBER_VARIATION_PASSWORD,
|
||||||
|
InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS,
|
||||||
|
InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
|
||||||
|
)
|
||||||
private val endOfSentenceChars: List<Char> = listOf('.', '?', '!')
|
private val endOfSentenceChars: List<Char> = listOf('.', '?', '!')
|
||||||
|
|
||||||
fun getDefaultShiftState(context: Context, inputTypeClassVariation: Int): ShiftState {
|
fun getDefaultShiftState(context: Context, inputTypeClassVariation: Int): ShiftState {
|
||||||
|
@ -32,6 +40,7 @@ enum class ShiftState {
|
||||||
shouldCapitalize(context, text) -> {
|
shouldCapitalize(context, text) -> {
|
||||||
ON_ONE_CHAR
|
ON_ONE_CHAR
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
OFF
|
OFF
|
||||||
}
|
}
|
||||||
|
@ -63,12 +72,7 @@ enum class ShiftState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isInputTypePasswordOrEmail(inputTypeVariation: Int): Boolean {
|
fun isInputTypePasswordOrEmail(inputTypeVariation: Int): Boolean {
|
||||||
return inputTypeVariation == InputType.TYPE_TEXT_VARIATION_PASSWORD
|
return inputTypeVariation in inputTypeExceptions
|
||||||
|| inputTypeVariation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
|
|
||||||
|| inputTypeVariation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD
|
|
||||||
|| inputTypeVariation == InputType.TYPE_NUMBER_VARIATION_PASSWORD
|
|
||||||
|| inputTypeVariation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
|
||||||
|| inputTypeVariation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue