Skip to content

Commit

Permalink
Restore the filtering to the original structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Dec 12, 2024
1 parent 7272572 commit 8309e5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
compileSdk 35
minSdk 21
targetSdk 35
versionName "4.2.8"
versionName "4.2.9"
versionCode = versionName.replace(".","").toInteger() * 10

vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,24 +164,23 @@ class FoomiiboAdapter(

inner class FoomiiboFilter : Filter() {
override fun performFiltering(constraint: CharSequence?): FilterResults {
val query = constraint?.trim { it <= ' ' }?.toString()
val query = constraint?.toString() ?: ""
val filterResults = FilterResults()
if (query.isNullOrBlank()) {
if (query.trim { it <= ' ' }.isEmpty()) {
filterResults.count = data.size
filterResults.values = data
} else {
settings.query = query
settings.amiiboManager?.let {
data = ArrayList(it.amiibos.values)
} ?: data.clear()
val tempList: ArrayList<Amiibo> = arrayListOf()
val queryText = query.trim { it <= ' ' }.lowercase(Locale.getDefault())
data.forEach {
if (settings.amiiboContainsQuery(it, queryText)) tempList.add(it)
}
filterResults.count = tempList.size
filterResults.values = tempList
}
settings.query = query
settings.amiiboManager?.let {
data = ArrayList(it.amiibos.values)
} ?: data.clear()
val tempList: ArrayList<Amiibo> = arrayListOf()
val queryText = query.trim { it <= ' ' }.lowercase(Locale.getDefault())
data.forEach {
if (settings.amiiboContainsQuery(it, queryText)) tempList.add(it)
}
filterResults.count = tempList.size
filterResults.values = tempList
return filterResults
}

Expand Down

0 comments on commit 8309e5f

Please sign in to comment.