open the picked month on click
This commit is contained in:
parent
8016391989
commit
53761776e3
|
@ -7,5 +7,5 @@ interface NavigationListener {
|
|||
|
||||
fun goRight()
|
||||
|
||||
fun goToDateTime(dateTime: DateTime)
|
||||
fun goToDateTime(dateTime: DateTime, switchedFromYearly: Boolean)
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class DayActivity : SimpleActivity(), DayFragment.DeleteListener, ViewPager.OnPa
|
|||
view_pager.currentItem = view_pager.currentItem + 1
|
||||
}
|
||||
|
||||
override fun goToDateTime(dateTime: DateTime) {
|
||||
override fun goToDateTime(dateTime: DateTime, switchedFromYearly: Boolean) {
|
||||
checkDeleteEvents()
|
||||
fillViewPager(Formatter.getDayCodeFromDateTime(dateTime))
|
||||
}
|
||||
|
|
|
@ -150,7 +150,12 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
view_pager.currentItem = view_pager.currentItem + 1
|
||||
}
|
||||
|
||||
override fun goToDateTime(dateTime: DateTime) {
|
||||
override fun goToDateTime(dateTime: DateTime, switchedFromYearly: Boolean) {
|
||||
fillMonthlyViewPager(Formatter.getDayCodeFromDateTime(dateTime))
|
||||
|
||||
if (switchedFromYearly) {
|
||||
mConfig.view = Constants.MONTHLY_VIEW
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte
|
|||
val year = datePicker.year
|
||||
val day = datePicker.dayOfMonth
|
||||
val newDateTime = dateTime.withDayOfMonth(day).withMonthOfYear(month).withYear(year)
|
||||
mListener?.goToDateTime(newDateTime)
|
||||
mListener?.goToDateTime(newDateTime, false)
|
||||
}
|
||||
|
||||
show()
|
||||
|
|
|
@ -126,8 +126,8 @@ class MonthFragment : Fragment(), Calendar {
|
|||
setPositiveButton(R.string.ok) { dialog, id ->
|
||||
val month = datePicker.month + 1
|
||||
val year = datePicker.year
|
||||
val newDateTime = dateTime.withMonthOfYear(month).withYear(year)
|
||||
mListener?.goToDateTime(newDateTime)
|
||||
val newDateTime = dateTime.withDayOfMonth(1).withMonthOfYear(month).withYear(year)
|
||||
mListener?.goToDateTime(newDateTime, false)
|
||||
}
|
||||
|
||||
show()
|
||||
|
|
|
@ -48,6 +48,9 @@ class YearFragment : Fragment() {
|
|||
dayOfWeek--
|
||||
|
||||
monthView.setFirstDay(dayOfWeek)
|
||||
monthView.setOnClickListener {
|
||||
mListener?.goToDateTime(DateTime().withDayOfMonth(1).withMonthOfYear(i).withYear(mYear), true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue