From 840a10f636dbeeeaaba45e6d3eb274e0865a58c3 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 20 Oct 2020 00:17:58 +0800 Subject: Fix an issue of respecting subreddit recommended comment sort type. Fix a layout issue. --- .../Activity/ViewPostDetailActivity.java | 21 +++++++++++---------- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 8 ++++---- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'app') 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 fe1b851e..daf0cbb7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -510,7 +510,15 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mSingleCommentId = getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID); if (savedInstanceState == null) { - if (!mRespectSubredditRecommendedSortType) { + if (mSingleCommentId != null) { + isSingleCommentThreadMode = true; + } + mMessageFullname = getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME); + mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME); + } + + if (savedInstanceState == null) { + if (!mRespectSubredditRecommendedSortType || isSingleCommentThreadMode) { sortType = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value.toUpperCase()); if (sortType != null) { mToolbar.setTitle(new SortType(SortType.Type.valueOf(sortType)).getType().fullName); @@ -523,14 +531,6 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS } } - if (savedInstanceState == null) { - if (mSingleCommentId != null) { - isSingleCommentThreadMode = true; - } - mMessageFullname = getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME); - mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME); - } - orientation = resources.getConfiguration().orientation; if (!mNullAccessToken && mAccessToken == null) { @@ -1329,9 +1329,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS }); } - public void changeToSingleThreadMode() { + public void changeToNomalThreadMode() { isSingleCommentThreadMode = false; mSingleCommentId = null; + mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false); refresh(false, true); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 96629464..3ae368c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -3784,12 +3784,12 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter