Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Jan 11, 2022
1 parent 4640aa8 commit 8f7242f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class MediaButtonReceiver : BroadcastReceiver() {
val keycode: Int = keyEvent.keyCode
val action: Int = keyEvent.action
if (action == KeyEvent.ACTION_DOWN) {
AppLog.put("mediaButton $action")
when (keycode) {
KeyEvent.KEYCODE_MEDIA_PREVIOUS -> {
if (context.getPrefBoolean("mediaButtonPerNext", false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,15 @@ abstract class BaseReadAloudService : BaseService(),
override fun onAudioFocusChange(focusChange: Int) {
when (focusChange) {
AudioManager.AUDIOFOCUS_GAIN -> {
AppLog.put("重新获得焦点, 恢复播放")
audioFocusLossTransient = false
if (!pause) resumeReadAloud()
}
AudioManager.AUDIOFOCUS_LOSS -> {
AppLog.put("永久丢失焦点")
if (audioFocusLossTransient) {
pauseReadAloud(true)
}
}
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> {
AppLog.put("暂时丢失焦点, 暂停播放")
audioFocusLossTransient = true
if (!pause) pauseReadAloud(false)
}
Expand Down

0 comments on commit 8f7242f

Please sign in to comment.