go back to yearly view on pressing Back from month view
This commit is contained in:
parent
7dc9cc73f7
commit
d7502ec277
|
@ -22,6 +22,8 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
private val PREFILLED_MONTHS = 73
|
private val PREFILLED_MONTHS = 73
|
||||||
private val PREFILLED_YEARS = 21
|
private val PREFILLED_YEARS = 21
|
||||||
|
|
||||||
|
private var mIsMonthSelected = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
@ -71,7 +73,16 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
if (mIsMonthSelected && mConfig.view == Constants.YEARLY_VIEW) {
|
||||||
|
updateView(Constants.YEARLY_VIEW)
|
||||||
|
} else {
|
||||||
|
super.onBackPressed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateView(view: Int) {
|
private fun updateView(view: Int) {
|
||||||
|
mIsMonthSelected = view == Constants.MONTHLY_VIEW
|
||||||
mConfig.view = view
|
mConfig.view = view
|
||||||
updateViewPager()
|
updateViewPager()
|
||||||
Handler().postDelayed({ invalidateOptionsMenu() }, 500)
|
Handler().postDelayed({ invalidateOptionsMenu() }, 500)
|
||||||
|
@ -152,5 +163,6 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
|
|
||||||
override fun goToDateTime(dateTime: DateTime) {
|
override fun goToDateTime(dateTime: DateTime) {
|
||||||
fillMonthlyViewPager(Formatter.getDayCodeFromDateTime(dateTime))
|
fillMonthlyViewPager(Formatter.getDayCodeFromDateTime(dateTime))
|
||||||
|
mIsMonthSelected = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue