pull/36/head
kunfei 5 years ago
parent adc7867306
commit b4894d43d3
  1. 4
      app/src/main/java/io/legado/app/receiver/MediaButtonReceiver.kt
  2. 2
      app/src/main/java/io/legado/app/utils/LogUtils.kt

@ -7,7 +7,9 @@ import android.view.KeyEvent
import io.legado.app.constant.Bus
import io.legado.app.help.ActivityHelp
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.utils.LogUtils.MyLogger
import io.legado.app.utils.postEvent
import java.util.logging.Level
/**
@ -22,7 +24,7 @@ class MediaButtonReceiver : BroadcastReceiver() {
fun handleIntent(context: Context, intent: Intent): Boolean {
val intentAction = intent.action
val keyEventAction = intent.getParcelableExtra<KeyEvent>(Intent.EXTRA_KEY_EVENT)?.action
// LogUtils.log("耳机按键: $intentAction $keyEventAction")
MyLogger.log(Level.INFO, "耳机按键: $intentAction $keyEventAction")
if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
if (keyEventAction == KeyEvent.ACTION_DOWN) {
readAloud(context)

@ -13,7 +13,7 @@ import java.util.logging.Formatter
object LogUtils {
const val TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"
val logger: Logger by lazy {
val MyLogger: Logger by lazy {
Logger.getGlobal().apply {
addHandler(fileHandler)
}

Loading…
Cancel
Save