append the caldav account email after the eventtype

This commit is contained in:
tibbi
2017-08-21 23:56:24 +02:00
parent 2c36d51536
commit a62fa7dd8e
6 changed files with 17 additions and 7 deletions

View File

@@ -144,9 +144,10 @@ class SettingsActivity : SimpleActivity() {
if (newCalendarIds.isNotEmpty()) { if (newCalendarIds.isNotEmpty()) {
val existingEventTypeNames = dbHelper.fetchEventTypes().map { it.title.toLowerCase() } as ArrayList<String> val existingEventTypeNames = dbHelper.fetchEventTypes().map { it.title.toLowerCase() } as ArrayList<String>
getSyncedCalDAVCalendars().forEach { getSyncedCalDAVCalendars().forEach {
if (!existingEventTypeNames.contains(it.displayName.toLowerCase())) { val eventTypeTitle = "${it.displayName} (${it.accountName})"
val eventType = EventType(0, it.displayName, it.color, it.id) if (!existingEventTypeNames.contains(eventTypeTitle.toLowerCase())) {
existingEventTypeNames.add(it.displayName.toLowerCase()) val eventType = EventType(0, eventTypeTitle, it.color, it.id)
existingEventTypeNames.add(eventTypeTitle.toLowerCase())
dbHelper.insertEventType(eventType) dbHelper.insertEventType(eventType)
} }
} }

View File

@@ -773,7 +773,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
} }
fun fetchEventTypes(): ArrayList<EventType> { fun fetchEventTypes(): ArrayList<EventType> {
val eventTypes = ArrayList<EventType>(3) val eventTypes = ArrayList<EventType>(4)
val cols = arrayOf(COL_TYPE_ID, COL_TYPE_TITLE, COL_TYPE_COLOR) val cols = arrayOf(COL_TYPE_ID, COL_TYPE_TITLE, COL_TYPE_COLOR)
var cursor: Cursor? = null var cursor: Cursor? = null
try { try {

View File

@@ -413,10 +413,12 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_type" android:id="@+id/event_type"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/small_margin" android:layout_marginLeft="@dimen/small_margin"
android:layout_marginRight="@dimen/medium_margin"
android:layout_marginStart="@dimen/small_margin" android:layout_marginStart="@dimen/small_margin"
android:layout_toLeftOf="@+id/event_type_color"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:textSize="@dimen/day_text_size"/> android:textSize="@dimen/day_text_size"/>

View File

@@ -9,8 +9,10 @@
<com.simplemobiletools.commons.views.MyAppCompatCheckbox <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/filter_event_type_checkbox" android:id="@+id/filter_event_type_checkbox"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/medium_margin"
android:layout_toLeftOf="@+id/filter_event_type_color"
android:clickable="false" android:clickable="false"
android:paddingLeft="@dimen/small_margin"/> android:paddingLeft="@dimen/small_margin"/>
@@ -20,6 +22,7 @@
android:layout_height="@dimen/color_sample_size" android:layout_height="@dimen/color_sample_size"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/medium_margin" android:layout_marginEnd="@dimen/medium_margin"
android:layout_marginRight="@dimen/medium_margin" android:layout_marginRight="@dimen/medium_margin"
android:clickable="false"/> android:clickable="false"/>

View File

@@ -16,9 +16,10 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_type_title" android:id="@+id/event_type_title"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/event_type_color"
android:paddingLeft="@dimen/medium_margin" android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingRight="@dimen/medium_margin"
android:text="@string/text_color"/> android:text="@string/text_color"/>
@@ -29,6 +30,7 @@
android:layout_height="@dimen/color_sample_size" android:layout_height="@dimen/color_sample_size"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/medium_margin" android:layout_marginEnd="@dimen/medium_margin"
android:layout_marginRight="@dimen/medium_margin" android:layout_marginRight="@dimen/medium_margin"
android:clickable="false"/> android:clickable="false"/>

View File

@@ -9,6 +9,8 @@
android:id="@+id/dialog_radio_button" android:id="@+id/dialog_radio_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/medium_margin"
android:layout_toLeftOf="@+id/dialog_radio_color"
android:clickable="false" android:clickable="false"
android:paddingBottom="@dimen/activity_margin" android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"/> android:paddingTop="@dimen/activity_margin"/>