Created
March 3, 2024 11:22
-
-
Save khaledahmedelsayed/43ce1ebbcb0eff61066e716bf02680ce to your computer and use it in GitHub Desktop.
NoFilterArrayAdapter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.widget.ArrayAdapter | |
import android.widget.Filter | |
import androidx.annotation.LayoutRes | |
open class NoFilterArrayAdapter<T>(context: Context, @LayoutRes resource: Int, items: List<T>) : | |
ArrayAdapter<T>(context, resource, items) { | |
override fun getFilter(): Filter { | |
return object : Filter() { | |
override fun performFiltering(constraint: CharSequence?): FilterResults? { | |
return null | |
} | |
override fun publishResults(constraint: CharSequence?, results: FilterResults?) { | |
// NO-OP | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment