add a caldav calendar selector at the new event activity

This commit is contained in:
tibbi 2017-08-17 14:35:18 +02:00
parent e447df141d
commit 4898311b0b
2 changed files with 93 additions and 17 deletions

View File

@ -74,6 +74,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
updateStartTexts() updateStartTexts()
updateEndTexts() updateEndTexts()
updateEventType() updateEventType()
updateCalDAVCalendar()
event_start_date.setOnClickListener { setupStartDate() } event_start_date.setOnClickListener { setupStartDate() }
event_start_time.setOnClickListener { setupStartTime() } event_start_time.setOnClickListener { setupStartTime() }
@ -382,6 +383,17 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
} }
} }
private fun updateCalDAVCalendar() {
if (config.caldavSync) {
event_caldav_calendar_image.beVisible()
event_caldav_calendar_holder.beVisible()
event_caldav_calendar_divider.beVisible()
event_caldav_calendar_holder.setOnClickListener {
}
}
}
private fun toggleAllDay(isChecked: Boolean) { private fun toggleAllDay(isChecked: Boolean) {
hideKeyboard() hideKeyboard()
event_start_time.beGoneIf(isChecked) event_start_time.beGoneIf(isChecked)
@ -639,6 +651,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
event_repetition_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) event_repetition_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
event_reminder_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) event_reminder_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
event_type_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) event_type_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
event_caldav_calendar_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
} }
override fun eventInserted(event: Event) { override fun eventInserted(event: Event) {

View File

@ -52,8 +52,8 @@
android:layout_below="@+id/event_description" android:layout_below="@+id/event_description"
android:layout_marginBottom="@dimen/normal_margin" android:layout_marginBottom="@dimen/normal_margin"
android:layout_marginTop="@dimen/activity_margin" android:layout_marginTop="@dimen/activity_margin"
android:importantForAccessibility="no" android:background="@color/darker_divider"
android:background="@color/darker_divider"/> android:importantForAccessibility="no"/>
<ImageView <ImageView
android:id="@+id/event_time_image" android:id="@+id/event_time_image"
@ -99,8 +99,8 @@
android:paddingEnd="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
tools:text="January 1 1970" android:textSize="@dimen/day_text_size"
android:textSize="@dimen/day_text_size"/> tools:text="January 1 1970"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_start_time" android:id="@+id/event_start_time"
@ -111,8 +111,8 @@
android:layout_below="@+id/event_time_image" android:layout_below="@+id/event_time_image"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin" android:padding="@dimen/activity_margin"
tools:text="00:00" android:textSize="@dimen/day_text_size"
android:textSize="@dimen/day_text_size"/> tools:text="00:00"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_end_date" android:id="@+id/event_end_date"
@ -126,8 +126,8 @@
android:paddingEnd="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
tools:text="January 1 1970" android:textSize="@dimen/day_text_size"
android:textSize="@dimen/day_text_size"/> tools:text="January 1 1970"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_end_time" android:id="@+id/event_end_time"
@ -138,8 +138,8 @@
android:layout_below="@+id/event_start_time" android:layout_below="@+id/event_start_time"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin" android:padding="@dimen/activity_margin"
tools:text="00:00" android:textSize="@dimen/day_text_size"
android:textSize="@dimen/day_text_size"/> tools:text="00:00"/>
<ImageView <ImageView
android:id="@+id/event_date_time_divider" android:id="@+id/event_date_time_divider"
@ -148,8 +148,8 @@
android:layout_below="@+id/event_end_date" android:layout_below="@+id/event_end_date"
android:layout_marginBottom="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:importantForAccessibility="no" android:background="@color/darker_divider"
android:background="@color/darker_divider"/> android:importantForAccessibility="no"/>
<ImageView <ImageView
android:id="@+id/event_reminder_image" android:id="@+id/event_reminder_image"
@ -215,8 +215,8 @@
android:layout_below="@+id/event_reminder_3" android:layout_below="@+id/event_reminder_3"
android:layout_marginBottom="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:importantForAccessibility="no" android:background="@color/darker_divider"
android:background="@color/darker_divider"/> android:importantForAccessibility="no"/>
<ImageView <ImageView
android:id="@+id/event_repetition_image" android:id="@+id/event_repetition_image"
@ -323,8 +323,71 @@
android:layout_below="@+id/event_repetition_limit_holder" android:layout_below="@+id/event_repetition_limit_holder"
android:layout_marginBottom="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="@color/darker_divider"
android:importantForAccessibility="no"/>
<ImageView
android:id="@+id/event_caldav_calendar_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_caldav_calendar_holder"
android:layout_alignTop="@+id/event_caldav_calendar_holder"
android:layout_below="@+id/event_repetition_divider"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginStart="@dimen/normal_margin"
android:alpha="0.8"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_calendar"
android:visibility="gone"/>
<RelativeLayout
android:id="@+id/event_caldav_calendar_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_repetition_divider"
android:layout_toEndOf="@+id/event_caldav_calendar_image"
android:layout_toRightOf="@+id/event_caldav_calendar_image"
android:background="?attr/selectableItemBackground"
android:visibility="gone">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_caldav_calendar_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginStart="@dimen/small_margin"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/medium_margin"
android:textSize="@dimen/day_text_size"
tools:text="My calendar"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_caldav_calendar_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_caldav_calendar_name"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginStart="@dimen/small_margin"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="@dimen/medium_margin"
android:textSize="@dimen/meta_text_size"
tools:text="hello@simplemobiletools.com"/>
</RelativeLayout>
<ImageView
android:id="@+id/event_caldav_calendar_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/event_caldav_calendar_holder"
android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin"
android:background="@color/darker_divider"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:background="@color/darker_divider"/> android:visibility="gone"/>
<ImageView <ImageView
android:id="@+id/event_type_image" android:id="@+id/event_type_image"
@ -332,7 +395,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_type_holder" android:layout_alignBottom="@+id/event_type_holder"
android:layout_alignTop="@+id/event_type_holder" android:layout_alignTop="@+id/event_type_holder"
android:layout_below="@+id/event_date_time_divider" android:layout_below="@+id/event_caldav_calendar_divider"
android:layout_marginLeft="@dimen/normal_margin" android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginStart="@dimen/normal_margin" android:layout_marginStart="@dimen/normal_margin"
android:alpha="0.8" android:alpha="0.8"
@ -343,7 +406,7 @@
android:id="@+id/event_type_holder" android:id="@+id/event_type_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/event_repetition_divider" android:layout_below="@+id/event_caldav_calendar_divider"
android:layout_toEndOf="@+id/event_type_image" android:layout_toEndOf="@+id/event_type_image"
android:layout_toRightOf="@+id/event_type_image" android:layout_toRightOf="@+id/event_type_image"
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">