init the calendar in proper week if sunday is the first day

This commit is contained in:
tibbi 2017-02-12 19:46:32 +01:00
parent 56139b722a
commit 505cd2e5af
1 changed files with 4 additions and 1 deletions

View File

@ -239,7 +239,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
}
private fun fillWeeklyViewPager() {
val thisweek = DateTime().withDayOfWeek(1).withTimeAtStartOfDay().minusDays(if (config.isSundayFirst) 1 else 0)
var thisweek = DateTime().withDayOfWeek(1).withTimeAtStartOfDay().minusDays(if (config.isSundayFirst) 1 else 0)
if (DateTime().minusDays(7).seconds() > thisweek.seconds()) {
thisweek = thisweek.plusDays(7)
}
val weekTSs = getWeekTimestamps(thisweek.seconds())
val weeklyAdapter = MyWeekPagerAdapter(supportFragmentManager, weekTSs, object : WeekFragment.WeekScrollListener {
override fun scrollTo(y: Int) {