From 979f463e97e243bf379d2c19955bb5bfbca4dd7f Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 14 Mar 2019 21:09:53 +0100 Subject: [PATCH] figure out which attendee has been picked by clicking on a suggestion --- .../calendar/pro/activities/EventActivity.kt | 5 +++++ .../calendar/pro/adapters/AutoCompleteTextViewAdapter.kt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index bfba5d654..9efb38efc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -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?) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/AutoCompleteTextViewAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/AutoCompleteTextViewAdapter.kt index 5205d11ea..34ef234dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/AutoCompleteTextViewAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/AutoCompleteTextViewAdapter.kt @@ -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) : ArrayAdapter(activity, 0, contacts) { - private var resultList = ArrayList() + var resultList = ArrayList() private var placeholder = activity.resources.getDrawable(R.drawable.attendee_circular_background) init {