mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
optimize week start timestamp fetching
This commit is contained in:
@ -97,8 +97,10 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||||||
|
|
||||||
private fun getWeekTimestamps(targetSeconds: Long): List<Long> {
|
private fun getWeekTimestamps(targetSeconds: Long): List<Long> {
|
||||||
val weekTSs = ArrayList<Long>(PREFILLED_WEEKS)
|
val weekTSs = ArrayList<Long>(PREFILLED_WEEKS)
|
||||||
for (i in -PREFILLED_WEEKS / 2..PREFILLED_WEEKS / 2) {
|
var currWeekTS = targetSeconds - (PREFILLED_WEEKS / 2 * WEEK_SECONDS)
|
||||||
weekTSs.add(Formatter.getDateTimeFromTS(targetSeconds).plusWeeks(i).seconds())
|
for (i in 0 until PREFILLED_WEEKS) {
|
||||||
|
weekTSs.add(currWeekTS)
|
||||||
|
currWeekTS += WEEK_SECONDS
|
||||||
}
|
}
|
||||||
return weekTSs
|
return weekTSs
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user