Now escape BBCode

This commit is contained in:
Pierre HUBERT 2018-12-28 09:30:47 +01:00
parent 8fa4c5bcc4
commit aac87943ed
2 changed files with 16 additions and 1 deletions

View File

@ -148,4 +148,14 @@ public class StringsUtils {
return result;
}
/**
* Remove all BBCode tags of a given string
*
* @param string The string to update
* @return The same string, without any bbcode tags
*/
public static String RemoveBBCode(String string){
return string.replaceAll("\\[[a-zA-Z1-9/=#]{1,10}]", "");
}
}

View File

@ -20,6 +20,7 @@ import org.communiquons.android.comunic.client.data.enums.PageType;
import org.communiquons.android.comunic.client.data.models.Comment;
import org.communiquons.android.comunic.client.data.models.Post;
import org.communiquons.android.comunic.client.data.models.UserInfo;
import org.communiquons.android.comunic.client.data.utils.StringsUtils;
import org.communiquons.android.comunic.client.data.utils.TimeUtils;
import org.communiquons.android.comunic.client.ui.listeners.onPostUpdateListener;
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
@ -315,7 +316,11 @@ public class PostsAdapter extends BaseRecyclerViewAdapter {
//Set post content
mPostContent.setParsedText(UiUtils.prepareStringTextView(post.getContent()));
mPostContent.setParsedText(
StringsUtils.RemoveBBCode(
UiUtils.prepareStringTextView(post.getContent())
)
);
//Post likes