hide the keyboard on clicking some field at the Event activity

This commit is contained in:
tibbi 2017-04-16 11:55:13 +02:00
parent 31e5c72a87
commit 5d17be541c
2 changed files with 8 additions and 1 deletions

View File

@ -78,8 +78,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
event_all_day.setOnCheckedChangeListener { compoundButton, isChecked -> toggleAllDay(isChecked) }
event_repetition.setOnClickListener { showRepeatIntervalDialog() }
event_repetition_limit_holder.setOnClickListener { showRepetitionLimitDialog() }
event_repetition_rule_holder.setOnClickListener { showRepetitionRuleDialog() }
event_repetition_limit_holder.setOnClickListener { showRepetitionLimitDialog() }
event_reminder_1.setOnClickListener { showReminder1Dialog() }
event_reminder_2.setOnClickListener { showReminder2Dialog() }
@ -166,6 +166,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
private fun showRepetitionLimitDialog() {
hideKeyboard()
val now = (System.currentTimeMillis() / 1000).toInt()
val repeatLimitDateTime = Formatter.getDateTimeFromTS(if (mRepeatLimit != 0) mRepeatLimit else now)
DatePickerDialog(this, mDialogTheme, repetitionLimitDateSetListener, repeatLimitDateTime.year, repeatLimitDateTime.monthOfYear - 1,
@ -192,6 +193,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
private fun showRepetitionRuleDialog() {
hideKeyboard()
if (isXWeeklyRepetition()) {
RepeatRuleDailyDialog(this, mRepeatRule) {
setRepeatRule(it)
@ -214,6 +216,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
private fun showEventTypeDialog() {
hideKeyboard()
SelectEventTypeDialog(this, mEventTypeId) {
mEventTypeId = it
updateEventType()
@ -274,6 +277,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
private fun toggleAllDay(isChecked: Boolean) {
hideKeyboard()
event_start_time.beGoneIf(isChecked)
event_end_time.beGoneIf(isChecked)
}

View File

@ -12,6 +12,7 @@ import com.simplemobiletools.calendar.helpers.WEEK
import com.simplemobiletools.calendar.helpers.YEAR
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.hideKeyboard
import com.simplemobiletools.commons.models.RadioItem
import java.util.TreeSet
import kotlin.collections.ArrayList
@ -22,6 +23,7 @@ open class SimpleActivity : BaseSimpleActivity() {
}
protected fun showEventReminderDialog(curMinutes: Int, callback: (minutes: Int) -> Unit) {
hideKeyboard()
val minutes = TreeSet<Int>()
minutes.apply {
add(-1)
@ -57,6 +59,7 @@ open class SimpleActivity : BaseSimpleActivity() {
}
protected fun showEventRepeatIntervalDialog(curSeconds: Int, callback: (minutes: Int) -> Unit) {
hideKeyboard()
val seconds = TreeSet<Int>()
seconds.apply {
add(0)