fix the FAB button at the main screen

This commit is contained in:
tibbi 2016-09-17 23:16:29 +02:00
parent 23fc4556ce
commit cbd5036e1b
1 changed files with 7 additions and 10 deletions

View File

@ -4,8 +4,6 @@ import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import butterknife.OnClick
import com.simplemobiletools.calendar.*
import com.simplemobiletools.calendar.Formatter
import com.simplemobiletools.calendar.adapters.MyMonthPagerAdapter
@ -23,6 +21,13 @@ 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)
}
}
override fun onDestroy() {
@ -49,14 +54,6 @@ class MainActivity : SimpleActivity(), NavigationListener {
}
}
@OnClick(R.id.calendar_fab)
fun fabClicked(view: View) {
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)