mirror of
https://github.com/thunderbird/thunderbird-android.git
synced 2024-09-20 04:02:14 +02:00
Remove unused HtmlToSpanned
This commit is contained in:
parent
6e4610c4c3
commit
43818ecb6c
@ -4,7 +4,6 @@ import android.content.Context
|
||||
import com.fsck.k9.ui.base.ThemeProvider
|
||||
import com.fsck.k9.ui.helper.DisplayHtmlUiFactory
|
||||
import com.fsck.k9.ui.helper.HtmlSettingsProvider
|
||||
import com.fsck.k9.ui.helper.HtmlToSpanned
|
||||
import com.fsck.k9.ui.helper.SizeFormatter
|
||||
import com.fsck.k9.ui.messageview.LinkTextHandler
|
||||
import com.fsck.k9.ui.share.ShareIntentBuilder
|
||||
@ -12,7 +11,6 @@ import org.koin.core.qualifier.named
|
||||
import org.koin.dsl.module
|
||||
|
||||
val uiModule = module {
|
||||
single { HtmlToSpanned() }
|
||||
single<ThemeProvider> { K9ThemeProvider() }
|
||||
single { HtmlSettingsProvider(get()) }
|
||||
single { DisplayHtmlUiFactory(get()) }
|
||||
|
@ -1,45 +0,0 @@
|
||||
package com.fsck.k9.ui.helper
|
||||
|
||||
import android.text.Editable
|
||||
import android.text.Html
|
||||
import android.text.Html.TagHandler
|
||||
import android.text.Spanned
|
||||
import org.xml.sax.XMLReader
|
||||
|
||||
/**
|
||||
* Convert HTML to a [Spanned] that can be used in a [android.widget.TextView].
|
||||
*/
|
||||
class HtmlToSpanned {
|
||||
fun convert(html: String): Spanned {
|
||||
return Html.fromHtml(html, null, ListTagHandler())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [TagHandler] that supports unordered lists.
|
||||
*/
|
||||
private class ListTagHandler : TagHandler {
|
||||
override fun handleTag(opening: Boolean, tag: String, output: Editable, xmlReader: XMLReader) {
|
||||
if (tag == "ul") {
|
||||
if (opening) {
|
||||
var lastChar: Char = 0.toChar()
|
||||
if (output.isNotEmpty()) {
|
||||
lastChar = output[output.length - 1]
|
||||
}
|
||||
if (lastChar != '\n') {
|
||||
output.append("\r\n")
|
||||
}
|
||||
} else {
|
||||
output.append("\r\n")
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == "li") {
|
||||
if (opening) {
|
||||
output.append("\t• ")
|
||||
} else {
|
||||
output.append("\r\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user