fix an issue of initializing the calendar at wrong date if sunday is the first day

This commit is contained in:
tibbi 2017-02-03 23:12:34 +01:00
parent 3493842a7f
commit fc81e5ab42
1 changed files with 2 additions and 3 deletions

View File

@ -217,9 +217,8 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
}
private fun fillWeeklyViewPager() {
val firstDayIndex = if (config.isSundayFirst) 7 else 1
val thisweek = DateTime().withDayOfWeek(firstDayIndex).withTime(0, 0, 0, 0).seconds()
val weekTSs = getWeekTimestamps(thisweek)
val thisweek = DateTime().withDayOfWeek(1).withTimeAtStartOfDay().minusDays(if (config.isSundayFirst) 1 else 0)
val weekTSs = getWeekTimestamps(thisweek.seconds())
val weeklyAdapter = MyWeekPagerAdapter(supportFragmentManager, weekTSs, object : WeekFragment.WeekScrollListener {
override fun scrollTo(y: Int) {
week_view_hours_scrollview.scrollY = y