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 0877d9c8..7f61d3b8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt @@ -3,8 +3,8 @@ package com.simplemobiletools.clock.dialogs import android.app.TimePickerDialog import android.graphics.drawable.Drawable import android.media.AudioManager -import androidx.appcompat.app.AlertDialog import android.widget.TextView +import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.extensions.* diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt index 813ab6fe..fdbeabaf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt @@ -19,6 +19,7 @@ import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.models.AlarmSound import kotlinx.android.synthetic.main.fragment_alarm.view.* import java.util.* +import kotlin.math.pow class AlarmFragment : Fragment(), ToggleAlarmInterface { private var alarms = ArrayList() @@ -59,6 +60,12 @@ class AlarmFragment : Fragment(), ToggleAlarmInterface { alarm_fab.setOnClickListener { val newAlarm = context.createNewAlarm(DEFAULT_ALARM_MINUTES, 0) newAlarm.isEnabled = true + + val calendar = Calendar.getInstance() + calendar.add(Calendar.DAY_OF_WEEK, 1) // set the next alarm to the next day by default + val dayOfWeek = (calendar.get(Calendar.DAY_OF_WEEK) + 5) % 7 + newAlarm.days = 2.0.pow(dayOfWeek).toInt() + openEditAlarm(newAlarm) } }