Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit bd2ec99

Browse files
HChenXYuKongAYunZiAdependabot[bot]
authored
7.2.0 (#582)
* opt: support portrait full screen hide lyric. (#551) * build: Compatible with SDK 36 * opt: haze blur tint * opt: navigationBar padding * and small window captionBar display * opt: 优化导航页配置 (#557) --------- Co-authored-by: YuKongA <[email protected]> * chore: Remove restartXiaomiSystemUI * HyperOS2.2 fixed this * opt: cleanup code * chore: Make navController more perfect * opt: enableOnBackInvokedCallback * opt: Disable onBackInvokedCallback * build(deps): bump top.yukonga.miuix.kmp:miuix from 0.3.6 to 0.3.8 * fix: WindowInsets issue caused by miuix 0.3.8 * opt: remove SystemMediaSessionListener.kt (#560) - Update API to 7.0. - Optimize lyric title retrieval. * feat: Use SuperLyricAPI instead of LyricGetterAPI (#561) * chore: Add SuperLyric install tips * chore: Remove useless resource files * ci: Build CI with SuperLyric API (#563) * Bump androidx.core:core-ktx from 1.15.0 to 1.16.0 (#564) * Bump com.github.HChenX:SuperLyricApi from 1.3 to 1.4 (#565) * fix: Unable to display icon * app: Bump version to 7.2.0 * Used to determine the SuperLyricAPI version * opt: Display lyric when unlocked * chore: Rewrite whether lyric should be displayed * Needs more testing * chore: Unified log format * chore: Fix a crash if clockView is not initialized * opt: 缓解看不到第一句歌词的问题 * feat: enhance lyric display and control (#567) - Added logic to show lyrics when music is playing and not hidden - Implemented click and long-click actions on the status bar to hide/show lyrics and control music playback - Improved lyric hiding/showing mechanism based on music playback state and user interactions - Integrated focus notification control for a seamless user experience - Fixed issues related to lyric view visibility and interactions with system UI components - Optimized lyric display behavior in full-screen mode and during screen lock/unlock events * fix: SystemUI Lyric show/hide logic when status bar collapsed (#568) * feat: Add animation cancellation for lyric view (#569) * ui: Switch to use foundation LazyColumn * chore: Change link * point to the SuperLyric download page * chore: Add missing copyright header * feat: 拆解焦点通知至单独类,重构逻辑(大改警告) * opt: remove hide lyric animation. * opt: when hide lyric, set text to "". * fix: 点击状态栏隐藏歌词 * fix: focus notify bugs. * chore: 一波究极大改(应该没什么问题) * 统一全部输入框的输入逻辑 * 分离全部 Xiaomi 相关 Hook * 修改 applicationContext 传递 * Debug 版本日志默认输出,因此移除选项 * 使用 single() 代替 first() 来确保 Hook 方法正确 * chore: Add missing copyright header again * opt: code. * fix: Fixed OwnSP sometimes output crash logs also: * 提升 minSdk 到 30,同步 SuperLyric * 移除 onWallpaperChanged Hook,应该不需要了 * opt: 修正歌词滚动速度计算 * ci: Dont upload mapping * feat: API to 1.7 * feat: Add Gramophone default icon * Bump dev.chrisbanes.haze:haze from 1.5.2 to 1.5.3 (#571) * Bump dev.chrisbanes.haze:haze from 1.5.3 to 1.5.4 (#573) Bumps [dev.chrisbanes.haze:haze](https://github.com/chrisbanes/haze) from 1.5.3 to 1.5.4. - [Release notes](https://github.com/chrisbanes/haze/releases) - [Commits](chrisbanes/haze@1.5.3...1.5.4) --- updated-dependencies: - dependency-name: dev.chrisbanes.haze:haze dependency-version: 1.5.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: 修复已选择锚点但可能无法挂载锚点的问题 * Bump top.yukonga.miuix.kmp:miuix from 0.4.0 to 0.4.1 (#574) Bumps [top.yukonga.miuix.kmp:miuix](https://github.com/miuix-kotlin-multiplatform/miuix) from 0.4.0 to 0.4.1. - [Release notes](https://github.com/miuix-kotlin-multiplatform/miuix/releases) - [Commits](compose-miuix-ui/miuix@v0.4.0...v0.4.1) --- updated-dependencies: - dependency-name: top.yukonga.miuix.kmp:miuix dependency-version: 0.4.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump com.android.application from 8.9.1 to 8.9.2 (#575) Bumps com.android.application from 8.9.1 to 8.9.2. --- updated-dependencies: - dependency-name: com.android.application dependency-version: 8.9.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump androidx.compose.foundation:foundation from 1.7.8 to 1.8.0 (#576) Bumps androidx.compose.foundation:foundation from 1.7.8 to 1.8.0. --- updated-dependencies: - dependency-name: androidx.compose.foundation:foundation dependency-version: 1.8.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * app: Allow custom horizontal screen page ratio * build(deps): Use `miuix-android` instead of `miuix` * app: Remove landscape navigate transition anim * fix: 部分情况下与焦点通知冲突的问题 * fix: 优化超出分割线允许滑动范围时的效果 * Bump com.android.application from 8.9.2 to 8.10.0 (#578) Bumps com.android.application from 8.9.2 to 8.10.0. --- updated-dependencies: - dependency-name: com.android.application dependency-version: 8.10.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump androidx.compose.foundation:foundation from 1.8.0 to 1.8.1 (#580) Bumps androidx.compose.foundation:foundation from 1.8.0 to 1.8.1. --- updated-dependencies: - dependency-name: androidx.compose.foundation:foundation dependency-version: 1.8.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump androidx.navigation:navigation-compose from 2.8.9 to 2.9.0 Bumps androidx.navigation:navigation-compose from 2.8.9 to 2.9.0. --- updated-dependencies: - dependency-name: androidx.navigation:navigation-compose dependency-version: 2.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * app: Set all overscrollEffect to null * Bump top.yukonga.miuix.kmp:miuix-android from 0.4.2 to 0.4.3 (#581) * Bump top.yukonga.miuix.kmp:miuix-android from 0.4.2 to 0.4.3 Bumps [top.yukonga.miuix.kmp:miuix-android](https://github.com/miuix-kotlin-multiplatform/miuix) from 0.4.2 to 0.4.3. - [Release notes](https://github.com/miuix-kotlin-multiplatform/miuix/releases) - [Commits](compose-miuix-ui/miuix@v0.4.2...v0.4.3) --- updated-dependencies: - dependency-name: top.yukonga.miuix.kmp:miuix-android dependency-version: 0.4.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: YuKongA <[email protected]> * opt: 超时恢复的判断条件 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: YuKongA <[email protected]> Co-authored-by: YunZiA <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent c8c74f5 commit bd2ec99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1745
-1565
lines changed

app/build.gradle.kts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
@file:Suppress("UnstableApiUsage")
22

33
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
4+
import org.jetbrains.kotlin.konan.properties.Properties
45

56
plugins {
67
alias(libs.plugins.android.application)
78
alias(libs.plugins.compose.compiler)
89
alias(libs.plugins.kotlin.android)
910
}
1011

11-
val localProperties = org.jetbrains.kotlin.konan.properties.Properties()
12-
if (rootProject.file("local.properties").canRead()) localProperties.load(rootProject.file("local.properties").inputStream())
12+
val buildTime = System.currentTimeMillis()
13+
val localProperties = Properties()
14+
if (rootProject.file("local.properties").canRead()) {
15+
localProperties.load(rootProject.file("local.properties").inputStream())
16+
}
1317

1418
android {
1519
namespace = "statusbar.lyric"
1620
compileSdk = 36
17-
val buildTime = System.currentTimeMillis()
21+
1822
defaultConfig {
1923
applicationId = "statusbar.lyric"
20-
minSdk = 26
24+
minSdk = 30
2125
targetSdk = 36
22-
versionCode = 713
23-
versionName = "7.1.3"
24-
aaptOptions.cruncherEnabled = false
25-
dependenciesInfo.includeInApk = false
26+
versionCode = 720
27+
versionName = "7.2.0"
2628
buildConfigField("long", "BUILD_TIME", "$buildTime")
27-
buildConfigField("int", "API_VERSION", "6")
2829
buildConfigField("int", "COMPOSE_CONFIG_VERSION", "1")
2930
}
3031
val config = localProperties.getProperty("androidStoreFile")?.let {
@@ -48,18 +49,16 @@ android {
4849
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
4950
}
5051
}
51-
packaging {
52-
resources {
53-
excludes += "**"
54-
}
55-
}
5652
applicationVariants.all {
5753
outputs.all {
5854
(this as BaseVariantOutputImpl).outputFileName = "StatusBarLyric-$versionName($versionCode)-$name-$buildTime.apk"
5955
}
6056
}
57+
aaptOptions.cruncherEnabled = false
6158
buildFeatures.buildConfig = true
59+
dependenciesInfo.includeInApk = false
6260
kotlin.jvmToolchain(21)
61+
packaging.resources.excludes += "**"
6362
}
6463

6564
dependencies {
@@ -71,11 +70,13 @@ dependencies {
7170
implementation(libs.androidx.navigation.compose)
7271
implementation(libs.androidx.ui)
7372
implementation(libs.androidx.ui.graphics)
74-
implementation(libs.ezXHelper)
73+
7574
implementation(libs.haze)
76-
implementation(libs.lyric.getter.api)
7775
implementation(libs.miuix)
7876

77+
implementation(libs.ezXHelper)
78+
implementation(libs.superlyricapi)
79+
7980
debugImplementation(libs.androidx.ui.tooling.preview)
8081
debugImplementation(libs.androidx.ui.tooling)
8182
}

app/proguard-rules.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
-optimizationpasses 5
2323
-keep class statusbar.lyric.hook.MainHook { <init>(); }
2424
-keep class statusbar.lyric.tools.ActivityTools { isHook(); }
25-
-keep class cn.lyric.getter.api.data.* { *; }
2625
-dontskipnonpubliclibraryclassmembers
2726
-allowaccessmodification
2827
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable

app/src/main/kotlin/statusbar/lyric/App.kt

Lines changed: 70 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* StatusBarLyric
3+
* Copyright (C) 2021-2022 [email protected]
4+
* https://github.com/Block-Network/StatusBarLyric
5+
*
6+
* This software is free opensource software: you can redistribute it
7+
* and/or modify it under the terms of the GNU General Public License
8+
* as published by the Free Software Foundation; either
9+
* version 3 of the License, or any later version and our eula as
10+
* published by Block-Network contributors.
11+
*
12+
* This software is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* and eula along with this software. If not, see
19+
* <https://www.gnu.org/licenses/>
20+
* <https://github.com/Block-Network/StatusBarLyric/blob/main/LICENSE>.
21+
*/
22+
123
package statusbar.lyric
224

325
import android.annotation.SuppressLint
@@ -8,31 +30,34 @@ import androidx.compose.animation.fadeIn
830
import androidx.compose.animation.fadeOut
931
import androidx.compose.animation.slideInHorizontally
1032
import androidx.compose.animation.slideOutHorizontally
11-
import androidx.compose.foundation.Canvas
33+
import androidx.compose.foundation.gestures.Orientation
34+
import androidx.compose.foundation.gestures.draggable
35+
import androidx.compose.foundation.gestures.rememberDraggableState
1236
import androidx.compose.foundation.layout.Box
1337
import androidx.compose.foundation.layout.BoxWithConstraints
1438
import androidx.compose.foundation.layout.Row
15-
import androidx.compose.foundation.layout.fillMaxHeight
1639
import androidx.compose.foundation.layout.fillMaxSize
1740
import androidx.compose.foundation.layout.padding
1841
import androidx.compose.foundation.layout.size
19-
import androidx.compose.foundation.layout.width
2042
import androidx.compose.runtime.Composable
21-
import androidx.compose.runtime.LaunchedEffect
22-
import androidx.compose.runtime.MutableState
23-
import androidx.compose.runtime.mutableStateOf
43+
import androidx.compose.runtime.derivedStateOf
44+
import androidx.compose.runtime.getValue
45+
import androidx.compose.runtime.mutableFloatStateOf
2446
import androidx.compose.runtime.remember
47+
import androidx.compose.runtime.rememberUpdatedState
48+
import androidx.compose.runtime.setValue
2549
import androidx.compose.ui.Alignment
2650
import androidx.compose.ui.Modifier
27-
import androidx.compose.ui.geometry.Offset
2851
import androidx.compose.ui.platform.LocalConfiguration
2952
import androidx.compose.ui.res.painterResource
3053
import androidx.compose.ui.unit.dp
3154
import androidx.navigation.NavGraphBuilder
3255
import androidx.navigation.NavHostController
3356
import androidx.navigation.compose.NavHost
3457
import androidx.navigation.compose.composable
58+
import androidx.navigation.compose.currentBackStackEntryAsState
3559
import androidx.navigation.compose.rememberNavController
60+
import statusbar.lyric.config.ActivityOwnSP.config
3661
import statusbar.lyric.ui.page.ChoosePage
3762
import statusbar.lyric.ui.page.ExtendPage
3863
import statusbar.lyric.ui.page.HomePage
@@ -44,6 +69,7 @@ import statusbar.lyric.ui.page.TestPage
4469
import statusbar.lyric.ui.theme.AppTheme
4570
import top.yukonga.miuix.kmp.basic.Icon
4671
import top.yukonga.miuix.kmp.basic.Scaffold
72+
import top.yukonga.miuix.kmp.basic.VerticalDivider
4773
import top.yukonga.miuix.kmp.theme.MiuixTheme
4874
import top.yukonga.miuix.kmp.utils.getWindowSize
4975

@@ -54,14 +80,9 @@ fun App() {
5480
val isLandscape = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
5581
val navController = rememberNavController()
5682

57-
val currentRoute = remember {
58-
mutableStateOf(navController.currentDestination?.route ?: "")
59-
}
60-
61-
LaunchedEffect(navController) {
62-
navController.addOnDestinationChangedListener { _, destination, _ ->
63-
currentRoute.value = destination.route ?: ""
64-
}
83+
val navBackStackEntry by navController.currentBackStackEntryAsState()
84+
val currentRoute by remember(navBackStackEntry) {
85+
derivedStateOf { navBackStackEntry?.destination?.route ?: "HomePage" }
6586
}
6687

6788
AppTheme {
@@ -80,9 +101,10 @@ fun App() {
80101
@Composable
81102
fun PortraitLayout(
82103
navController: NavHostController,
83-
currentRoute: MutableState<String>
104+
currentRoute: String
84105
) {
85-
val windowWidth = getWindowSize().width
106+
val getWindowSize by rememberUpdatedState(getWindowSize())
107+
val windowWidth = getWindowSize.width
86108
val easing = CubicBezierEasing(0.12f, 0.38f, 0.2f, 1f)
87109

88110
NavHost(
@@ -127,55 +149,50 @@ fun PortraitLayout(
127149
@Composable
128150
fun LandscapeLayout(
129151
navController: NavHostController,
130-
currentRoute: MutableState<String>
152+
currentRoute: String
131153
) {
132-
val windowWidth = getWindowSize().width
133-
val easing = CubicBezierEasing(0.12f, 0.88f, 0.2f, 1f)
134-
val dividerLineColor = MiuixTheme.colorScheme.dividerLine
154+
val getWindowSize by rememberUpdatedState(getWindowSize())
155+
val windowWidth = getWindowSize.width
156+
var weight by remember { mutableFloatStateOf(config.pageRatio) }
157+
var potentialWeight by remember { mutableFloatStateOf(weight) }
158+
val dragState = rememberDraggableState {
159+
val nextPotentialWeight = potentialWeight + it / windowWidth
160+
potentialWeight = nextPotentialWeight
161+
weight = nextPotentialWeight.coerceIn(0.35f, 0.65f)
162+
}
163+
var finalWeight by remember { mutableFloatStateOf(weight) }
135164

136165
Row(
137166
modifier = Modifier
138167
.fillMaxSize()
139168
.padding(horizontal = 12.dp)
140169
) {
141170
Box(
142-
modifier = Modifier.weight(0.88f)
171+
modifier = Modifier.weight(weight)
143172
) {
144173
HomePage(navController, currentRoute)
145174
}
146-
Canvas(
147-
Modifier
148-
.fillMaxHeight()
175+
VerticalDivider(
176+
modifier = Modifier
177+
.draggable(
178+
state = dragState,
179+
orientation = Orientation.Horizontal,
180+
onDragStarted = {
181+
potentialWeight = weight
182+
},
183+
onDragStopped = {
184+
finalWeight = weight
185+
config.pageRatio = finalWeight
186+
}
187+
)
149188
.padding(horizontal = 12.dp)
150-
.width(0.75.dp)
151-
) {
152-
drawLine(
153-
color = dividerLineColor,
154-
strokeWidth = 0.75.dp.toPx(),
155-
start = Offset(0.75.dp.toPx() / 2, 0f),
156-
end = Offset(0.75.dp.toPx() / 2, size.height),
157-
)
158-
}
189+
)
159190
NavHost(
160191
navController = navController,
161192
startDestination = "HomePage",
162-
modifier = Modifier.weight(1f),
163-
enterTransition = {
164-
slideInHorizontally(
165-
initialOffsetX = { windowWidth },
166-
animationSpec = tween(durationMillis = 500, easing = easing)
167-
) + fadeIn(
168-
animationSpec = tween(durationMillis = 200)
169-
)
170-
},
171-
exitTransition = {
172-
slideOutHorizontally(
173-
targetOffsetX = { windowWidth / 5 },
174-
animationSpec = tween(durationMillis = 500, easing = easing)
175-
) + fadeOut(
176-
animationSpec = tween(durationMillis = 500)
177-
)
178-
},
193+
modifier = Modifier.weight(1f - weight),
194+
enterTransition = { fadeIn(initialAlpha = 1f) },
195+
exitTransition = { fadeOut(targetAlpha = 1f) },
179196
) {
180197
composable("HomePage") { EmptyPage() }
181198
pageDestinations(navController, currentRoute)
@@ -185,7 +202,7 @@ fun LandscapeLayout(
185202

186203
fun NavGraphBuilder.pageDestinations(
187204
navController: NavHostController,
188-
currentRoute: MutableState<String>
205+
currentRoute: String
189206
) {
190207
composable("ChoosePage") { ChoosePage(navController) }
191208
composable("TestPage") { TestPage(navController, currentRoute) }
@@ -194,7 +211,6 @@ fun NavGraphBuilder.pageDestinations(
194211
composable("IconPage") { IconPage(navController) }
195212
composable("ExtendPage") { ExtendPage(navController) }
196213
composable("SystemSpecialPage") { SystemSpecialPage(navController) }
197-
198214
}
199215

200216
@Composable
@@ -207,7 +223,7 @@ fun EmptyPage() {
207223
painter = painterResource(R.drawable.ic_launcher_foreground),
208224
contentDescription = null,
209225
tint = MiuixTheme.colorScheme.secondary,
210-
modifier = Modifier.size(256.dp)
226+
modifier = Modifier.size(300.dp)
211227
)
212228
}
213229
}

0 commit comments

Comments
 (0)