Skip to content

Commit

Permalink
7.1.1 (#535)
Browse files Browse the repository at this point in the history
* fix: 可能的空指针问题 (#518)

* 7.1.0

* opt: vivo 设备名称获取 & 为锚点添加 id name (#522)

* fix:优化vivo 设备名称获取
* opt:锚点模式添加id name

* opt:歌词动画添加垂直翻转和水平翻转 (#523)

* opt: change `isMiui` to `isXiaoMi` & add `Deprecated` tag for `togglePrompts` (#526)

* fix: Remove themeMode method. (#527)

* feat: Add timeout auto close lyric. (#528)

* opt: 汉化菜单文本 (#530)

* fix: Possible crashes. (#532)

* chore: Modernize code

---------

Co-authored-by: YuKongA <[email protected]>
Co-authored-by: 李太白 <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent 48c3324 commit d1fb054
Show file tree
Hide file tree
Showing 33 changed files with 341 additions and 628 deletions.
16 changes: 7 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
@file:Suppress("UnstableApiUsage")

import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import org.jetbrains.kotlin.konan.properties.Properties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.android)
}

val localProperties = Properties()
val localProperties = org.jetbrains.kotlin.konan.properties.Properties()
if (rootProject.file("local.properties").canRead()) localProperties.load(rootProject.file("local.properties").inputStream())

android {
Expand Down Expand Up @@ -56,7 +55,7 @@ android {
}
applicationVariants.all {
outputs.all {
(this as BaseVariantOutputImpl).outputFileName = "StatusBarLyric-$versionName-$versionCode-$name-$buildTime.apk"
(this as BaseVariantOutputImpl).outputFileName = "StatusBarLyric-$versionName($versionCode)-$name-$buildTime.apk"
}
}
buildFeatures.buildConfig = true
Expand All @@ -66,17 +65,16 @@ android {
dependencies {
compileOnly(libs.xposed)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.navigation.compose)
implementation(libs.miuix)
implementation(libs.haze)

implementation(libs.ezXHelper)
implementation(libs.lyricGetterApi)
implementation(libs.haze)
implementation(libs.lyric.getter.api)
implementation(libs.miuix)

debugImplementation(libs.androidx.ui.tooling.preview)
debugImplementation(libs.androidx.ui.tooling)
Expand Down
8 changes: 2 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.StatusbarLyric"
tools:ignore="AllowBackup">
android:theme="@style/Theme.StatusbarLyric">
<activity
android:name=".MainActivity"
android:enableOnBackInvokedCallback="false"
Expand All @@ -40,9 +39,6 @@
</intent-filter>
</activity-alias>

<meta-data
android:name="EasyGoClient"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="@string/xposed_tips" />
Expand All @@ -54,6 +50,6 @@
android:value="true" />
<meta-data
android:name="xposedscope"
android:resource="@array/need_module" />
android:resource="@array/xposed_scope" />
</application>
</manifest>
25 changes: 0 additions & 25 deletions app/src/main/assets/easygo.json

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/kotlin/statusbar/lyric/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
Expand Down Expand Up @@ -42,7 +43,6 @@ import statusbar.lyric.ui.page.MenuPage
import statusbar.lyric.ui.page.SystemSpecialPage
import statusbar.lyric.ui.page.TestPage
import statusbar.lyric.ui.theme.AppTheme
import top.yukonga.miuix.kmp.basic.Box
import top.yukonga.miuix.kmp.basic.Icon
import top.yukonga.miuix.kmp.basic.Scaffold
import top.yukonga.miuix.kmp.theme.MiuixTheme
Expand Down
66 changes: 30 additions & 36 deletions app/src/main/kotlin/statusbar/lyric/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import statusbar.lyric.config.ActivityOwnSP
import statusbar.lyric.config.ActivityOwnSP.config
import statusbar.lyric.config.ActivityOwnSP.updateConfigVer
Expand All @@ -24,10 +26,12 @@ import statusbar.lyric.tools.BackupTools
import statusbar.lyric.tools.ConfigTools
import statusbar.lyric.tools.LogTools
import statusbar.lyric.tools.LogTools.log
import statusbar.lyric.tools.Tools.isNotNull

class MainActivity : ComponentActivity() {
private val appTestReceiver by lazy { AppTestReceiver() }
lateinit var createDocumentLauncher: ActivityResultLauncher<Intent>
lateinit var openDocumentLauncher: ActivityResultLauncher<Intent>


companion object {
@SuppressLint("StaticFieldLeak")
Expand All @@ -41,12 +45,29 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

context = this
enableEdgeToEdge()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
window.isNavigationBarContrastEnforced = false

createDocumentLauncher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == RESULT_OK && result.data != null) {
BackupTools.handleCreateDocument(this, result.data!!.data)
}
}

openDocumentLauncher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == RESULT_OK && result.data != null) {
BackupTools.handleReadDocument(this, result.data!!.data)
Thread {
Thread.sleep(500)
ActivityTools.restartApp()
}.start()
}
}

context = this
isLoad = isHook()
init()

Expand All @@ -60,7 +81,6 @@ class MainActivity : ComponentActivity() {
super.onDestroy()
}


private fun init() {
ConfigTools(ActivityOwnSP.ownSP)
updateConfigVer()
Expand All @@ -80,7 +100,6 @@ class MainActivity : ComponentActivity() {
}
}


inner class AppTestReceiver : BroadcastReceiver() {
@Suppress("DEPRECATION", "UNCHECKED_CAST")
override fun onReceive(context: Context, intent: Intent) {
Expand All @@ -90,8 +109,8 @@ class MainActivity : ComponentActivity() {
intent.getSerializableExtra("DataList", ArrayList<Data>()::class.java)
} else {
intent.getSerializableExtra("DataList") as ArrayList<Data>
}!!
if (dataList.size == 0) {
} ?: arrayListOf()
if (dataList.isEmpty()) {
"DataList is empty".log()
Toast.makeText(context, context.getString(R.string.not_found_hook), Toast.LENGTH_SHORT).show()
testReceiver = false
Expand All @@ -105,37 +124,12 @@ class MainActivity : ComponentActivity() {
}

private fun registerReceiver() {
val filter = IntentFilter("AppTestReceiver")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(
appTestReceiver,
IntentFilter("AppTestReceiver"),
Context.RECEIVER_EXPORTED
)
context.registerReceiver(appTestReceiver, filter, RECEIVER_EXPORTED)
} else {
@Suppress("UnspecifiedRegisterReceiverFlag")
context.registerReceiver(
appTestReceiver,
IntentFilter("AppTestReceiver")
)
}
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (data.isNotNull() && resultCode == RESULT_OK) {
when (requestCode) {
BackupTools.CREATE_DOCUMENT_CODE -> {
BackupTools.handleCreateDocument(this, data!!.data)
}

BackupTools.OPEN_DOCUMENT_CODE -> {
BackupTools.handleReadDocument(this, data!!.data)
Thread {
Thread.sleep(500)
ActivityTools.restartApp()
}.start()
}
}
context.registerReceiver(appTestReceiver, filter)
}
}
}
14 changes: 7 additions & 7 deletions app/src/main/kotlin/statusbar/lyric/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ class Config {
set(value) {
config.put("limitVisibilityChange", value)
}
var timeoutRestore: Boolean
get() {
return config.opt("timeoutRestore", true)
}
set(value) {
config.put("timeoutRestore", value)
}
var longClickStatusBarStop: Boolean
get() {
return config.opt("longClickStatusBarStop", false)
Expand Down Expand Up @@ -345,13 +352,6 @@ class Config {
set(value) {
config.put("hideCarrier", value)
}
var lyricColorScheme: Int
get() {
return config.opt("lyricColorScheme", 0)
}
set(value) {
config.put("lyricColorScheme", value)
}
var dynamicLyricSpeed: Boolean
get() {
return config.opt("dynamicLyricSpeed", false)
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/kotlin/statusbar/lyric/data/Data.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Data private constructor(parcel: Parcel) : Parcelable {
var isRepeat: Boolean = false
var index: Int = 0
var textSize: Float = 0f
var idName: String = ""
override fun describeContents(): Int {
return 0
}
Expand All @@ -23,7 +24,8 @@ class Data private constructor(parcel: Parcel) : Parcelable {
parentViewId: Int,
isRepeat: Boolean,
index: Int,
size: Float
size: Float,
idName: String
) : this() {
this.textViewClassName = textViewClassName
this.textViewId = textViewId
Expand All @@ -32,6 +34,7 @@ class Data private constructor(parcel: Parcel) : Parcelable {
this.isRepeat = isRepeat
this.index = index
this.textSize = size
this.idName = idName
}

override fun writeToParcel(dest: Parcel, flags: Int) {
Expand All @@ -43,6 +46,7 @@ class Data private constructor(parcel: Parcel) : Parcelable {
writeInt(if (isRepeat) 1 else 0)
writeInt(index)
writeFloat(textSize)
writeString(idName)
}
}

Expand All @@ -54,6 +58,7 @@ class Data private constructor(parcel: Parcel) : Parcelable {
isRepeat = parcel.readInt() == 1
index = parcel.readInt()
textSize = parcel.readFloat()
idName = parcel.readString().toString()
}

companion object CREATOR : Parcelable.Creator<Data> {
Expand All @@ -67,6 +72,6 @@ class Data private constructor(parcel: Parcel) : Parcelable {
}

override fun toString(): String {
return "Data(textViewClassName='$textViewClassName', textViewId=$textViewId, parentViewClassName='$parentViewClassName', parentViewId=$parentViewId, isRepeat=$isRepeat, index=$index, textSize=$textSize)"
return "Data(textViewClassName='$textViewClassName', textViewId=$textViewId, parentViewClassName='$parentViewClassName', parentViewId=$parentViewId, isRepeat=$isRepeat, index=$index, textSize=$textSize idName=$idName)"
}
}
6 changes: 5 additions & 1 deletion app/src/main/kotlin/statusbar/lyric/hook/MainHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class MainHook : IXposedHookLoadPackage, IXposedHookZygoteInit {
initHooks(SystemUITest())
} else {
moduleRes.getString(R.string.lyric_mode).log()
initHooks(SystemUILyric())
try {
initHooks(SystemUILyric())
} catch (t: Throwable) {
t.log()
}
}
}

Expand Down
Loading

0 comments on commit d1fb054

Please sign in to comment.