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

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

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ class SystemUILyric : BaseHook() {
}

val animation = config.lyricAnimation
isRandomAnima = animation == 9
isRandomAnima = animation == 11
if (!isRandomAnima) {
val interpolator = config.lyricInterpolator
val duration = config.animationDuration
Expand Down
26 changes: 25 additions & 1 deletion app/src/main/kotlin/statusbar/lyric/tools/LyricViewTools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import android.widget.ImageView
import statusbar.lyric.view.LyricSwitchView

object LyricViewTools {
private var animaList: ArrayList<Int> = arrayListOf(1, 2, 3, 4, 5, 6, 7, 8)
private var animaList: ArrayList<Int> = arrayListOf(1, 2, 3, 4, 5, 6, 7, 8, 9 ,10)
val randomAnima: Int get() = animaList.random()

fun getAlphaAnimation(into: Boolean, duration: Long = 250): AnimationSet {
Expand All @@ -42,6 +42,18 @@ object LyricViewTools {
6 -> ScaleAnimation(0f, 1f, 0f, 1f)
7 -> ScaleAnimation(0f, 1f, 1f, 1f)
8 -> ScaleAnimation(1f, 1f, 0f, 1f)
9 -> ScaleAnimation(
-1f, 1f, // X 方向从正常比例翻转到反向
1f, 1f, // Y 方向保持不变
Animation.RELATIVE_TO_SELF, 0.5f, // X 轴中心点:视图的中间
Animation.RELATIVE_TO_SELF, 0.5f // Y 轴中心点:视图的中间
)
10 -> ScaleAnimation(
1f, 1f, // X 方向保持不变
-1f, 1f, // Y 方向从正常比例翻转到反向
Animation.RELATIVE_TO_SELF, 0.5f, // X 轴中心点:视图的中间
Animation.RELATIVE_TO_SELF, 0.5f // Y 轴中心点:视图的中间
)
else -> return null
}?.apply {
duration = t
Expand All @@ -64,6 +76,18 @@ object LyricViewTools {
6 -> ScaleAnimation(1f, 0f, 1f, 0f)
7 -> ScaleAnimation(1f, 0f, 1f, 1f)
8 -> ScaleAnimation(1f, 1f, 1f, 0f)
9 -> ScaleAnimation(
1f, -1f, // X 方向从正常比例翻转到反向
1f, 1f, // Y 方向保持不变
Animation.RELATIVE_TO_SELF, 0.5f, // X 轴中心点:视图的中间
Animation.RELATIVE_TO_SELF, 0.5f // Y 轴中心点:视图的中间
)
10 -> ScaleAnimation(
1f, 1f, // X 方向保持不变
1f, -1f, // Y 方向从正常比例翻转到反向
Animation.RELATIVE_TO_SELF, 0.5f, // X 轴中心点:视图的中间
Animation.RELATIVE_TO_SELF, 0.5f // Y 轴中心点:视图的中间
)
else -> return null
}?.apply {
duration = t
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/kotlin/statusbar/lyric/ui/page/LyricPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ fun LyricPage(navController: NavController, currentStartDestination: MutableStat
stringResource(R.string.lyrics_animation_scale_x_y),
stringResource(R.string.lyrics_animation_scale_x),
stringResource(R.string.lyrics_animation_scale_y),
stringResource(R.string.lyrics_animation_horizontalflip),
stringResource(R.string.lyrics_animation_verticalflip),
stringResource(R.string.lyrics_animation_random),
)
val lyricAnimSelectedOption = remember { mutableIntStateOf(config.lyricAnimation) }
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,6 @@
<string name="clear_config_tips">确定要重置配置吗?</string>
<string name="view_location">歌词添加位置</string>
<string name="automate_focused_notice">自动处理焦点通知</string>
<string name="lyrics_animation_horizontalflip">"水平翻转"</string>
<string name="lyrics_animation_verticalflip">垂直翻转</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,6 @@
<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>
<string name="lyrics_animation_horizontalflip">Horizontal Flip</string>
<string name="lyrics_animation_verticalflip">Vertical Flip</string>
</resources>
Loading