From 67b6906ead02ceb7d7e46f28ae5c27a510956038 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Mon, 14 Nov 2022 22:01:31 +1100 Subject: [PATCH] New option: Settings->Interface->Comment->Comment Divider Type. --- .../adapters/CommentsRecyclerViewAdapter.java | 39 ++++++++++++++++--- .../settings/CommentPreferenceFragment.java | 12 ++++++ .../utils/SharedPreferencesUtils.java | 1 + app/src/main/res/values/arrays.xml | 10 +++++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/comment_preferences.xml | 9 +++++ 6 files changed, 66 insertions(+), 6 deletions(-) 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 5e66a671..55517b4e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -74,6 +74,9 @@ import ml.docilealligator.infinityforreddit.utils.Utils; import retrofit2.Retrofit; public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter { + public static final int DIVIDER_NORMAL = 0; + public static final int DIVIDER_PARENT = 1; + private static final int VIEW_TYPE_FIRST_LOADING = 9; private static final int VIEW_TYPE_FIRST_LOADING_FAILED = 10; private static final int VIEW_TYPE_NO_COMMENT_PLACEHOLDER = 11; @@ -107,6 +110,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter { + commentDividerTypeListPreference.setVisible((Boolean) newValue); + return true; + }); + } + if (showFewerToolbarOptionsThresholdSeekBarPreference != null) { showFewerToolbarOptionsThresholdSeekBarPreference.setSummary(getString(R.string.settings_show_fewer_toolbar_options_threshold_summary, sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5))); 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 0cf4ba52..389bcf83 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -215,6 +215,7 @@ public class SharedPreferencesUtils { public static final String REDDIT_VIDEO_DEFAULT_RESOLUTION = "reddit_video_default_resolution"; public static final String EASIER_TO_WATCH_IN_FULL_SCREEN = "easier_to_watch_in_full_screen"; public static final String HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS = "hide_the_number_of_votes_in_comments"; + public static final String COMMENT_DIVIDER_TYPE = "comment_divider_type"; public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences"; public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs"; diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 51015180..62ec7430 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -669,4 +669,14 @@ 144 + + Normal + Only on top-level comments + + + + 0 + 1 + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bdcba30e..41c1bcb2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -647,6 +647,7 @@ Reddit Video Default Resolution Easier to Watch in Full Screen Hide FAB in Post Feed + Comment Divider Type Cannot get the link diff --git a/app/src/main/res/xml/comment_preferences.xml b/app/src/main/res/xml/comment_preferences.xml index c38eb2f1..caf95e8f 100644 --- a/app/src/main/res/xml/comment_preferences.xml +++ b/app/src/main/res/xml/comment_preferences.xml @@ -12,6 +12,15 @@ app:key="show_comment_divider" app:title="@string/settings_show_comment_divider_title" /> + +