Skip to content

Commit

Permalink
fix search problem
Browse files Browse the repository at this point in the history
  • Loading branch information
whp98 committed Jul 30, 2023
1 parent 81876f8 commit 55a7b75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/kotlin/com/aistra/hail/ui/home/PagerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.aistra.hail.utils.HPackages
import com.aistra.hail.utils.HShortcuts
import com.aistra.hail.utils.HUI
import com.aistra.hail.utils.NameComparator
import com.aistra.hail.utils.PinyinSearch
import com.aistra.hail.work.HWork
import com.google.android.material.color.MaterialColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
Expand Down Expand Up @@ -114,7 +115,10 @@ class PagerFragment : MainFragment(), PagerAdapter.OnItemClickListener,

private fun updateCurrentList() = HailData.checkedList.filter {
if (query.isEmpty()) it.tagId == tag.second
else it.packageName.contains(query, true) || it.name.contains(query, true)
else (it.packageName.contains(query, true)
|| it.name.contains(query, true)
|| PinyinSearch.searchCap(it.name.toString(), query)
|| PinyinSearch.searchAllSpell(it.name.toString(), query))
}.sortedWith(NameComparator).let {
binding.empty.isVisible = it.isEmpty()
pagerAdapter.submitList(it)
Expand Down

0 comments on commit 55a7b75

Please sign in to comment.