mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-17 06:27:29 +01:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user