mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-31 10:54:51 +01:00
properly retrieve data on device rotation
This commit is contained in:
parent
307ad5648a
commit
6217a74c39
@ -50,22 +50,6 @@ import kotlin.collections.ArrayList
|
||||
|
||||
class EventActivity : SimpleActivity() {
|
||||
private val LAT_LON_PATTERN = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)([,;])\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)\$"
|
||||
private val EVENT = "EVENT"
|
||||
private val START_TS = "START_TS"
|
||||
private val END_TS = "END_TS"
|
||||
private val REMINDER_1_MINUTES = "REMINDER_1_MINUTES"
|
||||
private val REMINDER_2_MINUTES = "REMINDER_2_MINUTES"
|
||||
private val REMINDER_3_MINUTES = "REMINDER_3_MINUTES"
|
||||
private val REMINDER_1_TYPE = "REMINDER_1_TYPE"
|
||||
private val REMINDER_2_TYPE = "REMINDER_2_TYPE"
|
||||
private val REMINDER_3_TYPE = "REMINDER_3_TYPE"
|
||||
private val REPEAT_INTERVAL = "REPEAT_INTERVAL"
|
||||
private val REPEAT_LIMIT = "REPEAT_LIMIT"
|
||||
private val REPEAT_RULE = "REPEAT_RULE"
|
||||
private val ATTENDEES = "ATTENDEES"
|
||||
private val AVAILABILITY = "AVAILABILITY"
|
||||
private val EVENT_TYPE_ID = "EVENT_TYPE_ID"
|
||||
private val EVENT_CALENDAR_ID = "EVENT_CALENDAR_ID"
|
||||
private val SELECT_TIME_ZONE_INTENT = 1
|
||||
|
||||
private var mIsAllDayEvent = false
|
||||
|
@ -62,6 +62,38 @@ class TaskActivity : SimpleActivity() {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
if (!::mTask.isInitialized) {
|
||||
return
|
||||
}
|
||||
|
||||
outState.apply {
|
||||
putSerializable(TASK, mTask)
|
||||
putLong(START_TS, mTaskDateTime.seconds())
|
||||
putLong(EVENT_TYPE_ID, mEventTypeId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
|
||||
super.onRestoreInstanceState(savedInstanceState)
|
||||
if (!savedInstanceState.containsKey(START_TS)) {
|
||||
hideKeyboard()
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
savedInstanceState.apply {
|
||||
mTask = getSerializable(TASK) as Event
|
||||
mTaskDateTime = Formatter.getDateTimeFromTS(getLong(START_TS))
|
||||
mEventTypeId = getLong(EVENT_TYPE_ID)
|
||||
}
|
||||
|
||||
updateEventType()
|
||||
updateDateText()
|
||||
updateTimeText()
|
||||
}
|
||||
|
||||
private fun gotTask(savedInstanceState: Bundle?, task: Event?) {
|
||||
if (task != null) {
|
||||
mTask = task
|
||||
|
@ -198,6 +198,24 @@ const val DELETE_ALL_OCCURRENCES = 2
|
||||
const val REMINDER_NOTIFICATION = 0
|
||||
const val REMINDER_EMAIL = 1
|
||||
|
||||
const val EVENT = "EVENT"
|
||||
const val TASK = "TASK"
|
||||
const val START_TS = "START_TS"
|
||||
const val END_TS = "END_TS"
|
||||
const val REMINDER_1_MINUTES = "REMINDER_1_MINUTES"
|
||||
const val REMINDER_2_MINUTES = "REMINDER_2_MINUTES"
|
||||
const val REMINDER_3_MINUTES = "REMINDER_3_MINUTES"
|
||||
const val REMINDER_1_TYPE = "REMINDER_1_TYPE"
|
||||
const val REMINDER_2_TYPE = "REMINDER_2_TYPE"
|
||||
const val REMINDER_3_TYPE = "REMINDER_3_TYPE"
|
||||
const val REPEAT_INTERVAL = "REPEAT_INTERVAL"
|
||||
const val REPEAT_LIMIT = "REPEAT_LIMIT"
|
||||
const val REPEAT_RULE = "REPEAT_RULE"
|
||||
const val ATTENDEES = "ATTENDEES"
|
||||
const val AVAILABILITY = "AVAILABILITY"
|
||||
const val EVENT_TYPE_ID = "EVENT_TYPE_ID"
|
||||
const val EVENT_CALENDAR_ID = "EVENT_CALENDAR_ID"
|
||||
|
||||
fun getNowSeconds() = System.currentTimeMillis() / 1000L
|
||||
|
||||
fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean {
|
||||
|
Loading…
x
Reference in New Issue
Block a user