Fix an issue of respecting subreddit recommended comment sort type. Fix a layout issue.

This commit is contained in:
Alex Ning 2020-10-20 00:17:58 +08:00
parent 5787a1f7ca
commit 840a10f636
2 changed files with 15 additions and 14 deletions

View File

@ -510,7 +510,15 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mSingleCommentId = getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID); mSingleCommentId = getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID);
if (savedInstanceState == null) { 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()); sortType = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value.toUpperCase());
if (sortType != null) { if (sortType != null) {
mToolbar.setTitle(new SortType(SortType.Type.valueOf(sortType)).getType().fullName); 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; orientation = resources.getConfiguration().orientation;
if (!mNullAccessToken && mAccessToken == null) { if (!mNullAccessToken && mAccessToken == null) {
@ -1329,9 +1329,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}); });
} }
public void changeToSingleThreadMode() { public void changeToNomalThreadMode() {
isSingleCommentThreadMode = false; isSingleCommentThreadMode = false;
mSingleCommentId = null; mSingleCommentId = null;
mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
refresh(false, true); refresh(false, true);
} }

View File

@ -3784,12 +3784,12 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (mActivity != null && mActivity instanceof ViewPostDetailActivity) { if (mActivity != null && mActivity instanceof ViewPostDetailActivity) {
mIsSingleCommentThreadMode = false; mIsSingleCommentThreadMode = false;
mSingleCommentId = null; mSingleCommentId = null;
((ViewPostDetailActivity) mActivity).changeToSingleThreadMode(); ((ViewPostDetailActivity) mActivity).changeToNomalThreadMode();
} }
itemView.setBackgroundColor(mColorAccent);
((TextView) itemView).setTextColor(mColorAccent);
}); });
itemView.setBackgroundTintList(ColorStateList.valueOf(mCommentBackgroundColor));
((TextView) itemView).setTextColor(mColorAccent);
} }
} }
} }