diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 1b6852fd..ad0354e7 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -12,8 +12,8 @@ android {
applicationId = "statusbar.lyric"
minSdk = 26
targetSdk = 33
- versionCode = 164
- versionName = "5.4.1"
+ versionCode = 165
+ versionName = "5.4.2"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
buildConfigField("String", "BUILD_TIME", "\"$buildTime\"")
diff --git a/app/src/main/java/statusbar/lyric/activity/SettingsActivity.kt b/app/src/main/java/statusbar/lyric/activity/SettingsActivity.kt
index c4f6f0ad..4fda94d1 100644
--- a/app/src/main/java/statusbar/lyric/activity/SettingsActivity.kt
+++ b/app/src/main/java/statusbar/lyric/activity/SettingsActivity.kt
@@ -732,12 +732,13 @@ class SettingsActivity : MIUIActivity() {
}
register("advancedSettings", getString(R.string.AdvancedSettings), true) {
+ TextSummaryWithSwitch(TextSummaryV(textId = R.string.JudgementTitle), SwitchV("JudgementTitle"))
TextSummaryWithSwitch(TextSummaryV(textId = R.string.GetTitle), SwitchV("GetTitle"))
TextSummaryWithSwitch(TextSummaryV(textId = R.string.OnlyGetLyric, tipsId = R.string.OnlyGetLyricTips), SwitchV("OnlyGetLyric"))
- TextWithSwitch(TextV(textId = R.string.TimeOff), SwitchV("TimeOff"))
- TextSummaryArrow(TextSummaryV(textId = R.string.TimeOffTime, onClickListener = {
+ TextWithSwitch(TextV(textId = R.string.TimeHide), SwitchV("TimeOff"))
+ TextSummaryArrow(TextSummaryV(textId = R.string.TimeHideTime, onClickListener = {
MIUIDialog(activity) {
- setTitle(R.string.TimeOffTime)
+ setTitle(R.string.TimeHideTime)
setMessage(R.string.AntiBurnTimeTips)
setEditText(ActivityOwnSP.ownSPConfig.getTimeOffTime().toString(), "10000")
setRButton(R.string.Ok) {
@@ -1176,6 +1177,7 @@ class SettingsActivity : MIUIActivity() {
}
Timer().schedule(UpdateConfigTask(), 0, 1000)
ActivityUtils.getNotice(activity)
+ ActivityUtils.setMusicList(activity, ActivityOwnSP.ownSPConfig)
if (ActivityOwnSP.ownSPConfig.getCheckUpdate()) ActivityUtils.getUpdate(activity)
AppCenter.start(application, Utils.appCenterKey, Analytics::class.java, Crashes::class.java)
Analytics.trackEvent("Module Version:${BuildConfig.VERSION_NAME} | Android:${Build.VERSION.SDK_INT}")
diff --git a/app/src/main/java/statusbar/lyric/config/Config.kt b/app/src/main/java/statusbar/lyric/config/Config.kt
index 84f54c67..dda925f8 100644
--- a/app/src/main/java/statusbar/lyric/config/Config.kt
+++ b/app/src/main/java/statusbar/lyric/config/Config.kt
@@ -48,6 +48,9 @@ class Config {
fun getGetTitle(): Boolean {
return config.optBoolean("GetTitle", false)
}
+ fun getJudgementTitle(): Boolean {
+ return config.optBoolean("JudgementTitle", true)
+ }
fun setLyricService(bool: Boolean) {
config.put("LService", bool)
@@ -351,6 +354,13 @@ class Config {
fun getBlockLyric(): String {
return config.optString("BlockLyric", "")
}
+ fun setMusicList(str: String) {
+ config.put("MusicList", str)
+ }
+
+ fun getMusicList(): String {
+ return config.optString("MusicList", "")
+ }
fun setBlockLyricOff(bool: Boolean) {
config.put("BlockLyricOff", bool)
diff --git a/app/src/main/java/statusbar/lyric/hook/app/AppleMusic.kt b/app/src/main/java/statusbar/lyric/hook/app/AppleMusic.kt
index 282a9068..0ef34741 100644
--- a/app/src/main/java/statusbar/lyric/hook/app/AppleMusic.kt
+++ b/app/src/main/java/statusbar/lyric/hook/app/AppleMusic.kt
@@ -211,7 +211,7 @@ class AppleMusic internal constructor(lpparam: LoadPackageParam) {
curInfo = curLyrics.getLyricByPosition(currentPosition)
}
if (lastLyrics != curInfo!!.lyricStr) {
- sendLyric(context, curInfo!!.lyricStr, "APM")
+ sendLyric(context, curInfo!!.lyricStr, "APM", true, "com.apple.android.music")
lastLyrics = curInfo!!.lyricStr
}
}
diff --git a/app/src/main/java/statusbar/lyric/hook/app/SystemUI.kt b/app/src/main/java/statusbar/lyric/hook/app/SystemUI.kt
index 0cc92e9f..2de109b8 100644
--- a/app/src/main/java/statusbar/lyric/hook/app/SystemUI.kt
+++ b/app/src/main/java/statusbar/lyric/hook/app/SystemUI.kt
@@ -124,8 +124,8 @@ class SystemUI : BaseHook() {
try {
if (config.getLyricService()) {
if (test) return
- if (useSystemMusicActive && !audioManager.isMusicActive) {
- offLyric(LogMultiLang.pausePlay)
+ if (!useSystemMusicActive) {
+// offLyric(LogMultiLang.pausePlay)
return
}
if (!audioManager.isMusicActive) {
@@ -240,16 +240,22 @@ class SystemUI : BaseHook() {
"com.android.systemui.statusbar.phone.NotificationIconContainer".findClassOrNull()?.hookAfterAllConstructors {
notificationIconContainer = it.thisObject as FrameLayout
}.isNull { LogUtils.e("Not find NotificationIconContainer") }
- if (config.getGetTitle()) {
- "com.android.systemui.statusbar.NotificationMediaManager".findClassOrNull()?.hookAfterMethod("updateMediaMetaData", Boolean::class.java, Boolean::class.java) {
- val mContext = it.thisObject.getObjectField("mContext") as Context
+
+ "com.android.systemui.statusbar.NotificationMediaManager".findClassOrNull()?.hookAfterMethod("updateMediaMetaData", Boolean::class.java, Boolean::class.java) {
+ val mContext = it.thisObject.getObjectField("mContext") as Context
+ if (config.getMusicList().split("|").contains(mContext.packageName)) {
val mMediaMetadata = it.thisObject.getObjectField("mMediaMetadata") as MediaMetadata?
mMediaMetadata.isNotNull {
val value = mMediaMetadata!!.getString(MediaMetadata.METADATA_KEY_TITLE)
if (lsatName != value) {
lsatName = value
- isFirstEntry = true
- Utils.sendLyric(mContext, lsatName, icon)
+ if (config.getJudgementTitle()) {
+ offLyric("test")
+ }
+ if (config.getGetTitle()) {
+ isFirstEntry = true
+ Utils.sendLyric(mContext, lsatName, icon)
+ }
}
}
}
@@ -262,7 +268,7 @@ class SystemUI : BaseHook() {
try {
param.thisObject.javaClass.getField(config.getHook())
} catch (e: NoSuchFieldError) {
- LogUtils.e(config.getHook() + " ${LogMultiLang.fieldFail}: " + e + "\n" + Utils.dumpNoSuchFieldError(e))
+ LogUtils.e(config.getHook() + " ${LogMultiLang.fieldFail}: $e\n${Utils.dumpNoSuchFieldError(e)}")
null
}
} else {
@@ -283,7 +289,7 @@ class SystemUI : BaseHook() {
arrayOf("mClockView", "mStatusClock", "mLeftClock", "mCenterClock", "mRightClock")
}
} catch (e: Throwable) {
- LogUtils.e("getPackageInfoError: $e \n" + Log.getStackTraceString(e))
+ LogUtils.e("getPackageInfoError: $e \n${Log.getStackTraceString(e)}")
arrayOf("mClockView", "mStatusClock", "mLeftClock", "mCenterClock", "mRightClock")
}
var thisField: Field? = null
@@ -293,7 +299,7 @@ class SystemUI : BaseHook() {
LogUtils.e("${LogMultiLang.tries} $field ${LogMultiLang.fieldSuccess}")
break
} catch (e: NoSuchFieldError) {
- LogUtils.e("${LogMultiLang.tries} $field ${LogMultiLang.fieldFail}: $e\n" + Log.getStackTraceString(e))
+ LogUtils.e("${LogMultiLang.tries} $field ${LogMultiLang.fieldFail}: $e\n${Log.getStackTraceString(e)}")
}
}
thisField
diff --git a/app/src/main/java/statusbar/lyric/utils/ActivityUtils.kt b/app/src/main/java/statusbar/lyric/utils/ActivityUtils.kt
index ee070db1..2a423fd6 100644
--- a/app/src/main/java/statusbar/lyric/utils/ActivityUtils.kt
+++ b/app/src/main/java/statusbar/lyric/utils/ActivityUtils.kt
@@ -22,9 +22,11 @@
package statusbar.lyric.utils
+
import android.app.Activity
import android.content.Context
import android.content.Intent
+import android.content.res.TypedArray
import android.net.Uri
import android.os.Bundle
import android.os.Handler
@@ -36,11 +38,13 @@ import org.json.JSONException
import org.json.JSONObject
import statusbar.lyric.BuildConfig
import statusbar.lyric.R
+import statusbar.lyric.config.Config
import statusbar.lyric.utils.Utils.isNotNull
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.URL
+
object ActivityUtils {
private val handler by lazy { Handler(Looper.getMainLooper()) }
@@ -148,30 +152,24 @@ object ActivityUtils {
bundle.putString("value", value)
message.data = bundle
handler.sendMessage(message)
- }else {
+ } else {
if (ActivityOwnSP.ownSPConfig.getDebug()) showToastOnLooper(activity, activity.getString(R.string.GetNewNoticeError))
}
}.start()
}
- fun getTips(activity: Activity) {
- val handler = Handler(Looper.getMainLooper()) { message: Message ->
-
- false
- }
+ fun setMusicList(activity: Activity, config: Config) {
Thread {
- val value: String? = getHttp("https://app.xiaowine.cc/app/updateTime.txt")
- if (value.isNotNull()) {
- val message = handler.obtainMessage()
- val bundle = Bundle()
- bundle.putString("value", value)
- message.data = bundle
- handler.sendMessage(message)
+ var str = ""
+ val mArray = activity.resources.getStringArray(R.array.need_module)
+ mArray.forEach {
+ str = "${it}|${str}"
}
+ config.setMusicList(str)
}.start()
}
- fun getHttp(Url: String): String? {
+ private fun getHttp(Url: String): String? {
try {
val connection = URL(Url).openConnection() as java.net.HttpURLConnection
connection.requestMethod = "GET"
diff --git a/app/src/main/java/statusbar/lyric/utils/Utils.kt b/app/src/main/java/statusbar/lyric/utils/Utils.kt
index ffffb4d3..c2f337cf 100644
--- a/app/src/main/java/statusbar/lyric/utils/Utils.kt
+++ b/app/src/main/java/statusbar/lyric/utils/Utils.kt
@@ -250,8 +250,8 @@ object Utils {
}
@JvmStatic
- fun sendLyric(context: Context, lyric: String?, icon: String?, useSystemMusicActive: Boolean, packName: String?) {
- context.sendBroadcast(Intent().apply {
+ fun sendLyric(context: Context?, lyric: String?, icon: String?, useSystemMusicActive: Boolean, packName: String?) {
+ context?.sendBroadcast(Intent().apply {
action = "Lyric_Server"
putExtra("Lyric_Data", lyric)
putExtra("Lyric_Type", "app")
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 255a928b..20dfa4de 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -28,11 +28,12 @@
* 自定义 Hook 点 (不懂勿动)
部分Hook点\nmStatusClock mClockView mLeftClock mCenterClock mRightClock
Debug 模式
- 仅获取歌词
+ * 仅获取歌词
仅获取歌词而不显示在状态栏
- * 定时关闭
- 定时关闭时长
- * 强制显示歌词标题
+ * 定时隐藏歌词
+ 定时隐藏歌词时长
+ * 强制显示音乐标题
+ * 增强停止隐藏歌词
重启 SystemUI
重置模块
关于
@@ -61,7 +62,7 @@
- 小米音乐 4.6.0 ~ 4.11.1.0(车载蓝牙歌词模式)\n
- RPlayer 未知 ~ 现今(状态栏歌词模式)\n
- 洛雪音乐 未知 ~ 现今(API模式或桌面歌词模式)\n
- - Apple Music 仅3.10.2\n\n
+ - Apple Music 3.10 ~ 4.0.0\n\n
没在此范围的版本不一定能使用,但在此范围的版本一定能使用
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 8c876374..9c0ae511 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -28,11 +28,12 @@
* 自定義Hook點 (不懂勿動)
部分Hook點\nmStatusClock mClockView mLeftClock mCenterClock mRightClock
Debug 模式
- 僅獲取歌詞
+ * 僅獲取歌詞
僅獲取歌詞而不顯示在狀態欄
- * 定時關閉
- 定時關閉時長
- * 強制顯示歌詞標題
+ * 定時隱藏歌詞
+ 定時隱藏歌詞時長
+ * 強制顯示音樂標題
+ * 增強停止隱藏歌詞
重啟 SystemUI
重置模塊
關於
@@ -61,7 +62,7 @@
- 小米音樂 4.6.0 ~ 4.11.1.0(車載藍牙歌詞模式)\n
- RPlayer 未知 ~ 現今(狀態欄歌詞模式)\n\n
- 洛雪音樂 未知 ~ 現今(API模式或桌面歌詞模式)\n
- - Apple Music 僅3.10.2\n\n
+ - Apple Music 3.10 ~ 4.0.0\n\n
沒在次範圍的版本不一定能使用,但在次範圍的版本一定能使用
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e088081c..78b17976 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -29,11 +29,12 @@
* Custom Hook (do not move if you don\'t understand)
Some Hook Points\nmStatusClock mClockView mLeftClock mCenterClock mRightClock
Debug mode
- Get lyrics only
+ * Get lyrics only
Get lyrics only without displaying them in the status bar
- * Time off
- Timed off time
- * Force the lyric title to appear
+ * Time Hide lyric
+ Timed Hide lyric time
+ * Force the music title to appear
+ * Enhanced stop hiding lyrics
Restart SystemUI
Reset module
About
@@ -62,7 +63,7 @@
- Mi Music 4.6.0 ~ 4.11.1.0 (car Bluetooth lyrics mode)\n
- RPlayer unknown ~ now (status bar lyrics mode)\n
- LX Music unknown ~ now(API mode or Desktop lyrics mode)\n
- - Apple Music only 3.10.2\n\n
+ - Apple Music 3.10 ~ 4.0.0\n\n
Versions not in this range may not be available, but versions in this range will definitely work