mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
review fixes
This commit is contained in:
parent
e68da85df2
commit
d103a72f50
1 changed files with 7 additions and 6 deletions
|
@ -148,6 +148,11 @@ class LibraryFragment : Fragment() {
|
|||
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
|
||||
searchExitIcon?.setColorFilter(searchExitIconColor.data)
|
||||
|
||||
val searchCallback = Runnable {
|
||||
val newText = binding?.mainSearch?.query?.toString() ?: return@Runnable
|
||||
libraryViewModel.sort(ListSorting.Query, newText)
|
||||
}
|
||||
|
||||
binding?.mainSearch?.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String?): Boolean {
|
||||
libraryViewModel.sort(ListSorting.Query, query)
|
||||
|
@ -164,15 +169,11 @@ class LibraryFragment : Fragment() {
|
|||
return true
|
||||
}
|
||||
|
||||
val callback = Runnable {
|
||||
libraryViewModel.sort(ListSorting.Query, newText)
|
||||
}
|
||||
|
||||
binding?.mainSearch?.removeCallbacks(callback)
|
||||
binding?.mainSearch?.removeCallbacks(searchCallback)
|
||||
|
||||
// Delay the execution of the search operation by 1 second (adjust as needed)
|
||||
// this prevents running search when the user is typing
|
||||
binding?.mainSearch?.postDelayed(callback, 1000)
|
||||
binding?.mainSearch?.postDelayed(searchCallback, 1000)
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue