move the months FAB code to a separate function
This commit is contained in:
parent
711736cbeb
commit
ee508de5d1
|
@ -22,12 +22,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
val today = DateTime().toString(Formatter.DAYCODE_PATTERN)
|
||||
fillViewPager(today)
|
||||
|
||||
calendar_fab.setOnClickListener {
|
||||
val intent = Intent(applicationContext, EventActivity::class.java)
|
||||
val tomorrowCode = Formatter.getDayCodeFromDateTime(DateTime(DateTimeZone.getDefault()).plusDays(1))
|
||||
intent.putExtra(Constants.DAY_CODE, tomorrowCode)
|
||||
startActivity(intent)
|
||||
}
|
||||
calendar_fab.setOnClickListener { addNewEvent() }
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -54,6 +49,13 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun addNewEvent() {
|
||||
val intent = Intent(applicationContext, EventActivity::class.java)
|
||||
val tomorrowCode = Formatter.getDayCodeFromDateTime(DateTime(DateTimeZone.getDefault()).plusDays(1))
|
||||
intent.putExtra(Constants.DAY_CODE, tomorrowCode)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
private fun fillViewPager(targetMonth: String) {
|
||||
val codes = getMonths(targetMonth)
|
||||
val adapter = MyMonthPagerAdapter(supportFragmentManager, codes, this)
|
||||
|
|
Loading…
Reference in New Issue