Skip to content

Commit

Permalink
Merge pull request #52 from cintory/develop
Browse files Browse the repository at this point in the history
查询结果不解析复杂标签
  • Loading branch information
ykrank authored Jun 14, 2024
2 parents 5c2587d + d5ee1e8 commit c6c8a3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package me.ykrank.s1next.data.api.model.search

import android.text.Spanned
import com.github.ykrank.androidtools.ui.adapter.StableIdModel
import me.ykrank.s1next.widget.span.HtmlCompat

/**
* Created by ykrank on 2016/10/18.
Expand All @@ -9,6 +11,16 @@ import com.github.ykrank.androidtools.ui.adapter.StableIdModel
class ForumSearchResult : StableIdModel, SearchResult() {

var content: String? = null
private var _htmlContent: Spanned? = null
val htmlContent: Spanned?
get() {
if (_htmlContent == null && content != null)
_htmlContent = HtmlCompat.fromHtml(
content,
HtmlCompat.FROM_HTML_MODE_COMPACT_EXCLUDE_BLOCKQUOTE
)
return _htmlContent
}

override fun equals(o: Any?): Boolean {
if (this === o) return true
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_search_forum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:lineSpacingExtra="@dimen/text_line_spacing_extra"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textIsSelectable="true"
app:imgHtml="@{model.content}"
android:text="@{model.htmlContent}"
app:movementMethod="@{SearchMovementMethod.instance}"
tools:text="ABC\nkhk"/>

Expand Down

0 comments on commit c6c8a3c

Please sign in to comment.