Skip to content

Commit

Permalink
fix autocomplete filtering
Browse files Browse the repository at this point in the history
(cherry picked from commit 1db1fb2)
  • Loading branch information
crackededed committed Mar 25, 2024
1 parent 1df84e2 commit 4c47a98
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ android {
applicationId = "com.github.andreyasadchy.xtra"
minSdk = 21
targetSdk = 34
versionCode = 232
versionName = "2.30.5"
versionCode = 233
versionName = "2.30.6"
resourceConfigurations += listOf("ar", "de", "en", "es", "fr", "in", "it", "ja", "pt-rBR", "ru", "tr", "zh-rTW", "zh-rCN")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,26 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.github.andreyasadchy.xtra.R
import com.github.andreyasadchy.xtra.databinding.ViewChatBinding
import com.github.andreyasadchy.xtra.model.chat.*
import com.github.andreyasadchy.xtra.model.chat.ChatMessage
import com.github.andreyasadchy.xtra.model.chat.Chatter
import com.github.andreyasadchy.xtra.model.chat.CheerEmote
import com.github.andreyasadchy.xtra.model.chat.Emote
import com.github.andreyasadchy.xtra.model.chat.TwitchBadge
import com.github.andreyasadchy.xtra.ui.common.ChatAdapter
import com.github.andreyasadchy.xtra.ui.view.SlidingLayout
import com.github.andreyasadchy.xtra.util.*
import com.github.andreyasadchy.xtra.util.C
import com.github.andreyasadchy.xtra.util.TwitchApiHelper
import com.github.andreyasadchy.xtra.util.chat.Raid
import com.github.andreyasadchy.xtra.util.chat.RoomState
import com.github.andreyasadchy.xtra.util.convertDpToPixels
import com.github.andreyasadchy.xtra.util.gone
import com.github.andreyasadchy.xtra.util.hideKeyboard
import com.github.andreyasadchy.xtra.util.isLightTheme
import com.github.andreyasadchy.xtra.util.loadImage
import com.github.andreyasadchy.xtra.util.prefs
import com.github.andreyasadchy.xtra.util.reduceDragSensitivity
import com.github.andreyasadchy.xtra.util.toggleVisibility
import com.github.andreyasadchy.xtra.util.visible
import com.google.android.material.tabs.TabLayoutMediator
import kotlinx.android.extensions.LayoutContainer
import java.util.regex.Pattern
Expand Down Expand Up @@ -520,13 +534,13 @@ class ChatView : ConstraintLayout {
private inner class ArrayFilter : Filter() {
override fun performFiltering(prefix: CharSequence?): FilterResults {
val results = FilterResults()
val list = autoCompleteList.toList()
val originalValuesField = ArrayAdapter::class.java.getDeclaredField("mOriginalValues")
originalValuesField.isAccessible = true
val originalValues = originalValuesField.get(this@AutoCompleteAdapter) as List<*>?
if (originalValues == null) {
originalValuesField.set(this@AutoCompleteAdapter, list)
originalValuesField.set(this@AutoCompleteAdapter, autoCompleteList.toList())
}
val list = originalValues ?: autoCompleteList.toList()
if (prefix.isNullOrEmpty()) {
results.values = list
results.count = list.size
Expand Down

0 comments on commit 4c47a98

Please sign in to comment.