diff --git a/app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt b/app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt index a0a2bd24a..f13f69c49 100644 --- a/app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt @@ -231,10 +231,46 @@ class EventActivity : SimpleActivity() { val eventId = intent.getLongExtra(EVENT_ID, 0L) ensureBackgroundThread { val locations = eventsDB.getAllLocations() + val eventTitleMap = eventsDB.getAllEvents() + .associateBy { it.title } as HashMap + binding.eventTitle.setOnItemClickListener { parent, view, position, id -> + val prev = eventTitleMap[parent.getItemAtPosition(position)] + binding.eventLocation.setText(prev!!.location) + binding.eventDescription.setText(prev.description) + + binding.eventAllDay.isChecked = prev.getIsAllDay() + mEventEndDateTime = mEventStartDateTime.plus(1000L * (prev.endTS - prev.startTS)) + + mReminder1Minutes = prev.reminder1Minutes + mReminder2Minutes = prev.reminder2Minutes + mReminder3Minutes = prev.reminder3Minutes + + mReminder1Type = prev.reminder1Type + mReminder2Type = prev.reminder2Type + mReminder3Type = prev.reminder3Type + + mAccessLevel = prev.accessLevel + mAvailability = prev.availability + mStatus = prev.status + mEventColor = prev.color + + mAttendees = prev.attendees as ArrayList + + mCalendarId = prev.calendarId + + checkRepeatTexts(mRepeatInterval) + checkRepeatRule() + updateTexts() + updateCalendar() + checkAttendees() + updateActionBarTitle() + } runOnUiThread { - val adapter = ArrayAdapter(this, R.layout.item_dropdown, locations) - binding.eventLocation.setAdapter(adapter) + val locationAdapter = ArrayAdapter(this, R.layout.item_dropdown, locations) + binding.eventLocation.setAdapter(locationAdapter) + val titleAdapter = ArrayAdapter(this, R.layout.item_dropdown, eventTitleMap.keys.toList()) + binding.eventTitle.setAdapter(titleAdapter) } val event = eventsDB.getEventWithId(eventId) diff --git a/app/src/main/res/layout/activity_event.xml b/app/src/main/res/layout/activity_event.xml index 77b6376b4..bcd9952e6 100644 --- a/app/src/main/res/layout/activity_event.xml +++ b/app/src/main/res/layout/activity_event.xml @@ -35,7 +35,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> -