diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
index f5c027ec..c3f60986 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
@@ -216,6 +216,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
private boolean mLockFab;
private boolean mSwipeUpToHideFab;
private boolean mExpandChildren;
+ private boolean mRespectSubredditRecommendedSortType;
private int mWindowWidth;
private LinearLayoutManager mLinearLayoutManager;
private CommentAndPostRecyclerViewAdapter mAdapter;
@@ -296,6 +297,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mLockFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mSwipeUpToHideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
+ mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
mGlide = Glide.with(this);
Resources resources = getResources();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index 8e71f23f..4b83ac3f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -68,6 +68,7 @@ import ml.docilealligator.infinityforreddit.Settings.CustomizeMainPageTabsFragme
import ml.docilealligator.infinityforreddit.Settings.DownloadLocationPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
+import ml.docilealligator.infinityforreddit.Settings.MiscellaneousPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.NsfwAndBlurringFragment;
import ml.docilealligator.infinityforreddit.Settings.SecurityPreferenceFragment;
@@ -221,4 +222,6 @@ public interface AppComponent {
void inject(TranslationFragment translationFragment);
void inject(FetchRandomSubredditOrPostActivity fetchRandomSubredditOrPostActivity);
+
+ void inject(MiscellaneousPreferenceFragment miscellaneousPreferenceFragment);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
index 9ab5a099..32aec40d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
@@ -10,15 +10,10 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.biometric.BiometricManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
-import androidx.preference.SwitchPreference;
-
-import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import javax.inject.Named;
-import ml.docilealligator.infinityforreddit.Event.ChangeSavePostFeedScrolledPositionEvent;
-import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@@ -31,9 +26,6 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
@Inject
@Named("default")
SharedPreferences sharedPreferences;
- @Inject
- @Named("post_feed_scrolled_position_cache")
- SharedPreferences cache;
private AppCompatActivity activity;
@Override
@@ -42,25 +34,6 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
((Infinity) activity.getApplication()).getAppComponent().inject(this);
Preference securityPreference = findPreference(SharedPreferencesUtils.SECURITY);
- SwitchPreference savePostFeedScrolledPositionSwitch = findPreference(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION);
- SwitchPreference confirmToExitSwitch = findPreference(SharedPreferencesUtils.CONFIRM_TO_EXIT);
-
- if (savePostFeedScrolledPositionSwitch != null) {
- savePostFeedScrolledPositionSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- if (!(Boolean) newValue) {
- cache.edit().clear().apply();
- }
- EventBus.getDefault().post(new ChangeSavePostFeedScrolledPositionEvent((Boolean) newValue));
- return true;
- });
- }
-
- if (confirmToExitSwitch != null) {
- confirmToExitSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
- EventBus.getDefault().post(new RecreateActivityEvent());
- return true;
- });
- }
BiometricManager biometricManager = BiometricManager.from(activity);
if (biometricManager.canAuthenticate(BIOMETRIC_STRONG | DEVICE_CREDENTIAL) != BiometricManager.BIOMETRIC_SUCCESS) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MiscellaneousPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MiscellaneousPreferenceFragment.java
new file mode 100644
index 00000000..1b8c69d9
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MiscellaneousPreferenceFragment.java
@@ -0,0 +1,67 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.SwitchPreference;
+
+import org.greenrobot.eventbus.EventBus;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import ml.docilealligator.infinityforreddit.Event.ChangeSavePostFeedScrolledPositionEvent;
+import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
+
+public class MiscellaneousPreferenceFragment extends PreferenceFragmentCompat {
+
+ @Inject
+ @Named("post_feed_scrolled_position_cache")
+ SharedPreferences cache;
+ private Activity activity;
+
+ public MiscellaneousPreferenceFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.miscellaneous_preferences, rootKey);
+
+ ((Infinity) activity.getApplication()).getAppComponent().inject(this);
+
+ SwitchPreference confirmToExitSwitch = findPreference(SharedPreferencesUtils.CONFIRM_TO_EXIT);
+ SwitchPreference savePostFeedScrolledPositionSwitch = findPreference(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION);
+
+ if (confirmToExitSwitch != null) {
+ confirmToExitSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ }
+
+ if (savePostFeedScrolledPositionSwitch != null) {
+ savePostFeedScrolledPositionSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ if (!(Boolean) newValue) {
+ cache.edit().clear().apply();
+ }
+ EventBus.getDefault().post(new ChangeSavePostFeedScrolledPositionEvent((Boolean) newValue));
+ return true;
+ });
+ }
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (AppCompatActivity) context;
+ }
+}
\ No newline at end of file
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 cb659c23..a2b909eb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -135,6 +135,7 @@ public class SharedPreferencesUtils {
public static final String DATA_SAVING_MODE_ONLY_ON_CELLULAR_DATA = "1";
public static final String DATA_SAVING_MODE_ALWAYS = "2";
public static final String NATIONAL_FLAGS = "national_flags";
+ public static final String RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE = "respect_subreddit_recommended_comment_sort_type";
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
public static final String MAIN_PAGE_TAB_COUNT = "_main_page_tab_count";
diff --git a/app/src/main/res/drawable-night/ic_miscellaneous_24dp.xml b/app/src/main/res/drawable-night/ic_miscellaneous_24dp.xml
new file mode 100644
index 00000000..52a52180
--- /dev/null
+++ b/app/src/main/res/drawable-night/ic_miscellaneous_24dp.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_miscellaneous_24dp.xml b/app/src/main/res/drawable/ic_miscellaneous_24dp.xml
new file mode 100644
index 00000000..788d988e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_miscellaneous_24dp.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a0b51351..0375432b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -494,6 +494,9 @@
Translate this app on POEditor. Thanks to all contributors.
National Flags
Icon made by Freepik from www.flaticon.com
+ Miscellaneous
+ Respect Subreddit Recommended Comment Sort Type
+ Comment sort type will not be saved
Cannot get the link
diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml
index 88756af0..8ada3e6c 100644
--- a/app/src/main/res/xml/main_preferences.xml
+++ b/app/src/main/res/xml/main_preferences.xml
@@ -53,29 +53,16 @@
app:icon="@drawable/ic_data_saving_mode_black_24dp"
app:fragment="ml.docilealligator.infinityforreddit.Settings.DataSavingModePreferenceFragment" />
-
-
-
-
-
-
+
+
diff --git a/app/src/main/res/xml/miscellaneous_preferences.xml b/app/src/main/res/xml/miscellaneous_preferences.xml
new file mode 100644
index 00000000..f4274a5a
--- /dev/null
+++ b/app/src/main/res/xml/miscellaneous_preferences.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file