Fixed that validation label still got displayed even though there's no error or hint to display anymore
This commit is contained in:
parent
30f564a886
commit
873a9a537e
|
@ -49,7 +49,7 @@ ext {
|
|||
|
||||
fileChooserDialogVersion = "1.3.0-androidx"
|
||||
|
||||
androidUtilsVersion = '1.1.1-SNAPSHOT'
|
||||
androidUtilsVersion = '1.1.2'
|
||||
|
||||
fastAdapterVersion = "5.2.4"
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import net.dankito.utils.multiplatform.toBigDecimal
|
|||
import net.dankito.utils.android.extensions.asActivity
|
||||
import net.dankito.utils.android.extensions.getDimension
|
||||
import net.dankito.utils.android.extensions.getResourceIdentifier
|
||||
import net.dankito.utils.android.extensions.setVisibility
|
||||
import java.math.BigDecimal
|
||||
import java.text.DecimalFormatSymbols
|
||||
import java.util.*
|
||||
|
@ -478,14 +479,18 @@ open class TransferMoneyDialog : DialogFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
val showHintOrError = validationResult.validationError != null || validationResult.validationHint != null
|
||||
|
||||
val textInputErrorLayout = textInputLayout.getResourceIdentifier("textinput_error", "id")?.let { textInputErrorId -> textInputLayout.findViewById<View>(textInputErrorId)?.parent?.parent as? View }
|
||||
textInputErrorLayout?.setVisibility(showHintOrError)
|
||||
|
||||
textInputLayout.error = validationResult.validationError
|
||||
if (validationResult.validationError == null) { // don't overwrite error text
|
||||
textInputLayout.helperText = validationResult.validationHint
|
||||
}
|
||||
|
||||
(textInputLayout.layoutParams as? ViewGroup.MarginLayoutParams)?.let { params ->
|
||||
val isShowingHintOrError = validationResult.validationError != null || validationResult.validationHint != null
|
||||
params.bottomMargin = if (isShowingHintOrError == false || textInputLayout == lytReference) 0
|
||||
params.bottomMargin = if (showHintOrError == false || textInputLayout == lytReference) 0
|
||||
else context!!.getDimension(R.dimen.dialog_transfer_money_input_fields_bottom_margin_when_displaying_validation_label)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue