Skip to content

Commit

Permalink
fix displaying of < > in post content
Browse files Browse the repository at this point in the history
  • Loading branch information
zfdang committed Jul 12, 2021
1 parent daa3816 commit 53bb0b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/com/zfdang/zsmth_android/models/Post.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.zfdang.zsmth_android.models;

import android.text.Html;
import android.text.TextUtils;
import android.util.Log;

import com.zfdang.zsmth_android.Settings;
Expand Down Expand Up @@ -233,8 +234,8 @@ public void parsePostPureContent(Element content) {
// it's important to know that not all HTML tags are supported by Html.fromHtml, see the supported list
// https://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html
// http://stackoverflow.com/questions/18295881/android-textview-html-font-size-tag
String formattedPlainText = Html.fromHtml(content.html()).toString();
this.htmlContent = this.parsePostPureContentFormat(formattedPlainText);
String formattedEscapedPlainText = TextUtils.htmlEncode(Html.fromHtml(content.html()).toString());
this.htmlContent = this.parsePostPureContentFormat(formattedEscapedPlainText);
}

public void mergePureContentAndLikes(){
Expand Down

0 comments on commit 53bb0b6

Please sign in to comment.