From d8e2a774e3f044fc344eae238c6fef75fd3543c5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 23 May 2020 18:38:36 +0200 Subject: [PATCH] fix #34, allow adding new people to a conversation --- .../smsmessenger/activities/ThreadActivity.kt | 2 +- .../smsmessenger/adapters/AutoCompleteTextViewAdapter.kt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index c36d4a6a..51b902b4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -238,7 +238,7 @@ class ThreadActivity : SimpleActivity() { } } - confirm_inserted_number.setOnClickListener { + confirm_inserted_number?.setOnClickListener { val number = add_contact_or_number.value val contact = SimpleContact(number.hashCode(), number.hashCode(), number, "", number) addSelectedContact(contact) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt index 75611076..68c38b7f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AutoCompleteTextViewAdapter.kt @@ -13,7 +13,6 @@ import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.activities.SimpleActivity class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList) : ArrayAdapter(activity, 0, contacts) { - var resultList = ArrayList() override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { @@ -25,6 +24,12 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar listItem!!.apply { tag = contact.name.isNotEmpty() + // clickable and focusable properties seem to break Autocomplete clicking, so remove them + findViewById(R.id.item_contact_frame).apply { + isClickable = false + isFocusable = false + } + findViewById(R.id.item_contact_name).text = contact.name findViewById(R.id.item_contact_number).text = contact.phoneNumber