1
0
Fork 0

FNX2-15653:Refactors check method

master
bawyap 2020-08-20 14:53:26 +05:30 committed by liuche
parent b57601df1e
commit fb02b8a314
1 changed files with 6 additions and 4 deletions

View File

@ -58,12 +58,14 @@ class CreateShortcutFragment : DialogFragment() {
}
private fun updateAddButtonEnabledState() {
val text = shortcut_text.text
add_button.isEnabled = isTextValid(text)
add_button.alpha = if (isTextValid(text)) ENABLED_ALPHA else DISABLED_ALPHA
add_button.isEnabled = isTextValid()
add_button.alpha = if (isTextValid()) ENABLED_ALPHA else DISABLED_ALPHA
}
private fun isTextValid(text: Editable) = text.isNotEmpty() && !text.isBlank()
private fun isTextValid(): Boolean {
val text = shortcut_text.text
return text.isNotEmpty() && !text.isBlank()
}
companion object {
private const val ENABLED_ALPHA = 1.0f