fix the "Go to today" button at monthly view opened from yearly view

This commit is contained in:
tibbi 2017-03-22 19:37:04 +01:00
parent 50e0c206ac
commit 98f29fad55
1 changed files with 11 additions and 3 deletions

View File

@ -155,9 +155,13 @@ class MainActivity : SimpleActivity(), NavigationListener {
} else if (config.storedView == MONTHLY_VIEW) {
main_view_pager.currentItem = mDefaultMonthlyPage
} else if (config.storedView == YEARLY_VIEW) {
if (mIsMonthSelected) {
openMonthlyToday()
} else {
main_view_pager.currentItem = mDefaultYearlyPage
}
}
}
private fun shouldGoToTodayBeVisible(): Boolean {
return if (config.storedView == WEEKLY_VIEW) {
@ -193,13 +197,17 @@ class MainActivity : SimpleActivity(), NavigationListener {
} else if (config.storedView == WEEKLY_VIEW) {
fillWeeklyViewPager()
} else {
val targetDay = DateTime().toString(Formatter.DAYCODE_PATTERN)
fillMonthlyViewPager(targetDay)
openMonthlyToday()
}
mWeekScrollY = 0
}
private fun openMonthlyToday() {
val targetDay = DateTime().toString(Formatter.DAYCODE_PATTERN)
fillMonthlyViewPager(targetDay)
}
private fun refreshViewPager() {
if (config.storedView == YEARLY_VIEW) {
(main_view_pager.adapter as MyYearPagerAdapter).refreshEvents(main_view_pager.currentItem)