diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt index eee08303..0ef20a82 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt @@ -14,6 +14,7 @@ import com.simplemobiletools.clock.helpers.TODAY_BIT import com.simplemobiletools.clock.helpers.TOMORROW_BIT import com.simplemobiletools.clock.helpers.getCurrentDayMinutes import com.simplemobiletools.clock.models.Alarm +import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.SelectAlarmSoundDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.models.AlarmSound @@ -42,12 +43,12 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba updateSelectedAlarmSound(it) } }, onAlarmSoundDeleted = { - if (alarm.soundUri == it.uri) { - val defaultAlarm = context.getDefaultAlarmSound(RingtoneManager.TYPE_ALARM) - updateSelectedAlarmSound(defaultAlarm) - } - activity.checkAlarmsWithDeletedSoundUri(it.uri) - }) + if (alarm.soundUri == it.uri) { + val defaultAlarm = context.getDefaultAlarmSound(RingtoneManager.TYPE_ALARM) + updateSelectedAlarmSound(defaultAlarm) + } + activity.checkAlarmsWithDeletedSoundUri(it.uri) + }) } edit_alarm_vibrate.colorLeftDrawable(textColor) @@ -101,6 +102,15 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba .create().apply { activity.setupDialogStuff(view, this) { getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { + if (!activity.config.wasAlarmWarningShown) { + ConfirmationDialog(activity, messageId = R.string.alarm_warning, positive = R.string.ok, negative = 0) { + activity.config.wasAlarmWarningShown = true + it.performClick() + } + + return@setOnClickListener + } + if (alarm.days <= 0) { alarm.days = if (alarm.timeInMinutes > getCurrentDayMinutes()) { TODAY_BIT