Skip to content

Native Android client for Spotify, built with Jetpack Compose

Lyrics: one companion for the share limit and the language check after the merge of the 30/10 lines [skip ci]

kota-zo3515a10d6bf3
diff --git a/base/app/src/main/java/com/music/spotui/ui/viewmodel/LyricsViewModel.kt b/base/app/src/main/java/com/music/spotui/ui/viewmodel/LyricsViewModel.kt
index 4e4b5371..29d985d0 100644
--- a/base/app/src/main/java/com/music/spotui/ui/viewmodel/LyricsViewModel.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/viewmodel/LyricsViewModel.kt
@@ -33,6 +33,11 @@ class LyricsViewModel constructor() : ViewModel() {
companion object {
/** How many consecutive lines one share takes (Spotify's own card takes five). */
const val MAX_SHARED_LINES = 6
+
+ /** Whether [source] is [target]'s language, regions apart: nothing to translate then. */
+ fun sameLanguage(source: String?, target: String): Boolean =
+ source?.substringBefore('-')
+ ?.equals(target.substringBefore('-'), ignoreCase = true) == true
}
private val _state = MutableStateFlow<State>(State.Loading)
@@ -243,11 +248,4 @@ class LyricsViewModel constructor() : ViewModel() {
}
}
}
-
- companion object {
- /** Whether [source] is [target]'s language, regions apart: nothing to translate then. */
- fun sameLanguage(source: String?, target: String): Boolean =
- source?.substringBefore('-')
- ?.equals(target.substringBefore('-'), ignoreCase = true) == true
- }
}