Skip to content

Commit

Permalink
fix at & song
Browse files Browse the repository at this point in the history
  • Loading branch information
Théophile Delmas committed Nov 25, 2023
1 parent c757b96 commit bb8b7bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/src/main/java/com/rooster/rooster/AlarmAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.widget.LinearLayout
import android.widget.Switch
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import java.util.Calendar


class AlarmAdapter(private val alarmList: List<Alarm>, val alarmDbHelper: AlarmDbHelper) : RecyclerView.Adapter<AlarmAdapter.ViewHolder>() {
Expand Down Expand Up @@ -263,15 +264,16 @@ class AlarmAdapter(private val alarmList: List<Alarm>, val alarmDbHelper: AlarmD
"Pick Time" -> {
TimePickerDialog(context, { _, hour, minute ->
val swicthEnabled = container.findViewById<Switch>(R.id.switchAlarmEnabled)
val calendar = Calendar.getInstance()
calendar.set(Calendar.HOUR_OF_DAY, hour)
calendar.set(Calendar.MINUTE, minute)
if (index == 1) {
alarm.time1 = (hour.toLong() * 60 + minute) * 60
alarm.time1 = calendar.time.time
} else if (index == 2) {
alarm.time2 = (hour.toLong() * 60 + minute) * 60
alarm.time2 = calendar.time.time
}
alarm.enabled = true
swicthEnabled.isChecked = alarm.enabled
Log.e("ALARM", alarm.getFormattedTime(alarm.time1).toString())
Log.e("ALARM", alarm.getFormattedTime(alarm.time2).toString())
alarmDbHelper.updateAlarm(alarm)
arrangeLayout(context, container, alarm, alarm.mode, holder)
}, (alarm.time1 / 3600).toInt(), (alarm.time1 % 60 / 60).toInt(), true)
Expand Down
Binary file modified app/src/main/res/raw/alarmclock.mp3
Binary file not shown.
Binary file added app/src/main/res/raw/ugly_alarm.mp3
Binary file not shown.

0 comments on commit bb8b7bd

Please sign in to comment.