优化
This commit is contained in:
@@ -15,6 +15,7 @@ import io.legado.app.service.AudioPlayService
|
|||||||
import io.legado.app.service.BaseReadAloudService
|
import io.legado.app.service.BaseReadAloudService
|
||||||
import io.legado.app.ui.book.audio.AudioPlayActivity
|
import io.legado.app.ui.book.audio.AudioPlayActivity
|
||||||
import io.legado.app.ui.book.read.ReadBookActivity
|
import io.legado.app.ui.book.read.ReadBookActivity
|
||||||
|
import io.legado.app.utils.LogUtils
|
||||||
import io.legado.app.utils.getPrefBoolean
|
import io.legado.app.utils.getPrefBoolean
|
||||||
import io.legado.app.utils.postEvent
|
import io.legado.app.utils.postEvent
|
||||||
|
|
||||||
@@ -33,6 +34,8 @@ class MediaButtonReceiver : BroadcastReceiver() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
private const val TAG = "MediaButtonReceiver"
|
||||||
|
|
||||||
fun handleIntent(context: Context, intent: Intent): Boolean {
|
fun handleIntent(context: Context, intent: Intent): Boolean {
|
||||||
val intentAction = intent.action
|
val intentAction = intent.action
|
||||||
if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
|
if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
|
||||||
@@ -42,6 +45,7 @@ class MediaButtonReceiver : BroadcastReceiver() {
|
|||||||
val keycode: Int = keyEvent.keyCode
|
val keycode: Int = keyEvent.keyCode
|
||||||
val action: Int = keyEvent.action
|
val action: Int = keyEvent.action
|
||||||
if (action == KeyEvent.ACTION_DOWN) {
|
if (action == KeyEvent.ACTION_DOWN) {
|
||||||
|
LogUtils.d(TAG, "Receive mediaButton event, keycode:$keycode")
|
||||||
when (keycode) {
|
when (keycode) {
|
||||||
KeyEvent.KEYCODE_MEDIA_PREVIOUS -> {
|
KeyEvent.KEYCODE_MEDIA_PREVIOUS -> {
|
||||||
if (context.getPrefBoolean("mediaButtonPerNext", false)) {
|
if (context.getPrefBoolean("mediaButtonPerNext", false)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user