mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-11 09:20:53 +01:00
improving time zone handling at the event details screen
This commit is contained in:
parent
2796cfdfe4
commit
175a3366d3
@ -84,6 +84,7 @@ class EventActivity : SimpleActivity() {
|
|||||||
private var mAvailableContacts = ArrayList<Attendee>()
|
private var mAvailableContacts = ArrayList<Attendee>()
|
||||||
private var mSelectedContacts = ArrayList<Attendee>()
|
private var mSelectedContacts = ArrayList<Attendee>()
|
||||||
private var mStoredEventTypes = ArrayList<EventType>()
|
private var mStoredEventTypes = ArrayList<EventType>()
|
||||||
|
private var mOriginalTimeZone = DateTimeZone.getDefault().id
|
||||||
|
|
||||||
private lateinit var mAttendeePlaceholder: Drawable
|
private lateinit var mAttendeePlaceholder: Drawable
|
||||||
private lateinit var mEventStartDateTime: DateTime
|
private lateinit var mEventStartDateTime: DateTime
|
||||||
@ -337,8 +338,9 @@ class EventActivity : SimpleActivity() {
|
|||||||
val duration = mEvent.endTS - mEvent.startTS
|
val duration = mEvent.endTS - mEvent.startTS
|
||||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
||||||
updateActionBarTitle(getString(R.string.edit_event))
|
updateActionBarTitle(getString(R.string.edit_event))
|
||||||
mEventStartDateTime = Formatter.getDateTimeFromTS(realStart)
|
mOriginalTimeZone = mEvent.timeZone
|
||||||
mEventEndDateTime = Formatter.getDateTimeFromTS(realStart + duration)
|
mEventStartDateTime = Formatter.getDateTimeFromTS(realStart).withZone(DateTimeZone.forID(mOriginalTimeZone))
|
||||||
|
mEventEndDateTime = Formatter.getDateTimeFromTS(realStart + duration).withZone(DateTimeZone.forID(mOriginalTimeZone))
|
||||||
event_title.setText(mEvent.title)
|
event_title.setText(mEvent.title)
|
||||||
event_location.setText(mEvent.location)
|
event_location.setText(mEvent.location)
|
||||||
event_description.setText(mEvent.description)
|
event_description.setText(mEvent.description)
|
||||||
@ -899,8 +901,14 @@ class EventActivity : SimpleActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val newStartTS = mEventStartDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds()
|
val offset = if (mEvent.getTimeZoneString().equals(mOriginalTimeZone, true)) {
|
||||||
val newEndTS = mEventEndDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds()
|
0
|
||||||
|
} else {
|
||||||
|
(DateTimeZone.forID(mEvent.timeZone).getOffset(System.currentTimeMillis()) - DateTimeZone.forID(mOriginalTimeZone).getOffset(System.currentTimeMillis())) / 1000L
|
||||||
|
}
|
||||||
|
|
||||||
|
val newStartTS = mEventStartDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset
|
||||||
|
val newEndTS = mEventEndDateTime.withSecondOfMinute(0).withMillisOfSecond(0).seconds() - offset
|
||||||
|
|
||||||
if (newStartTS > newEndTS) {
|
if (newStartTS > newEndTS) {
|
||||||
toast(R.string.end_before_start)
|
toast(R.string.end_before_start)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user