From befc6df1f0088dcee26fec0fb8f3cb614a9b74de Mon Sep 17 00:00:00 2001 From: Sergei Kozelko Date: Sat, 24 Dec 2022 07:45:10 +0800 Subject: Delete unused isSortingComments field (#1292) Field value is always false --- .../fragments/ViewPostDetailFragment.java | 28 +++++----------------- 1 file changed, 6 insertions(+), 22 deletions(-) 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 c72aacf3..02e2bdd4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -226,7 +226,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic private String mSingleCommentId; private String mContextNumber; private boolean showToast = false; - private boolean isSortingComments = false; private boolean mIsSmoothScrolling = false; private boolean mLockFab; private boolean mSwipeUpToHideFab; @@ -821,7 +820,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic && mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_SORT_TYPE, true)) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply(); } - fetchCommentsRespectRecommendedSort(false, false, sortType.getType()); + fetchCommentsRespectRecommendedSort(false, sortType.getType()); } @NonNull @@ -1429,7 +1428,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic }); } - private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState, boolean checkSortState, SortType.Type sortType) { + private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState, SortType.Type sortType) { if (mRespectSubredditRecommendedSortType && mPost != null) { FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit, mPost.getSubredditName(), mAccessToken, new FetchSubredditData.FetchSubredditDataListener() { @@ -1445,7 +1444,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } activity.setTitle(sortTypeType.fullName); ViewPostDetailFragment.this.sortType = sortTypeType; - fetchComments(changeRefreshState, checkSortState, ViewPostDetailFragment.this.sortType); + fetchComments(changeRefreshState, ViewPostDetailFragment.this.sortType); } @Override @@ -1457,11 +1456,11 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } }); } else { - fetchComments(changeRefreshState, checkSortState, sortType); + fetchComments(changeRefreshState, sortType); } } - private void fetchComments(boolean changeRefreshState, boolean checkSortState, SortType.Type sortType) { + private void fetchComments(boolean changeRefreshState, SortType.Type sortType) { isFetchingComments = true; mCommentsAdapter.setSingleComment(mSingleCommentId, isSingleCommentThreadMode); mCommentsAdapter.initiallyLoading(); @@ -1476,14 +1475,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic @Override public void onFetchCommentSuccess(ArrayList expandedComments, String parentId, ArrayList children) { - if (checkSortState && isSortingComments) { - if (changeRefreshState) { - isRefreshing = false; - } - - return; - } - ViewPostDetailFragment.this.children = children; comments = expandedComments; @@ -1545,13 +1536,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic @Override public void onFetchCommentFailed() { isFetchingComments = false; - if (checkSortState && isSortingComments) { - if (changeRefreshState) { - isRefreshing = false; - } - - return; - } mCommentsAdapter.initiallyLoadCommentsFailed(); if (changeRefreshState) { @@ -1562,7 +1546,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState) { - fetchCommentsRespectRecommendedSort(changeRefreshState, true, sortType); + fetchCommentsRespectRecommendedSort(changeRefreshState, sortType); } void fetchMoreComments() { -- cgit v1.2.3