From edf85c2bc3d0a7d983b93d888e540380529601ca Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 27 Sep 2019 12:43:06 +0800 Subject: Add a mic icon if the user is the submitter in comments. Add a mod icon if the user is a moderator. Tweak the vertical bar colors in comments in dark theme. --- .../CommentAndPostRecyclerViewAdapter.java | 19 +++++++++++++++++++ .../infinityforreddit/CommentData.java | 13 +++++++++++-- .../infinityforreddit/MainActivity.java | 9 ++++++++- .../infinityforreddit/ParseComment.java | 5 +++-- .../ViewSubredditDetailActivity.java | 11 +++++++++-- 5 files changed, 50 insertions(+), 7 deletions(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java index efb920e4..f2fb4545 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java @@ -568,6 +568,20 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag())); + fab.setOnClickListener(view -> { + if(mAccessToken == null) { + Toast.makeText(MainActivity.this, R.string.login_first, Toast.LENGTH_SHORT).show(); + return; + } + + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + }); } private void getCurrentAccountAndBindView() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java index e84b8e24..41082a8c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java @@ -217,6 +217,7 @@ class ParseComment { String subredditName = singleCommentData.getString(JSONUtils.SUBREDDIT_KEY); String parentId = singleCommentData.getString(JSONUtils.PARENT_ID_KEY); boolean isSubmitter = singleCommentData.getBoolean(JSONUtils.IS_SUBMITTER_KEY); + String distinguished = singleCommentData.getString(JSONUtils.DISTINGUISHED_KEY); String commentContent = ""; if(!singleCommentData.isNull(JSONUtils.BODY_KEY)) { commentContent = Utils.addSubredditAndUserLink(singleCommentData.getString(JSONUtils.BODY_KEY).trim()); @@ -247,8 +248,8 @@ class ParseComment { boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String); return new CommentData(id, fullName, author, linkAuthor, formattedSubmitTime, commentContent, - linkId, subredditName, parentId, score, voteType, isSubmitter, permalink, depth, collapsed, - hasReply, scoreHidden, saved); + linkId, subredditName, parentId, score, voteType, isSubmitter, distinguished, + permalink, depth, collapsed, hasReply, scoreHidden, saved); } @Nullable diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java index 813801d5..ba24aae8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java @@ -197,7 +197,7 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So } - subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME_KEY); + subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME_KEY); if(savedInstanceState == null) { mMessageFullname = getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME); @@ -313,7 +313,14 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So } }); - fab.setOnClickListener(view -> postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag())); + fab.setOnClickListener(view -> { + if(mAccessToken == null) { + Toast.makeText(ViewSubredditDetailActivity.this, R.string.login_first, Toast.LENGTH_SHORT).show(); + return; + } + + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + }); } private void getCurrentAccountAndBindView() { -- cgit v1.2.3