optimize week start timestamp fetching

This commit is contained in:
tibbi 2018-12-19 19:36:18 +01:00
parent 8e4e22ad31
commit e5e8c2a462
1 changed files with 4 additions and 2 deletions

View File

@ -97,8 +97,10 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
private fun getWeekTimestamps(targetSeconds: Long): List<Long> {
val weekTSs = ArrayList<Long>(PREFILLED_WEEKS)
for (i in -PREFILLED_WEEKS / 2..PREFILLED_WEEKS / 2) {
weekTSs.add(Formatter.getDateTimeFromTS(targetSeconds).plusWeeks(i).seconds())
var currWeekTS = targetSeconds - (PREFILLED_WEEKS / 2 * WEEK_SECONDS)
for (i in 0 until PREFILLED_WEEKS) {
weekTSs.add(currWeekTS)
currWeekTS += WEEK_SECONDS
}
return weekTSs
}