kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Use TextView.doOnTextChanged() extension.
rodzic
293e2ff5e3
commit
03d99887c5
|
@ -3,9 +3,7 @@ package org.schabi.newpipe.local.subscription.dialog
|
|||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.text.Editable
|
||||
import android.text.TextUtils
|
||||
import android.text.TextWatcher
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -15,6 +13,7 @@ import androidx.core.content.getSystemService
|
|||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
@ -194,16 +193,11 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
|||
}
|
||||
|
||||
group_name_input_container.error = null
|
||||
group_name_input.addTextChangedListener(object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable?) {}
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
if (group_name_input_container.isErrorEnabled && !s.isNullOrBlank()) {
|
||||
group_name_input_container.error = null
|
||||
}
|
||||
group_name_input.doOnTextChanged { text, _, _, _ ->
|
||||
if (group_name_input_container.isErrorEnabled && !text.isNullOrBlank()) {
|
||||
group_name_input_container.error = null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
confirm_button.setOnClickListener { handlePositiveButton() }
|
||||
|
||||
|
@ -245,15 +239,11 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
|||
}
|
||||
}
|
||||
|
||||
toolbar_search_edit_text.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit
|
||||
override fun afterTextChanged(s: Editable) = Unit
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
val newQuery: String = toolbar_search_edit_text.text.toString()
|
||||
subscriptionsCurrentSearchQuery = newQuery
|
||||
viewModel.filterSubscriptionsBy(newQuery)
|
||||
}
|
||||
})
|
||||
toolbar_search_edit_text.doOnTextChanged { _, _, _, _ ->
|
||||
val newQuery: String = toolbar_search_edit_text.text.toString()
|
||||
subscriptionsCurrentSearchQuery = newQuery
|
||||
viewModel.filterSubscriptionsBy(newQuery)
|
||||
}
|
||||
|
||||
subscriptionGroupAdapter.setOnItemClickListener(subscriptionPickerItemListener)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue