do not allow selecting an event type at caldav synced events

This commit is contained in:
tibbi 2017-08-17 23:51:49 +02:00
parent a66931c17d
commit d8ed0c49d4
1 changed files with 15 additions and 14 deletions

View File

@ -315,13 +315,11 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
return days.trim().trimEnd(',') return days.trim().trimEnd(',')
} }
private fun getMonthlyRepetitionRuleText(): String { private fun getMonthlyRepetitionRuleText() = when (mRepeatRule) {
return when (mRepeatRule) {
REPEAT_MONTH_SAME_DAY -> getString(R.string.the_same_day) REPEAT_MONTH_SAME_DAY -> getString(R.string.the_same_day)
REPEAT_MONTH_LAST_DAY -> getString(R.string.the_last_day) REPEAT_MONTH_LAST_DAY -> getString(R.string.the_last_day)
else -> getRepeatXthDayString(false) else -> getRepeatXthDayString(false)
} }
}
private fun showEventTypeDialog() { private fun showEventTypeDialog() {
hideKeyboard() hideKeyboard()
@ -402,6 +400,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
updateCurrentCalendarInfo(getCalendarWithId(calendars)) updateCurrentCalendarInfo(getCalendarWithId(calendars))
} }
} }
} else {
updateCurrentCalendarInfo(null)
} }
} }
@ -409,8 +409,12 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
calendars.firstOrNull { it.id == config.lastUsedCaldavCalendar } calendars.firstOrNull { it.id == config.lastUsedCaldavCalendar }
private fun updateCurrentCalendarInfo(currentCalendar: CalDAVCalendar?) { private fun updateCurrentCalendarInfo(currentCalendar: CalDAVCalendar?) {
event_type_image.beVisibleIf(currentCalendar == null)
event_type_holder.beVisibleIf(currentCalendar == null)
event_caldav_calendar_divider.beVisibleIf(currentCalendar == null)
event_caldav_calendar_email.beGoneIf(currentCalendar == null)
if (currentCalendar == null) { if (currentCalendar == null) {
event_caldav_calendar_email.beGone()
event_caldav_calendar_name.apply { event_caldav_calendar_name.apply {
text = getString(R.string.store_locally_only) text = getString(R.string.store_locally_only)
apply { apply {
@ -419,7 +423,6 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
} }
} else { } else {
event_caldav_calendar_email.text = currentCalendar.accountName event_caldav_calendar_email.text = currentCalendar.accountName
event_caldav_calendar_email.beVisible()
event_caldav_calendar_name.apply { event_caldav_calendar_name.apply {
text = currentCalendar.displayName text = currentCalendar.displayName
apply { apply {
@ -589,7 +592,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
} }
@SuppressLint("NewApi") @SuppressLint("NewApi")
fun setupStartDate() { private fun setupStartDate() {
hideKeyboard() hideKeyboard()
config.backgroundColor.getContrastColor() config.backgroundColor.getContrastColor()
val datepicker = DatePickerDialog(this, mDialogTheme, startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1, val datepicker = DatePickerDialog(this, mDialogTheme, startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1,
@ -602,13 +605,13 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
datepicker.show() datepicker.show()
} }
fun setupStartTime() { private fun setupStartTime() {
hideKeyboard() hideKeyboard()
TimePickerDialog(this, mDialogTheme, startTimeSetListener, mEventStartDateTime.hourOfDay, mEventStartDateTime.minuteOfHour, config.use24hourFormat).show() TimePickerDialog(this, mDialogTheme, startTimeSetListener, mEventStartDateTime.hourOfDay, mEventStartDateTime.minuteOfHour, config.use24hourFormat).show()
} }
@SuppressLint("NewApi") @SuppressLint("NewApi")
fun setupEndDate() { private fun setupEndDate() {
hideKeyboard() hideKeyboard()
val datepicker = DatePickerDialog(this, mDialogTheme, endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1, val datepicker = DatePickerDialog(this, mDialogTheme, endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1,
mEventEndDateTime.dayOfMonth) mEventEndDateTime.dayOfMonth)
@ -620,7 +623,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
datepicker.show() datepicker.show()
} }
fun setupEndTime() { private fun setupEndTime() {
hideKeyboard() hideKeyboard()
TimePickerDialog(this, mDialogTheme, endTimeSetListener, mEventEndDateTime.hourOfDay, mEventEndDateTime.minuteOfHour, config.use24hourFormat).show() TimePickerDialog(this, mDialogTheme, endTimeSetListener, mEventEndDateTime.hourOfDay, mEventEndDateTime.minuteOfHour, config.use24hourFormat).show()
} }
@ -690,13 +693,11 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
} }
override fun eventInserted(event: Event) { override fun eventInserted(event: Event) {
} }
override fun eventsDeleted(cnt: Int) { override fun eventsDeleted(cnt: Int) {
} }
override fun gotEvents(events: MutableList<Event>) { override fun gotEvents(events: MutableList<Event>) {
} }
} }