From 4d56cfd8735ed88b78c3498d60e7a0874d9c105f Mon Sep 17 00:00:00 2001 From: Gabriel <69007475+Friendly-Banana@users.noreply.github.com> Date: Thu, 16 Oct 2025 18:43:03 +0200 Subject: [PATCH 1/3] add autocomplete for location --- .../calendar/activities/EventActivity.kt | 12 +++++++-- .../fossify/calendar/interfaces/EventsDao.kt | 3 +++ app/src/main/res/layout/activity_event.xml | 2 +- app/src/main/res/layout/item_dropdown.xml | 26 +++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/layout/item_dropdown.xml 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 61381123c..a0a2bd24a 100644 --- a/app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt @@ -18,6 +18,7 @@ import android.text.method.LinkMovementMethod import android.view.View import android.view.WindowManager import android.view.inputmethod.EditorInfo +import android.widget.ArrayAdapter import android.widget.ImageView import android.widget.RelativeLayout import androidx.core.graphics.drawable.toDrawable @@ -229,8 +230,13 @@ class EventActivity : SimpleActivity() { val eventId = intent.getLongExtra(EVENT_ID, 0L) ensureBackgroundThread { - mStoredCalendars = - calendarsDB.getCalendars().toMutableList() as ArrayList + val locations = eventsDB.getAllLocations() + + runOnUiThread { + val adapter = ArrayAdapter(this, R.layout.item_dropdown, locations) + binding.eventLocation.setAdapter(adapter) + } + val event = eventsDB.getEventWithId(eventId) if (eventId != 0L && event == null) { hideKeyboard() @@ -238,6 +244,8 @@ class EventActivity : SimpleActivity() { return@ensureBackgroundThread } + mStoredCalendars = + calendarsDB.getCalendars().toMutableList() as ArrayList val localCalendar = mStoredCalendars.firstOrNull { it.id == config.lastUsedLocalCalendarId } runOnUiThread { diff --git a/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt b/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt index 788a1e7e8..459ec96d3 100644 --- a/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt +++ b/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt @@ -19,6 +19,9 @@ interface EventsDao { @Query("SELECT * FROM events WHERE type = $TYPE_TASK") fun getAllTasks(): List + @Query("SELECT DISTINCT location FROM events") + fun getAllLocations(): List + @Query("SELECT * FROM events WHERE event_type IN (:calendarIds) AND type = $TYPE_EVENT") fun getAllEventsWithCalendarIds(calendarIds: List): List diff --git a/app/src/main/res/layout/activity_event.xml b/app/src/main/res/layout/activity_event.xml index 482836a03..0218c4e20 100644 --- a/app/src/main/res/layout/activity_event.xml +++ b/app/src/main/res/layout/activity_event.xml @@ -50,7 +50,7 @@ android:textCursorDrawable="@null" android:textSize="@dimen/day_text_size" /> - + + + From fd802c9f1fdd9fb6f225b6f83e43800866995158 Mon Sep 17 00:00:00 2001 From: Gabriel <69007475+Friendly-Banana@users.noreply.github.com> Date: Wed, 31 Dec 2025 14:13:54 +0100 Subject: [PATCH 2/3] Sort locations Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com> --- .../main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt b/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt index 459ec96d3..0f2b13863 100644 --- a/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt +++ b/app/src/main/kotlin/org/fossify/calendar/interfaces/EventsDao.kt @@ -19,7 +19,7 @@ interface EventsDao { @Query("SELECT * FROM events WHERE type = $TYPE_TASK") fun getAllTasks(): List - @Query("SELECT DISTINCT location FROM events") + @Query("SELECT DISTINCT location FROM events ORDER BY location COLLATE NOCASE") fun getAllLocations(): List @Query("SELECT * FROM events WHERE event_type IN (:calendarIds) AND type = $TYPE_EVENT") From dd6ee057c93b386b369c57c3e59d669ceda8fb00 Mon Sep 17 00:00:00 2001 From: Gabriel <69007475+Friendly-Banana@users.noreply.github.com> Date: Wed, 31 Dec 2025 14:14:37 +0100 Subject: [PATCH 3/3] use the Fossify implementation so proper colors are used in all themes Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com> --- app/src/main/res/layout/activity_event.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_event.xml b/app/src/main/res/layout/activity_event.xml index 0218c4e20..77b6376b4 100644 --- a/app/src/main/res/layout/activity_event.xml +++ b/app/src/main/res/layout/activity_event.xml @@ -50,7 +50,7 @@ android:textCursorDrawable="@null" android:textSize="@dimen/day_text_size" /> -