minor refactoring

This commit is contained in:
tibbi
2016-10-23 12:14:31 +02:00
parent 3f267ba8ed
commit 04f83c00b0

View File

@@ -163,16 +163,16 @@ class EventActivity : SimpleActivity(), DBHelper.EventsListener {
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { return when (item.itemId) {
R.id.delete -> { R.id.delete -> {
deleteEvent() deleteEvent()
return true true
} }
R.id.save -> { R.id.save -> {
saveEvent() saveEvent()
return true true
} }
else -> return super.onOptionsItemSelected(item) else -> super.onOptionsItemSelected(item)
} }
} }
@@ -224,28 +224,28 @@ class EventActivity : SimpleActivity(), DBHelper.EventsListener {
private val reminderMinutes: Int private val reminderMinutes: Int
get() { get() {
when (event_reminder.selectedItemPosition) { return when (event_reminder.selectedItemPosition) {
0 -> return -1 0 -> -1
1 -> return 0 1 -> 0
else -> { else -> {
val value = event_reminder_other.text.toString().trim { it <= ' ' } val value = event_reminder_other.text.toString().trim { it <= ' ' }
if (value.isEmpty()) if (value.isEmpty())
return 0 0
return Integer.valueOf(value)!! Integer.valueOf(value)!!
} }
} }
} }
private val repeatInterval: Int private val repeatInterval: Int
get() { get() {
when (event_repetition.selectedItemPosition) { return when (event_repetition.selectedItemPosition) {
1 -> return Constants.DAY 1 -> Constants.DAY
2 -> return Constants.WEEK 2 -> Constants.WEEK
3 -> return Constants.BIWEEK 3 -> Constants.BIWEEK
4 -> return Constants.MONTH 4 -> Constants.MONTH
5 -> return Constants.YEAR 5 -> Constants.YEAR
else -> return 0 else -> 0
} }
} }