prevent NPE in afterTextChanged
This commit is contained in:
parent
8b41abb388
commit
bf3d15f9be
|
@ -385,7 +385,7 @@ class AutotuneFragment : DaggerFragment() {
|
|||
|
||||
private val textWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
updateGui()
|
||||
_binding?.let { updateGui() }
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
|
|
|
@ -72,7 +72,9 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
|
||||
private val textWatcher: TextWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
validateInputs()
|
||||
_binding?.let {
|
||||
validateInputs()
|
||||
}
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
|
|
|
@ -80,7 +80,9 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
|
||||
private val textWatcher: TextWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
validateInputs()
|
||||
_binding?.let {
|
||||
validateInputs()
|
||||
}
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
|
|
|
@ -65,9 +65,11 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
|
||||
private val textWatcher: TextWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
val isDuration = binding.duration.value > 0
|
||||
val isLowerPercentage = binding.percentage.value < 100
|
||||
binding.ttLayout.visibility = (isDuration && isLowerPercentage).toVisibility()
|
||||
_binding?.let { binding ->
|
||||
val isDuration = binding.duration.value > 0
|
||||
val isLowerPercentage = binding.percentage.value < 100
|
||||
binding.ttLayout.visibility = (isDuration && isLowerPercentage).toVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
|
|
|
@ -103,7 +103,9 @@ class WizardDialog : DaggerDialogFragment() {
|
|||
|
||||
private val timeTextWatcher = object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
binding.alarm.isChecked = binding.carbTimeInput.value > 0
|
||||
_binding?.let { binding ->
|
||||
binding.alarm.isChecked = binding.carbTimeInput.value > 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
|
|
Loading…
Reference in a new issue