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

remotes/origin/devel
yattoz 2020-01-12 14:52:25 +01:00
parent a59d57a685
commit 0b37a838e9
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package fr.forum_thalie.tsumugi.playerstore
import androidx.core.text.HtmlCompat
import androidx.lifecycle.MutableLiveData
import fr.forum_thalie.tsumugi.noConnectionValue
@ -24,8 +25,9 @@ class Song(artistTitle: String = "", _id : Int = 0) {
return "id=$id | ${artist.value} - ${title.value} | type=${type.value} | times ${startTime.value} - ${stopTime.value}\n"
}
fun setTitleArtist(data: String)
fun setTitleArtist(dataHtml: String)
{
val data = HtmlCompat.fromHtml(dataHtml, HtmlCompat.FROM_HTML_MODE_LEGACY).toString()
val hyphenPos = data.indexOf(" - ")
try {
if (hyphenPos < 0)
@ -50,8 +52,7 @@ class Song(artistTitle: String = "", _id : Int = 0) {
}
fun copy(song: Song) {
this.title.value = song.title.value
this.artist.value = song.artist.value
this.setTitleArtist(song.artist.value + " - " + song.title.value)
this.startTime.value = song.startTime.value
this.stopTime.value = song.stopTime.value
this.type.value = song.type.value