diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-09-19 20:09:35 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-09-19 20:09:35 +0000 |
commit | fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9 (patch) | |
tree | 3e9c101cecfc8096ea1e30fb223cdcfd5c53c829 /app/src/main | |
parent | 4f414eac37a8bfce85e662cd458c4e192384eb9e (diff) | |
download | infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.tar infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.tar.gz infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.tar.bz2 infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.tar.lz infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.tar.xz infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.tar.zst infinity-for-reddit-fa9387eea9f3a344c5cbbe430be2e2dfd9add4f9.zip |
Reverse the order of items in MarkdownBottomBarRecyclerViewAdapter.
Diffstat (limited to 'app/src/main')
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<RecyclerView.ViewHolder> { - 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<R @Override public int getItemCount() { - return canUploadImage ? (canSendGiphyGIf ? ITEM_COUNT + 2 : ITEM_COUNT + 1) : ITEM_COUNT; + return canUploadImage ? (canSendGiphyGIf ? REGULAR_ITEM_COUNT + 2 : REGULAR_ITEM_COUNT + 1) : REGULAR_ITEM_COUNT; } public static void bindEditTextWithItemClickListener(Activity activity, EditText commentEditText, int item) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LinearLayoutManagerBugFixed.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LinearLayoutManagerBugFixed.java index e2264225..cf3a573d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LinearLayoutManagerBugFixed.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LinearLayoutManagerBugFixed.java @@ -22,4 +22,9 @@ public class LinearLayoutManagerBugFixed extends LinearLayoutManager { public boolean supportsPredictiveItemAnimations() { return false; } + + public LinearLayoutManagerBugFixed setStackFromEndAndReturnCurrentObject() { + setStackFromEnd(true); + return this; + } } diff --git a/app/src/main/res/layout/activity_comment.xml b/app/src/main/res/layout/activity_comment.xml index 6a6ffcdc..2081e050 100644 --- a/app/src/main/res/layout/activity_comment.xml +++ b/app/src/main/res/layout/activity_comment.xml @@ -113,6 +113,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="horizontal" + app:reverseLayout="true" android:layout_gravity="bottom" /> </LinearLayout> 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" /> </LinearLayout> |