add hashtag tabs (#1145)

* add hashtag tabs

* address review feedback
This commit is contained in:
Konrad Pozniak 2019-03-24 08:59:55 +01:00 committed by GitHub
commit 0c48dcf06c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 209 additions and 58 deletions

View file

@ -34,20 +34,20 @@ fun View.visible(visible: Boolean, or: Int = View.GONE) {
}
open class DefaultTextWatcher : TextWatcher {
override fun afterTextChanged(s: Editable?) {
override fun afterTextChanged(s: Editable) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
}
}
inline fun EditText.onTextChanged(
crossinline callback: (s: CharSequence?, start: Int, before: Int, count: Int) -> Unit) {
crossinline callback: (s: CharSequence, start: Int, before: Int, count: Int) -> Unit) {
addTextChangedListener(object : DefaultTextWatcher() {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
callback(s, start, before, count)
}
})