Pārlūkot izejas kodu

added Html decoding for UTF-8 chars decoded with ISO8859-1 by Airtime

yattoz 4 gadus atpakaļ
vecāks
revīzija
0b37a838e9

+ 4 - 3
app/src/main/java/fr/forum_thalie/tsumugi/playerstore/Song.kt Parādīt failu

1
 package fr.forum_thalie.tsumugi.playerstore
1
 package fr.forum_thalie.tsumugi.playerstore
2
 
2
 
3
+import androidx.core.text.HtmlCompat
3
 import androidx.lifecycle.MutableLiveData
4
 import androidx.lifecycle.MutableLiveData
4
 import fr.forum_thalie.tsumugi.noConnectionValue
5
 import fr.forum_thalie.tsumugi.noConnectionValue
5
 
6
 
24
         return "id=$id | ${artist.value} - ${title.value} | type=${type.value} | times ${startTime.value} - ${stopTime.value}\n"
25
         return "id=$id | ${artist.value} - ${title.value} | type=${type.value} | times ${startTime.value} - ${stopTime.value}\n"
25
     }
26
     }
26
 
27
 
27
-    fun setTitleArtist(data: String)
28
+    fun setTitleArtist(dataHtml: String)
28
     {
29
     {
30
+        val data = HtmlCompat.fromHtml(dataHtml, HtmlCompat.FROM_HTML_MODE_LEGACY).toString()
29
         val hyphenPos = data.indexOf(" - ")
31
         val hyphenPos = data.indexOf(" - ")
30
         try {
32
         try {
31
             if (hyphenPos < 0)
33
             if (hyphenPos < 0)
50
     }
52
     }
51
 
53
 
52
     fun copy(song: Song) {
54
     fun copy(song: Song) {
53
-        this.title.value = song.title.value
54
-        this.artist.value = song.artist.value
55
+        this.setTitleArtist(song.artist.value + " - " + song.title.value)
55
         this.startTime.value = song.startTime.value
56
         this.startTime.value = song.startTime.value
56
         this.stopTime.value = song.stopTime.value
57
         this.stopTime.value = song.stopTime.value
57
         this.type.value = song.type.value
58
         this.type.value = song.type.value