diff options
author | scria1000 <91804886+scria1000@users.noreply.github.com> | 2021-11-14 18:48:11 +0000 |
---|---|---|
committer | scria1000 <91804886+scria1000@users.noreply.github.com> | 2021-11-14 18:48:11 +0000 |
commit | 550706d2d72fd12e0043a8e1eb90ae9437d92a6c (patch) | |
tree | 1c72ba0f002d9cabafa187e1ec2e4d5535830c8f /app | |
parent | a52342b336ab71dece4d923e1be17d95fc6b0e30 (diff) | |
download | infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.tar infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.tar.gz infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.tar.bz2 infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.tar.lz infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.tar.xz infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.tar.zst infinity-for-reddit-550706d2d72fd12e0043a8e1eb90ae9437d92a6c.zip |
Revert changes made in refactor
We need the original superscript markdown for when we edit posts!
Diffstat (limited to '')
11 files changed, 16 insertions, 13 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java index 0d84fd8b..ffb9173b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -177,7 +177,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override @@ -231,7 +231,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java index 5de7106f..32a5f452 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java @@ -148,7 +148,7 @@ public class FullMarkdownActivity extends BaseActivity { @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index 9cd26d46..1a353a7f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -173,7 +173,7 @@ public class WikiActivity extends BaseActivity { @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index 5c85c4b2..616b9c1b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -133,7 +133,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index 547be15c..5bd116ee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -178,7 +178,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java index 0d4b8f7a..095a36f7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java @@ -117,7 +117,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 4128adf3..0b2c7f94 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -243,7 +243,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java index 73046bfc..e357771b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java @@ -83,7 +83,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java index 1d20a3ec..294733a1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java @@ -58,7 +58,7 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java index 671c7a84..3f22a64e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java @@ -122,7 +122,7 @@ public class SidebarFragment extends Fragment { @NonNull @Override public String processMarkdown(@NonNull String markdown) { - return super.processMarkdown(markdown); + return super.processMarkdown(Utils.fixSuperScript(markdown)); } @Override 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 4ea493f4..8e5e73c1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java @@ -73,10 +73,13 @@ public class Utils { .replaceAll("(^|^ *|\\n *)#####(?!($|\\s|#))", "$0 ") .replaceAll("(^|^ *|\\n *)######(?!($|\\s|#))", "$0 ")); - return fixSuperScript(regexed); + //return fixSuperScript(regexed); + // We don't want to fix super scripts here because we need the original markdown later for editing posts + return regexed.toString(); } - private static String fixSuperScript(StringBuilder regexed) { + public static String fixSuperScript(String regexedMarkdown) { + StringBuilder regexed = new StringBuilder(regexedMarkdown); boolean hasBracket = false; int nCarets = 0; for (int i = 0; i < regexed.length(); i++) { |