fix #34, allow adding new people to a conversation

This commit is contained in:
tibbi 2020-05-23 18:38:36 +02:00
parent 5ab95c00fd
commit d8e2a774e3
2 changed files with 7 additions and 2 deletions

View File

@ -238,7 +238,7 @@ class ThreadActivity : SimpleActivity() {
} }
} }
confirm_inserted_number.setOnClickListener { confirm_inserted_number?.setOnClickListener {
val number = add_contact_or_number.value val number = add_contact_or_number.value
val contact = SimpleContact(number.hashCode(), number.hashCode(), number, "", number) val contact = SimpleContact(number.hashCode(), number.hashCode(), number, "", number)
addSelectedContact(contact) addSelectedContact(contact)

View File

@ -13,7 +13,6 @@ import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.activities.SimpleActivity import com.simplemobiletools.smsmessenger.activities.SimpleActivity
class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList<SimpleContact>) : ArrayAdapter<SimpleContact>(activity, 0, contacts) { class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList<SimpleContact>) : ArrayAdapter<SimpleContact>(activity, 0, contacts) {
var resultList = ArrayList<SimpleContact>() var resultList = ArrayList<SimpleContact>()
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
@ -25,6 +24,12 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
listItem!!.apply { listItem!!.apply {
tag = contact.name.isNotEmpty() tag = contact.name.isNotEmpty()
// clickable and focusable properties seem to break Autocomplete clicking, so remove them
findViewById<View>(R.id.item_contact_frame).apply {
isClickable = false
isFocusable = false
}
findViewById<TextView>(R.id.item_contact_name).text = contact.name findViewById<TextView>(R.id.item_contact_name).text = contact.name
findViewById<TextView>(R.id.item_contact_number).text = contact.phoneNumber findViewById<TextView>(R.id.item_contact_number).text = contact.phoneNumber