fix #951, fix some glitch related to setting a default
This commit is contained in:
parent
969f860d63
commit
5b42f5adf3
|
@ -80,6 +80,7 @@ class EventActivity : SimpleActivity() {
|
|||
private var mAttendeeAutoCompleteViews = ArrayList<MyAutoCompleteTextView>()
|
||||
private var mAvailableContacts = ArrayList<Attendee>()
|
||||
private var mSelectedContacts = ArrayList<Attendee>()
|
||||
private var mStoredEventTypes = ArrayList<EventType>()
|
||||
|
||||
private lateinit var mAttendeePlaceholder: Drawable
|
||||
private lateinit var mEventStartDateTime: DateTime
|
||||
|
@ -103,13 +104,14 @@ class EventActivity : SimpleActivity() {
|
|||
|
||||
val eventId = intent.getLongExtra(EVENT_ID, 0L)
|
||||
ensureBackgroundThread {
|
||||
mStoredEventTypes = eventTypesDB.getEventTypes().toMutableList() as ArrayList<EventType>
|
||||
val event = eventsDB.getEventWithId(eventId)
|
||||
if (eventId != 0L && event == null) {
|
||||
finish()
|
||||
return@ensureBackgroundThread
|
||||
}
|
||||
|
||||
val localEventType = eventTypesDB.getEventTypeWithId(config.lastUsedLocalEventTypeId)
|
||||
val localEventType = mStoredEventTypes.firstOrNull { it.id == config.lastUsedLocalEventTypeId }
|
||||
runOnUiThread {
|
||||
gotEvent(savedInstanceState, localEventType, event)
|
||||
}
|
||||
|
@ -342,6 +344,10 @@ class EventActivity : SimpleActivity() {
|
|||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||
event_title.requestFocus()
|
||||
updateActionBarTitle(getString(R.string.new_event))
|
||||
if (config.defaultEventTypeId != -1L) {
|
||||
config.lastUsedCaldavCalendarId = mStoredEventTypes.firstOrNull { it.id == config.defaultEventTypeId }?.caldavCalendarId ?: 0
|
||||
}
|
||||
|
||||
val isLastCaldavCalendarOK = config.caldavSync && config.getSyncedCalendarIdsAsList().contains(config.lastUsedCaldavCalendarId)
|
||||
mEventCalendarId = if (isLastCaldavCalendarOK) config.lastUsedCaldavCalendarId else STORED_LOCALLY_ONLY
|
||||
|
||||
|
|
Loading…
Reference in New Issue