@@ -156,7 +156,6 @@ private val translationService: TranslationService by lazy {
156156}
157157private val queryCache = mutableMapOf<String , JishoEntry ?>()
158158private val jpCharacterRegex = Regex (" [\\ u3040-\\ u30ff\\ u4e00-\\ u9faf]" )
159- private val singleKanaRegex = Regex (" [\\ u3040-\\ u30ff]" )
160159
161160class MainActivity : AppCompatActivity () {
162161 private var translatedLyrics = listOf<String >()
@@ -269,7 +268,25 @@ class MainActivity : AppCompatActivity() {
269268 jishoRv.layoutManager = androidx.recyclerview.widget.LinearLayoutManager (this )
270269
271270 // setup text size buttons
272- // val textSizeSlider = findViewById<com.google.android.material.slider.Slider>(R.id.slider)
271+ val textSizeSlider = findViewById< com.google.android.material.slider.Slider > (R .id.textSizeSlider)
272+
273+ // Load saved text sizes
274+ val savedTextSize = sharedPrefs.getFloat(" TEXT_SIZE" , 22f )
275+
276+ // Initialize Sliders
277+ textSizeSlider.value = savedTextSize
278+
279+ // Initialize Adapter
280+ lyricAdapter?.textSize = savedTextSize
281+
282+ // Listeners for sliders
283+ val previewLyric = findViewById<TextView >(R .id.previewLyric)
284+
285+ textSizeSlider.addOnChangeListener { _, value, _ ->
286+ // Map 1-7 to something like 12sp - 32sp
287+ val newSize = 12f + (value * 3f )
288+ previewLyric.textSize = newSize
289+ }
273290
274291 // --- SETUP DEFINITION LIMIT SLIDER ---
275292 val defSlider = findViewById< com.google.android.material.slider.Slider > (R .id.slider)
@@ -780,6 +797,9 @@ class MainActivity : AppCompatActivity() {
780797 }
781798
782799 @SuppressLint(" NotifyDataSetChanged" )
800+ /*
801+ * Uses lexicological analyzer (kuromoji) to segement words -> underlines and coloring, furigana and translation fetch, and issue UI update
802+ * */
783803 private fun prefetchSongDictionary (lyrics : List <LyricLine >) {
784804 val startTime = System .currentTimeMillis()
785805 Log .d(" Lyrisync" , " Prefetch started for ${lyrics.size} lines" )
@@ -817,7 +837,8 @@ class MainActivity : AppCompatActivity() {
817837 val lineStart = System .currentTimeMillis()
818838 val lineText = line.text
819839
820- if (lineText.isBlank()) {
840+ // exceptions to skip processing
841+ if (lineText == " ..." || lineText.isBlank()) {
821842 highlightsList.add(emptyList())
822843 furiganaLyrics.add(" " )
823844 continue
@@ -1059,7 +1080,7 @@ class MainActivity : AppCompatActivity() {
10591080 if (sortedLyrics.isNotEmpty()) {
10601081 val firstLyricTime = sortedLyrics[0 ].timeMs
10611082 if (firstLyricTime > 2500 ) { // If intro is longer than 2.5s
1062- finalLyrics.add(LyricLine (1 , " ... " ))
1083+ finalLyrics.add(LyricLine (1 , " " ))
10631084 }
10641085 }
10651086
@@ -1074,9 +1095,10 @@ class MainActivity : AppCompatActivity() {
10741095 val gap = nextStart - currentStart
10751096
10761097 // If gap is > 5 seconds
1077- if (gap > 5000 ) {
1078- finalLyrics.add(LyricLine (nextStart- 5000 , " ... " ))
1098+ if (gap > 10000 ) {
1099+ finalLyrics.add(LyricLine (nextStart, " " ))
10791100 }
1101+ Log .d(" Lyrisync" , " Gap between lines: $gap at $currentLyric " )
10801102 }
10811103 }
10821104 Log .d(" Lyrisync" , " Parsed Lyrics: $finalLyrics " )
0 commit comments