Fix regex for matching heading.

This commit is contained in:
Alex Ning 2021-01-18 16:52:28 +08:00
parent 453b56d485
commit c7f776b048
2 changed files with 7 additions and 9 deletions

View File

@ -390,9 +390,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
glide.load(getDrawable(R.drawable.subreddit_default_icon))
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
.into(iconGifImageView);
iconGifImageView.setOnClickListener(view -> {
//Do nothing as it is a default icon
});
iconGifImageView.setOnClickListener(null);
} else {
glide.load(subredditData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))

View File

@ -41,12 +41,12 @@ public class Utils {
.replaceAll("((?<=[\\s])|^)/[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com$0)")
.replaceAll("((?<=[\\s])|^)[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com/$0)")
.replaceAll("\\^{2,}", "^")
.replaceAll("^#(?!($|\\s))", "# ")
.replaceAll("^##(?!($|\\s))", "## ")
.replaceAll("^###(?!($|\\s))", "### ")
.replaceAll("^####(?!($|\\s))", "#### ")
.replaceAll("^#####(?!($|\\s))", "##### ")
.replaceAll("^######(?!($|\\s))", "###### "));
.replaceAll("(^|^ *|\\n *)#(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)##(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)###(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)####(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)#####(?!($|\\s|#))", "$0 ")
.replaceAll("(^|^ *|\\n *)######(?!($|\\s|#))", "$0 "));
//Fix superscript
int startIndex = regexed.indexOf("^");