mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
move the months FAB code to a separate function
This commit is contained in:
@ -22,12 +22,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||||||
val today = DateTime().toString(Formatter.DAYCODE_PATTERN)
|
val today = DateTime().toString(Formatter.DAYCODE_PATTERN)
|
||||||
fillViewPager(today)
|
fillViewPager(today)
|
||||||
|
|
||||||
calendar_fab.setOnClickListener {
|
calendar_fab.setOnClickListener { 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
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) {
|
private fun fillViewPager(targetMonth: String) {
|
||||||
val codes = getMonths(targetMonth)
|
val codes = getMonths(targetMonth)
|
||||||
val adapter = MyMonthPagerAdapter(supportFragmentManager, codes, this)
|
val adapter = MyMonthPagerAdapter(supportFragmentManager, codes, this)
|
||||||
|
Reference in New Issue
Block a user