diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-01-18 08:52:28 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-01-18 08:52:28 +0000 |
commit | c7f776b048b6f04ffe5ce726812725141827b27d (patch) | |
tree | c2c382a4a72ad08c6204e1119ba825cc37c94194 | |
parent | 453b56d4855f396954904ddcb2cf1941e64b3a02 (diff) | |
download | infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.tar infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.tar.gz infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.tar.bz2 infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.tar.lz infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.tar.xz infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.tar.zst infinity-for-reddit-c7f776b048b6f04ffe5ce726812725141827b27d.zip |
Fix regex for matching heading.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java | 4 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java | 12 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index ddb7fb1e..b657f0fa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -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))) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java index b460a240..c0abde00 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java @@ -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("^"); |