figure out which attendee has been picked by clicking on a suggestion

This commit is contained in:
tibbi 2019-03-14 21:09:53 +01:00
parent fa2cf07211
commit 979f463e97
2 changed files with 6 additions and 1 deletions

View File

@ -1170,12 +1170,17 @@ class EventActivity : SimpleActivity() {
event_attendees_holder.addView(attendeeHolder)
attendeeHolder.event_attendee.setColors(config.textColor, getAdjustedPrimaryColor(), config.backgroundColor)
if (value != null) {
attendeeHolder.event_attendee.setText(value)
}
val adapter = AutoCompleteTextViewAdapter(this, mAvailableContacts)
attendeeHolder.event_attendee.setAdapter(adapter)
attendeeHolder.event_attendee.setOnItemClickListener { parent, view, position, id ->
val currAttendees = (attendeeHolder.event_attendee.adapter as AutoCompleteTextViewAdapter).resultList
val selectedAttendee = currAttendees[position]
}
}
private fun checkNewAttendeeField(value: String?) {

View File

@ -19,7 +19,7 @@ import com.simplemobiletools.commons.extensions.normalizeString
import kotlinx.android.synthetic.main.item_autocomplete_email_name.view.*
class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: ArrayList<Attendee>) : ArrayAdapter<Attendee>(activity, 0, contacts) {
private var resultList = ArrayList<Attendee>()
var resultList = ArrayList<Attendee>()
private var placeholder = activity.resources.getDrawable(R.drawable.attendee_circular_background)
init {