fixing some weekly view related glitches, rely on UTC dates

This commit is contained in:
tibbi 2020-11-02 20:28:46 +01:00
parent 098b945b55
commit 34139e4078
2 changed files with 4 additions and 2 deletions

View File

@ -197,14 +197,14 @@ class WeekFragment : Fragment(), WeeklyCalendar {
mView.week_events_columns_holder.removeAllViews()
(0 until config.weeklyViewDays).forEach {
val column = inflater.inflate(R.layout.weekly_view_day_column, mView.week_events_columns_holder, false) as RelativeLayout
column.tag = Formatter.getDayCodeFromTS(weekTimestamp + it * DAY_SECONDS)
column.tag = Formatter.getUTCDayCodeFromTS(weekTimestamp + it * DAY_SECONDS)
mView.week_events_columns_holder.addView(column)
dayColumns.add(column)
}
}
private fun setupDayLabels() {
var curDay = Formatter.getDateTimeFromTS(weekTimestamp)
var curDay = Formatter.getUTCDateTimeFromTS(weekTimestamp)
val textColor = if (isPrintVersion) resources.getColor(R.color.theme_light_text_color) else config.textColor
val todayCode = Formatter.getDayCodeFromDateTime(DateTime())
val screenWidth = context?.usableScreenSize?.x ?: return

View File

@ -108,5 +108,7 @@ object Formatter {
}
}
fun getUTCDayCodeFromTS(ts: Long) = getUTCDateTimeFromTS(ts).toString(DAYCODE_PATTERN)
fun getShiftedImportTimestamp(ts: Long) = getUTCDateTimeFromTS(ts).withTime(13, 0, 0, 0).withZoneRetainFields(DateTimeZone.getDefault()).seconds()
}