From a62fa7dd8e93dfb06bf3c8075d6449d4b1d80397 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 21 Aug 2017 23:56:24 +0200 Subject: [PATCH] append the caldav account email after the eventtype --- .../calendar/activities/SettingsActivity.kt | 7 ++++--- .../com/simplemobiletools/calendar/helpers/DBHelper.kt | 2 +- app/src/main/res/layout/activity_event.xml | 4 +++- app/src/main/res/layout/filter_event_type_view.xml | 5 ++++- app/src/main/res/layout/item_event_type.xml | 4 +++- app/src/main/res/layout/radio_button_with_color.xml | 2 ++ 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt index 026dd9bfd..12cbeafa6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -144,9 +144,10 @@ class SettingsActivity : SimpleActivity() { if (newCalendarIds.isNotEmpty()) { val existingEventTypeNames = dbHelper.fetchEventTypes().map { it.title.toLowerCase() } as ArrayList getSyncedCalDAVCalendars().forEach { - if (!existingEventTypeNames.contains(it.displayName.toLowerCase())) { - val eventType = EventType(0, it.displayName, it.color, it.id) - existingEventTypeNames.add(it.displayName.toLowerCase()) + val eventTypeTitle = "${it.displayName} (${it.accountName})" + if (!existingEventTypeNames.contains(eventTypeTitle.toLowerCase())) { + val eventType = EventType(0, eventTypeTitle, it.color, it.id) + existingEventTypeNames.add(eventTypeTitle.toLowerCase()) dbHelper.insertEventType(eventType) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index a9e46df4d..3214e507c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -773,7 +773,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont } fun fetchEventTypes(): ArrayList { - val eventTypes = ArrayList(3) + val eventTypes = ArrayList(4) val cols = arrayOf(COL_TYPE_ID, COL_TYPE_TITLE, COL_TYPE_COLOR) var cursor: Cursor? = null try { diff --git a/app/src/main/res/layout/activity_event.xml b/app/src/main/res/layout/activity_event.xml index 4a493603a..f7f0e6638 100644 --- a/app/src/main/res/layout/activity_event.xml +++ b/app/src/main/res/layout/activity_event.xml @@ -413,10 +413,12 @@ diff --git a/app/src/main/res/layout/filter_event_type_view.xml b/app/src/main/res/layout/filter_event_type_view.xml index 14091e41f..c4c1a1c34 100644 --- a/app/src/main/res/layout/filter_event_type_view.xml +++ b/app/src/main/res/layout/filter_event_type_view.xml @@ -9,8 +9,10 @@ @@ -20,6 +22,7 @@ android:layout_height="@dimen/color_sample_size" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" + android:layout_centerVertical="true" android:layout_marginEnd="@dimen/medium_margin" android:layout_marginRight="@dimen/medium_margin" android:clickable="false"/> diff --git a/app/src/main/res/layout/item_event_type.xml b/app/src/main/res/layout/item_event_type.xml index 910f2f5b4..d2419fae7 100644 --- a/app/src/main/res/layout/item_event_type.xml +++ b/app/src/main/res/layout/item_event_type.xml @@ -16,9 +16,10 @@ @@ -29,6 +30,7 @@ android:layout_height="@dimen/color_sample_size" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" + android:layout_centerVertical="true" android:layout_marginEnd="@dimen/medium_margin" android:layout_marginRight="@dimen/medium_margin" android:clickable="false"/> diff --git a/app/src/main/res/layout/radio_button_with_color.xml b/app/src/main/res/layout/radio_button_with_color.xml index 7bdafd4da..581daf2a9 100644 --- a/app/src/main/res/layout/radio_button_with_color.xml +++ b/app/src/main/res/layout/radio_button_with_color.xml @@ -9,6 +9,8 @@ android:id="@+id/dialog_radio_button" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginRight="@dimen/medium_margin" + android:layout_toLeftOf="@+id/dialog_radio_color" android:clickable="false" android:paddingBottom="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"/>