From fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:09:35 -0400 Subject: Reverse the order of items in MarkdownBottomBarRecyclerViewAdapter. --- .../activities/CommentActivity.java | 2 +- .../activities/EditCommentActivity.java | 2 +- .../activities/EditPostActivity.java | 2 +- .../activities/PostGalleryActivity.java | 2 +- .../activities/PostImageActivity.java | 2 +- .../activities/PostLinkActivity.java | 2 +- .../activities/PostPollActivity.java | 2 +- .../activities/PostTextActivity.java | 2 +- .../activities/PostVideoActivity.java | 2 +- .../MarkdownBottomBarRecyclerViewAdapter.java | 24 +++++++++++----------- .../customviews/LinearLayoutManagerBugFixed.java | 5 +++++ app/src/main/res/layout/activity_comment.xml | 1 + app/src/main/res/layout/activity_post_text.xml | 4 +++- 13 files changed, 30 insertions(+), 22 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 f83322e8..cb012642 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -315,7 +315,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA }); binding.commentMarkdownBottomBarRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManagerBugFixed.HORIZONTAL, false)); + LinearLayoutManagerBugFixed.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.commentMarkdownBottomBarRecyclerView.setAdapter(adapter); binding.commentAccountLinearLayout.setOnClickListener(view -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java index 629daf3f..c5446771 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java @@ -164,7 +164,7 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab }); binding.markdownBottomBarRecyclerViewEditCommentActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewEditCommentActivity.setAdapter(adapter); binding.commentEditTextEditCommentActivity.requestFocus(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java index fb3caa73..5acddd4a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java @@ -145,7 +145,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled }); binding.markdownBottomBarRecyclerViewEditPostActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManagerBugFixed.HORIZONTAL, false)); + LinearLayoutManagerBugFixed.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewEditPostActivity.setAdapter(adapter); binding.postContentEditTextEditPostActivity.requestFocus(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index 68e05f1b..e60917e3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -365,7 +365,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee }); binding.markdownBottomBarRecyclerViewPostGalleryActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewPostGalleryActivity.setAdapter(adapter); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java index 69f81f82..6ab76186 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java @@ -355,7 +355,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF }); binding.markdownBottomBarRecyclerViewPostImageActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewPostImageActivity.setAdapter(adapter); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java index 2669f5b6..9a81c146 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java @@ -357,7 +357,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr }); binding.markdownBottomBarRecyclerViewPostLinkActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewPostLinkActivity.setAdapter(adapter); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java index 09c6de41..d5c1fda7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java @@ -344,7 +344,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr }); binding.markdownBottomBarRecyclerViewPostPollActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewPostPollActivity.setAdapter(adapter); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java index 728c97c8..6713f378 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java @@ -341,7 +341,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr }); binding.markdownBottomBarRecyclerViewPostTextActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewPostTextActivity.setAdapter(adapter); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java index 72057b42..fa77e8dc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java @@ -374,7 +374,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF }); binding.markdownBottomBarRecyclerViewPostVideoActivity.setLayoutManager(new LinearLayoutManagerBugFixed(this, - LinearLayoutManager.HORIZONTAL, false)); + LinearLayoutManager.HORIZONTAL, true).setStackFromEndAndReturnCurrentObject()); binding.markdownBottomBarRecyclerViewPostVideoActivity.setAdapter(adapter); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java index 4b57a3e7..b84dac79 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java @@ -19,21 +19,21 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; public class MarkdownBottomBarRecyclerViewAdapter extends RecyclerView.Adapter { - public static final int BOLD = 0; - public static final int ITALIC = 1; - public static final int LINK = 2; - public static final int STRIKE_THROUGH = 3; - public static final int SUPERSCRIPT = 4; + public static final int BOLD = 10; + public static final int ITALIC = 9; + public static final int LINK = 8; + public static final int STRIKE_THROUGH = 7; + public static final int SUPERSCRIPT = 6; public static final int HEADER = 5; - public static final int ORDERED_LIST = 6; - public static final int UNORDERED_LIST = 7; - public static final int SPOILER = 8; - public static final int QUOTE = 9; - public static final int CODE_BLOCK = 10; + public static final int ORDERED_LIST = 4; + public static final int UNORDERED_LIST = 3; + public static final int SPOILER = 2; + public static final int QUOTE = 1; + public static final int CODE_BLOCK = 0; public static final int UPLOAD_IMAGE = 11; public static final int GIPHY_GIF = 12; - private static final int ITEM_COUNT = 11; + private static final int REGULAR_ITEM_COUNT = 11; private final CustomThemeWrapper customThemeWrapper; private final boolean canUploadImage; @@ -121,7 +121,7 @@ public class MarkdownBottomBarRecyclerViewAdapter extends RecyclerView.Adapter diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml index dd83a8bc..10851b5c 100644 --- a/app/src/main/res/layout/activity_post_text.xml +++ b/app/src/main/res/layout/activity_post_text.xml @@ -227,7 +227,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="horizontal" - android:layout_gravity="bottom" /> + android:layout_gravity="bottom" + app:reverseLayout="true" + app:stackFromEnd="true" /> -- cgit v1.2.3