Show account qualified name in the navigation drawer.

Closes #24
This commit is contained in:
Balazs Toldi 2023-08-12 21:47:38 +02:00
parent 5098cb698d
commit 946d35b5d9
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
4 changed files with 22 additions and 10 deletions

View File

@ -126,6 +126,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
private boolean mAlwaysShowChildCommentCount;
private boolean mHideTheNumberOfVotes;
private boolean mSeperateUpandDownvote;
private boolean mHideDownvotes;
private int mDepthThreshold;
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
private boolean isInitiallyLoading;
@ -168,6 +169,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
Post post, Locale locale, Integer singleCommentId,
boolean isSingleCommentThreadMode,
SharedPreferences sharedPreferences,
SharedPreferences currentAccountSharedPreferences,
CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) {
mActivity = activity;
mFragment = fragment;
@ -239,7 +241,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
mShowAuthorAvatar = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AUTHOR_AVATAR, false);
mAlwaysShowChildCommentCount = sharedPreferences.getBoolean(SharedPreferencesUtils.ALWAYS_SHOW_CHILD_COMMENT_COUNT, false);
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS, false);
mSeperateUpandDownvote = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_SEPARATE_UP_AND_DOWN_VOTES, true);
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
mSeperateUpandDownvote = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
mDepthThreshold = sharedPreferences.getInt(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD, 5);
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
@ -437,6 +440,10 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
((CommentViewHolder) holder).mMarkwonAdapter.setMarkdown(mCommentMarkwon, comment.getCommentMarkdown());
// noinspection NotifyDataSetChanged
((CommentViewHolder) holder).mMarkwonAdapter.notifyDataSetChanged();
if (mHideDownvotes) {
((CommentViewHolder) holder).downvoteButton.setVisibility(View.GONE);
((CommentViewHolder) holder).downvoteTextView.setVisibility(View.GONE);
}
if (!mHideTheNumberOfVotes) {
String commentText = "";
@ -448,14 +455,14 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
Utils.getNVotes(mShowAbsoluteNumberOfVotes,
comment.getScore() + comment.getVoteType()));
if(mSeperateUpandDownvote){
int upvotes = (comment.getVoteType() == 1) ? comment.getUpvotes()+1 : comment.getUpvotes();
int downvotes = (comment.getVoteType() == -1) ? comment.getDownvotes()+1 : comment.getDownvotes();
if (mSeperateUpandDownvote) {
int upvotes = (comment.getVoteType() == 1) ? comment.getUpvotes() + 1 : comment.getUpvotes();
int downvotes = (comment.getVoteType() == -1) ? comment.getDownvotes() + 1 : comment.getDownvotes();
((CommentViewHolder) holder).downvoteTextView.setVisibility(View.VISIBLE);
((CommentViewHolder) holder).scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, upvotes));
((CommentViewHolder) holder).downvoteTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, downvotes));
((CommentViewHolder) holder).scoreTextView.setGravity(Gravity.START);
((CommentViewHolder) holder).scoreTextView.getLayoutParams().width = (int) (32 * mActivity.getResources().getDisplayMetrics().density);
((CommentViewHolder) holder).scoreTextView.getLayoutParams().width = (int) (32 * mActivity.getResources().getDisplayMetrics().density);
((CommentViewHolder) holder).scoreTextView.setPadding(0, 0, 6, 0);
((CommentViewHolder) holder).downvoteButton.setPadding(24, 0, 12, 0);

View File

@ -176,6 +176,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private boolean mSeperateUpvoteAndDownvote;
private boolean mHideTheNumberOfComments;
private boolean mSeparatePostAndComments;
private boolean mHideDownvotes;
private boolean mLegacyAutoplayVideoControllerUI;
private boolean mEasierToWatchInFullScreen;
private PostDetailRecyclerViewAdapterCallback mPostDetailRecyclerViewAdapterCallback;
@ -344,7 +345,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
mSeperateUpvoteAndDownvote = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES, true);
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
mSeperateUpvoteAndDownvote = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
mHideTheNumberOfComments = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_COMMENTS, false);
mPostDetailRecyclerViewAdapterCallback = postDetailRecyclerViewAdapterCallback;

View File

@ -229,6 +229,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private boolean mHideTheNumberOfVotes;
private boolean mSeparateUpandDownVotes;
private boolean mHideDownvotes;
private boolean mHideTheNumberOfComments;
private boolean mLegacyAutoplayVideoControllerUI;
private boolean mFixedHeightPreviewInCard;
@ -311,7 +313,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mHideTheNumberOfAwards = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
mHideSubredditAndUserPrefix = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
mHideTheNumberOfVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
mSeparateUpandDownVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_SEPARATE_UP_AND_DOWN_VOTES, true);
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
mSeparateUpandDownVotes = sharedPreferences.getBoolean(SharedPreferencesUtils.POST_SEPARATE_UP_AND_DOWN_VOTES, true) && !mHideDownvotes;
mHideTheNumberOfComments = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_COMMENTS, false);
mLegacyAutoplayVideoControllerUI = sharedPreferences.getBoolean(SharedPreferencesUtils.LEGACY_AUTOPLAY_VIDEO_CONTROLLER_UI, false);
mFixedHeightPreviewInCard = sharedPreferences.getBoolean(SharedPreferencesUtils.FIXED_HEIGHT_PREVIEW_IN_CARD, false);
@ -2423,7 +2426,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
this.shareButton = shareButton;
scoreTextView.setOnClickListener(null);
if(!mCurrentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE,true)){
if (mHideDownvotes) {
downvoteButton.setVisibility(View.GONE);
}

View File

@ -616,7 +616,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
this, mCustomThemeWrapper, mExecutor, mRetrofit.getRetrofit(),
mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId
, isSingleCommentThreadMode, mSharedPreferences,
, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
public void retryFetchingComments() {
@ -1308,7 +1308,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mCommentsAdapter = new CommentsRecyclerViewAdapter(activity,
ViewPostDetailFragment.this, mCustomThemeWrapper, mExecutor,
mRetrofit.getRetrofit(), mAccessToken, mAccountName, mPost, mLocale,
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences,
mSingleCommentId, isSingleCommentThreadMode, mSharedPreferences, mCurrentAccountSharedPreferences,
new CommentsRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() {
@Override
public void retryFetchingComments() {