From a5482a6b33155ec01e778006ca7c2ddfb465b8b2 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Wed, 13 Sep 2023 22:04:11 -0400 Subject: Continue adding Card Layout 3. Settings entry for Card Layout 3. --- .../adapters/PostRecyclerViewAdapter.java | 89 +++++++++++++++----- .../PostLayoutBottomSheetFragment.java | 35 ++++---- .../utils/SharedPreferencesUtils.java | 1 + .../layout/fragment_post_layot_bottom_sheet.xml | 81 ------------------ .../layout/fragment_post_layout_bottom_sheet.xml | 97 ++++++++++++++++++++++ app/src/main/res/values/arrays.xml | 4 + app/src/main/res/values/strings.xml | 1 + 7 files changed, 187 insertions(+), 121 deletions(-) delete mode 100644 app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml create mode 100644 app/src/main/res/layout/fragment_post_layout_bottom_sheet.xml (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index df951ee7..700ae3c7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -135,6 +135,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter DIFF_CALLBACK = new DiffUtil.ItemCallback() { @Override @@ -404,6 +408,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { + binding.cardLayoutTextViewPostLayoutBottomSheetFragment.setOnClickListener(view -> { ((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_CARD); dismiss(); }); - compactLayoutTextView.setOnClickListener(view -> { + binding.compactLayoutTextViewPostLayoutBottomSheetFragment.setOnClickListener(view -> { ((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_COMPACT); dismiss(); }); - galleryLayoutTextView.setOnClickListener(view -> { + binding.galleryLayoutTextViewPostLayoutBottomSheetFragment.setOnClickListener(view -> { ((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_GALLERY); dismiss(); }); - cardLayout2TextView.setOnClickListener(view -> { + binding.cardLayout2TextViewPostLayoutBottomSheetFragment.setOnClickListener(view -> { ((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_CARD_2); dismiss(); }); + binding.cardLayout3TextViewPostLayoutBottomSheetFragment.setOnClickListener(view -> { + ((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_CARD_3); + dismiss(); + }); if (activity.typeface != null) { - Utils.setFontToAllTextViews(rootView, activity.typeface); + Utils.setFontToAllTextViews(binding.getRoot(), activity.typeface); } - return rootView; + return binding.getRoot(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java index 3749ff99..f27253d6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -74,6 +74,7 @@ public class SharedPreferencesUtils { public static final int POST_LAYOUT_COMPACT = 1; public static final int POST_LAYOUT_GALLERY = 2; public static final int POST_LAYOUT_CARD_2 = 3; + public static final int POST_LAYOUT_CARD_3 = 4; public static final String FRONT_PAGE_SCROLLED_POSITION_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.front_page_scrolled_position"; public static final String FRONT_PAGE_SCROLLED_POSITION_FRONT_PAGE_BASE = "_front_page"; diff --git a/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml deleted file mode 100644 index e42263a0..00000000 --- a/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_post_layout_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_layout_bottom_sheet.xml new file mode 100644 index 00000000..5f714e39 --- /dev/null +++ b/app/src/main/res/layout/fragment_post_layout_bottom_sheet.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 79a54712..7d82435d 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -44,6 +44,7 @@ @string/post_layout_card @string/post_layout_card_2 + @string/post_layout_card_3 @string/post_layout_compact @string/post_layout_gallery @@ -51,6 +52,7 @@ 0 3 + 4 1 2 @@ -59,6 +61,7 @@ @string/link_post_layout_auto @string/post_layout_card @string/post_layout_card_2 + @string/post_layout_card_3 @string/post_layout_compact @string/post_layout_gallery @@ -67,6 +70,7 @@ -1 0 3 + 4 1 2 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 641a647f..0b5bdac1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -684,6 +684,7 @@ Compact Layout Gallery Layout Card Layout 2 + Card Layout 3 Just Now 1 Minute -- cgit v1.2.3