Skip to content

Commit

Permalink
Merge pull request #291 from SuhasDissa/volume-button-snooze
Browse files Browse the repository at this point in the history
feat: press volume down to snooze an alarm
  • Loading branch information
SuhasDissa authored Feb 13, 2024
2 parents 8f4f928 + 7892263 commit a75cae1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/com/bnyro/clock/ui/AlarmActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.bnyro.clock.ui

import android.content.Intent
import android.os.Bundle
import android.view.KeyEvent
import android.view.Window
import android.view.WindowManager
import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -51,6 +52,13 @@ class AlarmActivity : ComponentActivity() {
AlarmHelper.snooze(this@AlarmActivity, alarm)
}

override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
snooze()
}
return true
}

override fun onNewIntent(intent: Intent) {
handleIntent(intent)
super.onNewIntent(intent)
Expand Down

0 comments on commit a75cae1

Please sign in to comment.