Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.0.2 #510

Merged
merged 11 commits into from
Dec 30, 2024
30 changes: 0 additions & 30 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId = "statusbar.lyric"
minSdk = 26
targetSdk = 35
versionCode = 701
versionName = "7.0.1"
versionCode = 702
versionName = "7.0.2"
aaptOptions.cruncherEnabled = false
dependenciesInfo.includeInApk = false
buildConfigField("long", "BUILD_TIME", "$buildTime")
Expand Down Expand Up @@ -80,4 +80,4 @@ dependencies {

debugImplementation(libs.androidx.ui.tooling.preview)
debugImplementation(libs.androidx.ui.tooling)
}
}
7 changes: 7 additions & 0 deletions app/src/main/kotlin/statusbar/lyric/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,13 @@ class Config {
set(value) {
config.put("viewLocation", value)
}
var automateFocusedNotice: Boolean
get() {
return config.opt("automateFocusedNotice", true)
}
set(value) {
config.put("automateFocusedNotice", value)
}

private val defIconHashMap by lazy {
HashMap<String, String>().apply {
Expand Down
416 changes: 196 additions & 220 deletions app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion app/src/main/kotlin/statusbar/lyric/tools/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import statusbar.lyric.R
import statusbar.lyric.config.XposedOwnSP
import statusbar.lyric.tools.ActivityTools.isHook
import statusbar.lyric.tools.LogTools.log
import statusbar.lyric.tools.Tools.existField
import java.io.DataOutputStream
import java.util.Objects
import java.util.regex.Pattern
Expand All @@ -69,7 +70,14 @@ object Tools {

val getPhoneName by lazy {
val marketName = getSystemProperties("ro.product.marketname")
if (marketName.isNotEmpty()) marketName else Build.BRAND + Build.MODEL
if (marketName.isNotEmpty()) bigtextone(marketName) else bigtextone(Build.BRAND) + " " + Build.MODEL
}

fun bigtextone(st: String): String {
val formattedBrand = st.replaceFirstChar {
if (it.isLowerCase()) it.titlecase() else it.toString()
}
return formattedBrand
}

fun dp2px(context: Context, dpValue: Float): Int =
Expand Down Expand Up @@ -242,6 +250,10 @@ object Tools {
return this?.javaClass?.declaredFields?.any { it.name == fieldName } ?: false
}

fun Any?.existMethod(methodName: String): Boolean {
return this?.javaClass?.declaredMethods?.any { it.name == methodName } ?: false
}

fun Any.getObjectFieldIfExist(fieldName: String): Any? {
return try {
XposedHelpers.getObjectField(this, fieldName)
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/kotlin/statusbar/lyric/ui/page/IconPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,30 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import dev.chrisbanes.haze.HazeState
import dev.chrisbanes.haze.HazeStyle
import dev.chrisbanes.haze.HazeTint
import dev.chrisbanes.haze.haze
import dev.chrisbanes.haze.hazeChild
import statusbar.lyric.MainActivity.Companion.context
import statusbar.lyric.R
import statusbar.lyric.config.ActivityOwnSP.config
import statusbar.lyric.tools.ActivityTools
import statusbar.lyric.tools.ActivityTools.changeConfig
import statusbar.lyric.tools.ActivityTools.showToastOnLooper
import statusbar.lyric.tools.AnimTools
import statusbar.lyric.tools.LogTools.log
import top.yukonga.miuix.kmp.basic.BasicComponent
import top.yukonga.miuix.kmp.basic.BasicComponentDefaults
import top.yukonga.miuix.kmp.basic.ButtonDefaults
Expand Down Expand Up @@ -554,10 +559,9 @@ fun IconStartMarginsDialog(showDialog: MutableState<Boolean>) {
modifier = Modifier.padding(bottom = 16.dp),
value = value.value,
maxLines = 1,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
onValueChange = {
if (it.isEmpty() || (it.toIntOrNull() != null && it.toInt() in 0..500)) {
value.value = it
}
value.value = it
}
)
Row(
Expand All @@ -576,8 +580,12 @@ fun IconStartMarginsDialog(showDialog: MutableState<Boolean>) {
text = stringResource(R.string.ok),
colors = ButtonDefaults.textButtonColorsPrimary(),
onClick = {
config.iconStartMargins =
if (value.value.isNotEmpty()) value.value.toInt() else 0
if (value.value.toIntOrNull() != null && value.value.toInt() in -2000..2000) {
config.iconStartMargins = value.value.toInt()
} else {
config.iconStartMargins = 0
value.value = "0"
}
dismissDialog(showDialog)
changeConfig()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ fun SystemSpecialPage(navController: NavController) {
val mMiuiPadOptimize = remember { mutableStateOf(config.mMiuiPadOptimize) }
val hideCarrier = remember { mutableStateOf(config.hideCarrier) }
val mHyperOSTexture = remember { mutableStateOf(config.mHyperOSTexture) }
val mHideFocusedNotice = remember { mutableStateOf(config.automateFocusedNotice) }
val showDialog = remember { mutableStateOf(false) }
val showRadioDialog = remember { mutableStateOf(false) }
val showCornerDialog = remember { mutableStateOf(false) }
Expand Down Expand Up @@ -170,6 +171,14 @@ fun SystemSpecialPage(navController: NavController) {
.padding(horizontal = 12.dp)
.padding(bottom = 6.dp)
) {
SuperSwitch(
title = stringResource(R.string.automate_focused_notice),
checked = mHideFocusedNotice.value,
onCheckedChange = {
mHideFocusedNotice.value = it
config.automateFocusedNotice = it
}
)
SuperSwitch(
title = stringResource(R.string.hyperos_texture),
checked = mHyperOSTexture.value,
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<string name="icon_bottom_margins">アイコン下部の余白</string>
<string name="icon_bottom_margins_tips">範囲: 0~100</string>
<string name="icon_start_margins">アイコン左側の余白</string>
<string name="icon_start_margins_tips">範囲: 0~500</string>
<string name="icon_start_margins_tips">範囲: -2000~2000</string>
<string name="icon_color_and_transparency">アイコンの色と透過</string>
<string name="icon_color_and_transparency_tips">10 進数のカラーコードを入力してください</string>
<string name="icon_background_color_and_transparency">アイコンの背景色と透過</string>
Expand Down Expand Up @@ -153,4 +153,5 @@
<string name="clear_config">設定を消去</string>
<string name="clear_config_tips">設定を消去してもよろしいですか?</string>
<string name="view_location">歌詞の場所を追加</string>
<string name="automate_focused_notice">フォーカス通知の自動処理</string>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<string name="icon_bottom_margins">图标下边距</string>
<string name="icon_bottom_margins_tips">范围:0~100</string>
<string name="icon_start_margins">图标左边距</string>
<string name="icon_start_margins_tips">范围:0~500</string>
<string name="icon_start_margins_tips">范围:-2000~2000</string>
<string name="icon_color_and_transparency">图标颜色和透明度</string>
<string name="icon_color_and_transparency_tips">请输入 16 进制颜色值</string>
<string name="icon_background_color_and_transparency">图标背景颜色和透明度</string>
Expand Down Expand Up @@ -153,4 +153,5 @@
<string name="clear_config">重置配置</string>
<string name="clear_config_tips">确定要重置配置吗?</string>
<string name="view_location">歌词添加位置</string>
<string name="automate_focused_notice">自动处理焦点通知</string>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<string name="icon_bottom_margins">圖示下邊距</string>
<string name="icon_bottom_margins_tips">範圍:0~100</string>
<string name="icon_start_margins">圖示左邊距</string>
<string name="icon_start_margins_tips">範圍:0~500</string>
<string name="icon_start_margins_tips">範圍:-2000~2000</string>
<string name="icon_color_and_transparency">圖示顏色和透明度</string>
<string name="icon_color_and_transparency_tips">請輸入 16 進制顏色值</string>
<string name="icon_background_color_and_transparency">圖示背景顏色和透明度</string>
Expand Down Expand Up @@ -153,4 +153,5 @@
<string name="clear_config">重設配置</string>
<string name="clear_config_tips">確定要重設配置嗎?</string>
<string name="view_location">歌詞添加位置</string>
<string name="automate_focused_notice">自動處理焦點通知</string>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<string name="icon_bottom_margins">Icon Bottom Margins</string>
<string name="icon_bottom_margins_tips">Range: 0~100</string>
<string name="icon_start_margins">Icon Left Margins</string>
<string name="icon_start_margins_tips">Range: 0~500</string>
<string name="icon_start_margins_tips">Range: -2000~2000</string>
<string name="icon_color_and_transparency">Icon Color And Transparency</string>
<string name="icon_color_and_transparency_tips">Please enter a decimal Color</string>
<string name="icon_background_color_and_transparency">Icon background Color And Transparency</string>
Expand Down Expand Up @@ -155,4 +155,5 @@
<string name="clear_config">Clear Config</string>
<string name="clear_config_tips">Are you sure you want to clear the configuration?</string>
<string name="view_location">Lyrics add location</string>
<string name="automate_focused_notice">Automate focus notifications</string>
</resources>
Loading