MangaUpdates tweaks (#7205)

* MangaUpdates tweaks

* Review changes

Co-authored-by: arkon <4098258+arkon@users.noreply.github.com>

* Use built in functions instead of Jsoup

Co-authored-by: arkon <4098258+arkon@users.noreply.github.com>
This commit is contained in:
Andreas
2022-05-29 00:36:28 +02:00
committed by GitHub
parent 3c40010aff
commit c8468c29f1
5 changed files with 28 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
package eu.kanade.tachiyomi.util.lang
import android.os.Build
import android.text.Html
import net.greypanther.natsort.CaseInsensitiveSimpleNaturalComparator
import java.nio.charset.StandardCharsets
import kotlin.math.floor
@@ -57,3 +59,14 @@ fun String.takeBytes(n: Int): String {
bytes.decodeToString(endIndex = n).replace("\uFFFD", "")
}
}
/**
* HTML-decode the string
*/
fun String.htmlDecode(): String {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY).toString()
} else {
Html.fromHtml(this).toString()
}
}