From ff10eb5f92810f2f1a1ca2ba5617a035957509ad Mon Sep 17 00:00:00 2001 From: Sergei Kozelko Date: Sat, 5 Nov 2022 21:22:02 +0700 Subject: Load sort type from correct shared preferences (#1202) When extracting sort type loading logic the shared preferences that are used to load sort type got accidentally changed to the wrong ones. This resulted in always using the default value which is displayed as Best. Fortunately the saving code was not changed so only reading has to be fixed. --- .../infinityforreddit/fragments/ViewPostDetailFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/ml/docilealligator') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 8fb165a8..a6e3e243 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -814,11 +814,11 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic @NonNull private SortType.Type loadSortType() { - String sortTypeName = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name()); + String sortTypeName = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name()); if (SortType.Type.BEST.name().equals(sortTypeName)) { // migrate from BEST to CONFIDENCE // key guaranteed to exist because got non-default value - mSharedPreferences.edit() + mSortTypeSharedPreferences.edit() .putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name()) .apply(); return SortType.Type.CONFIDENCE; -- cgit v1.2.3