mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-31 13:48:20 +01:00
[Messages/Compose] Enable HTML messages for Idziennik.
This commit is contained in:
parent
37a5bea79b
commit
4edabbb186
@ -438,7 +438,7 @@ class MessagesComposeFragment : Fragment(), CoroutineScope {
|
|||||||
if (b.textLayout.counterMaxLength != -1 && b.text.length() > b.textLayout.counterMaxLength)
|
if (b.textLayout.counterMaxLength != -1 && b.text.length() > b.textLayout.counterMaxLength)
|
||||||
return
|
return
|
||||||
|
|
||||||
var textHtml = if (app.profile.loginStoreType != LoginStore.LOGIN_TYPE_VULCAN && app.profile.loginStoreType != LoginStore.LOGIN_TYPE_IDZIENNIK) {
|
var textHtml = if (app.profile.loginStoreType != LoginStore.LOGIN_TYPE_VULCAN) {
|
||||||
HtmlCompat.toHtml(SpannableString(text), HtmlCompat.TO_HTML_PARAGRAPH_LINES_INDIVIDUAL)
|
HtmlCompat.toHtml(SpannableString(text), HtmlCompat.TO_HTML_PARAGRAPH_LINES_INDIVIDUAL)
|
||||||
.replace("\n", "")
|
.replace("\n", "")
|
||||||
.replace(" dir=\"ltr\"", "")
|
.replace(" dir=\"ltr\"", "")
|
||||||
|
@ -6,12 +6,11 @@ package pl.szczodrzynski.edziennik.utils.html
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Build
|
|
||||||
import android.text.Html
|
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import android.text.style.BulletSpan
|
import android.text.style.BulletSpan
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
import androidx.core.text.HtmlCompat
|
||||||
import pl.szczodrzynski.edziennik.dp
|
import pl.szczodrzynski.edziennik.dp
|
||||||
import pl.szczodrzynski.edziennik.resolveAttr
|
import pl.szczodrzynski.edziennik.resolveAttr
|
||||||
import pl.szczodrzynski.navlib.blendColors
|
import pl.szczodrzynski.navlib.blendColors
|
||||||
@ -59,16 +58,12 @@ object BetterHtml {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
val htmlSpannable = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
val htmlSpannable = HtmlCompat.fromHtml(
|
||||||
Html.fromHtml(
|
text,
|
||||||
text,
|
HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM or HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_LIST or HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_DIV,
|
||||||
Html.FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM or Html.FROM_HTML_SEPARATOR_LINE_BREAK_LIST or Html.FROM_HTML_SEPARATOR_LINE_BREAK_DIV,
|
null,
|
||||||
null,
|
LiTagHandler()
|
||||||
LiTagHandler()
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Html.fromHtml(text, null, LiTagHandler())
|
|
||||||
}
|
|
||||||
|
|
||||||
val spannableBuilder = SpannableStringBuilder(htmlSpannable)
|
val spannableBuilder = SpannableStringBuilder(htmlSpannable)
|
||||||
val bulletSpans = spannableBuilder.getSpans(0, spannableBuilder.length, BulletSpan::class.java)
|
val bulletSpans = spannableBuilder.getSpans(0, spannableBuilder.length, BulletSpan::class.java)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user