mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
Rename AutoFill
to AutoComplete
This commit is contained in:
@ -259,7 +259,7 @@ class EditContactActivity : ContactActivity() {
|
|||||||
|
|
||||||
val nameTextViews = arrayOf(contact_first_name, contact_middle_name, contact_surname).filter { it.isVisible() }
|
val nameTextViews = arrayOf(contact_first_name, contact_middle_name, contact_surname).filter { it.isVisible() }
|
||||||
if (nameTextViews.isNotEmpty()) {
|
if (nameTextViews.isNotEmpty()) {
|
||||||
setupAutofill(nameTextViews)
|
setupAutoComplete(nameTextViews)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTextColors(contact_scrollview)
|
updateTextColors(contact_scrollview)
|
||||||
@ -1535,7 +1535,7 @@ class EditContactActivity : ContactActivity() {
|
|||||||
else -> Im.PROTOCOL_CUSTOM
|
else -> Im.PROTOCOL_CUSTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupAutofill(nameTextViews: List<MyAutoCompleteTextView>) {
|
private fun setupAutoComplete(nameTextViews: List<MyAutoCompleteTextView>) {
|
||||||
ContactsHelper(this).getContacts { contacts ->
|
ContactsHelper(this).getContacts { contacts ->
|
||||||
val adapter = AutoCompleteTextViewAdapter(this, contacts)
|
val adapter = AutoCompleteTextViewAdapter(this, contacts)
|
||||||
val handler = Handler(mainLooper)
|
val handler = Handler(mainLooper)
|
||||||
@ -1556,7 +1556,7 @@ class EditContactActivity : ContactActivity() {
|
|||||||
}
|
}
|
||||||
view.doAfterTextChanged {
|
view.doAfterTextChanged {
|
||||||
handler.postDelayed({
|
handler.postDelayed({
|
||||||
adapter.enableAutoFill = true
|
adapter.autoComplete = true
|
||||||
adapter.filter.filter(it)
|
adapter.filter.filter(it)
|
||||||
}, AUTO_FILL_DELAY)
|
}, AUTO_FILL_DELAY)
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import kotlinx.android.synthetic.main.item_autocomplete_name_number.view.item_au
|
|||||||
class AutoCompleteTextViewAdapter(
|
class AutoCompleteTextViewAdapter(
|
||||||
val activity: SimpleActivity,
|
val activity: SimpleActivity,
|
||||||
val contacts: ArrayList<Contact>,
|
val contacts: ArrayList<Contact>,
|
||||||
var enableAutoFill: Boolean = false
|
var autoComplete: Boolean = false
|
||||||
) : ArrayAdapter<Contact>(activity, 0, contacts) {
|
) : ArrayAdapter<Contact>(activity, 0, contacts) {
|
||||||
var resultList = ArrayList<Contact>()
|
var resultList = ArrayList<Contact>()
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class AutoCompleteTextViewAdapter(
|
|||||||
val filterResults = FilterResults()
|
val filterResults = FilterResults()
|
||||||
if (constraint != null) {
|
if (constraint != null) {
|
||||||
resultList.clear()
|
resultList.clear()
|
||||||
if (enableAutoFill) {
|
if (autoComplete) {
|
||||||
val searchString = constraint.toString().normalizeString()
|
val searchString = constraint.toString().normalizeString()
|
||||||
contacts.forEach {
|
contacts.forEach {
|
||||||
if (it.getNameToDisplay().contains(searchString, true)) {
|
if (it.getNameToDisplay().contains(searchString, true)) {
|
||||||
|
Reference in New Issue
Block a user