Delete unused isSortingComments field (#1292)

Field value is always false
This commit is contained in:
Sergei Kozelko 2022-12-24 07:45:10 +08:00 committed by GitHub
parent 5786ac028d
commit befc6df1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,7 +226,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
private String mSingleCommentId; private String mSingleCommentId;
private String mContextNumber; private String mContextNumber;
private boolean showToast = false; private boolean showToast = false;
private boolean isSortingComments = false;
private boolean mIsSmoothScrolling = false; private boolean mIsSmoothScrolling = false;
private boolean mLockFab; private boolean mLockFab;
private boolean mSwipeUpToHideFab; private boolean mSwipeUpToHideFab;
@ -821,7 +820,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_SORT_TYPE, true)) { && mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_SORT_TYPE, true)) {
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply(); mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply();
} }
fetchCommentsRespectRecommendedSort(false, false, sortType.getType()); fetchCommentsRespectRecommendedSort(false, sortType.getType());
} }
@NonNull @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) { if (mRespectSubredditRecommendedSortType && mPost != null) {
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit, mPost.getSubredditName(), mAccessToken, FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit, mPost.getSubredditName(), mAccessToken,
new FetchSubredditData.FetchSubredditDataListener() { new FetchSubredditData.FetchSubredditDataListener() {
@ -1445,7 +1444,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
} }
activity.setTitle(sortTypeType.fullName); activity.setTitle(sortTypeType.fullName);
ViewPostDetailFragment.this.sortType = sortTypeType; ViewPostDetailFragment.this.sortType = sortTypeType;
fetchComments(changeRefreshState, checkSortState, ViewPostDetailFragment.this.sortType); fetchComments(changeRefreshState, ViewPostDetailFragment.this.sortType);
} }
@Override @Override
@ -1457,11 +1456,11 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
} }
}); });
} else { } 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; isFetchingComments = true;
mCommentsAdapter.setSingleComment(mSingleCommentId, isSingleCommentThreadMode); mCommentsAdapter.setSingleComment(mSingleCommentId, isSingleCommentThreadMode);
mCommentsAdapter.initiallyLoading(); mCommentsAdapter.initiallyLoading();
@ -1476,14 +1475,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Override @Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, public void onFetchCommentSuccess(ArrayList<Comment> expandedComments,
String parentId, ArrayList<String> children) { String parentId, ArrayList<String> children) {
if (checkSortState && isSortingComments) {
if (changeRefreshState) {
isRefreshing = false;
}
return;
}
ViewPostDetailFragment.this.children = children; ViewPostDetailFragment.this.children = children;
comments = expandedComments; comments = expandedComments;
@ -1545,13 +1536,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Override @Override
public void onFetchCommentFailed() { public void onFetchCommentFailed() {
isFetchingComments = false; isFetchingComments = false;
if (checkSortState && isSortingComments) {
if (changeRefreshState) {
isRefreshing = false;
}
return;
}
mCommentsAdapter.initiallyLoadCommentsFailed(); mCommentsAdapter.initiallyLoadCommentsFailed();
if (changeRefreshState) { if (changeRefreshState) {
@ -1562,7 +1546,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
} }
private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState) { private void fetchCommentsRespectRecommendedSort(boolean changeRefreshState) {
fetchCommentsRespectRecommendedSort(changeRefreshState, true, sortType); fetchCommentsRespectRecommendedSort(changeRefreshState, sortType);
} }
void fetchMoreComments() { void fetchMoreComments() {