Skip to content

Commit

Permalink
修复未初始化map
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorModi committed Feb 19, 2025
1 parent f5c4455 commit 145e344
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 1 addition & 5 deletions app/src/main/java/statusbar/finder/hook/app/SystemUI.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package statusbar.finder.hook.app

import android.app.Application
import cn.xiaowine.dsp.DSP
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.Log
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import de.robv.android.xposed.XSharedPreferences
import statusbar.finder.BuildConfig
import statusbar.finder.hook.BaseHook
import statusbar.finder.hook.observe.MediaSessionManagerHelper

Expand All @@ -23,7 +19,7 @@ object SystemUI : BaseHook() {
super.init()
Application::class.java.methodFinder().filterByName("attach").first().createHook {
after {
MediaSessionManagerHelper.initByContext(it.thisObject as Application)
MediaSessionManagerHelper.init(it.thisObject as Application)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ object MediaSessionManagerHelper {
private lateinit var context: Context
private lateinit var config: Config
private var mediaSessionManager: MediaSessionManager? = null
private lateinit var activeControllers: MutableMap<MediaController, MediaController.Callback>
private lateinit var lastSentenceMap: MutableMap<MediaController, Sentence>
private var activeControllers: MutableMap<MediaController, MediaController.Callback> = mutableMapOf()
private var lastSentenceMap: MutableMap<MediaController, Sentence> = mutableMapOf()
private var requiredLrcTitle: String = ""
private var curLrcUpdateThread: LrcUpdateThread? = null
private var currentLyric: Lyric? = null
Expand Down Expand Up @@ -178,7 +178,7 @@ object MediaSessionManagerHelper {
return delay
}

fun initByContext(initContext: Context) {
fun init(initContext: Context) {
context = initContext
config = Config()
EventTool.setContext(context, user)
Expand Down Expand Up @@ -206,14 +206,12 @@ object MediaSessionManagerHelper {
.setOngoing(true)
.build()
notificationManager!!.notify(NOTIFICATION_ID_LRC, notification)
activeControllers = mutableMapOf()
lastSentenceMap = mutableMapOf()
Log.i("${BuildConfig.APPLICATION_ID} Config forceRepeat: ${config.forceRepeat}")
Log.i("${BuildConfig.APPLICATION_ID} Config targetPackages: ${config.targetPackages}")
Log.i("${BuildConfig.APPLICATION_ID} Config translateDisplayType: ${config.translateDisplayType}")
}

fun insertZeroWidthSpace(input: String): String {
private fun insertZeroWidthSpace(input: String): String {
if (input.isEmpty() || input.length < 2) {
return input
}
Expand Down

0 comments on commit 145e344

Please sign in to comment.