Update NDK, more KTX usage (#4792)

* Update NDK

* Utilize more KTX extensions
This commit is contained in:
Taco
2021-04-08 17:56:01 -04:00
committed by GitHub
parent b2d697131c
commit b3471234ad
6 changed files with 17 additions and 34 deletions

View File

@@ -6,6 +6,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import androidx.core.widget.doOnTextChanged
import eu.kanade.tachiyomi.databinding.DownloadCustomAmountBinding
import timber.log.Timber
@@ -65,16 +66,14 @@ class DialogCustomDownloadView @JvmOverloads constructor(context: Context, attrs
}
// When user inputs custom number set amount equal to input.
binding.myNumber.addTextChangedListener(object : SimpleTextWatcher() {
override fun onTextChanged(text: CharSequence, start: Int, before: Int, count: Int) {
try {
amount = getAmount(text.toString().toInt())
} catch (error: NumberFormatException) {
// Catch NumberFormatException to prevent parse exception when input is empty.
Timber.e(error)
}
binding.myNumber.doOnTextChanged { text, _, _, _ ->
try {
amount = getAmount(text.toString().toInt())
} catch (error: NumberFormatException) {
// Catch NumberFormatException to prevent parse exception when input is empty.
Timber.e(error)
}
})
}
}
/**

View File

@@ -1,15 +0,0 @@
package eu.kanade.tachiyomi.widget
import android.text.Editable
import android.text.TextWatcher
open class SimpleTextWatcher : TextWatcher {
override fun beforeTextChanged(text: CharSequence, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(text: CharSequence, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(text: Editable) {
}
}