From a7d4485fc18452b3897a95b4de152707d9209a39 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 22 Sep 2018 11:09:57 +0800 Subject: Click the subreddit icon or the subreddit name to view the subreddit's details in ViewPostDetailActivity. --- .../infinityforreddit/ViewPostDetailActivity.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java index 22950bc5..74776f31 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java @@ -125,6 +125,19 @@ public class ViewPostDetailActivity extends AppCompatActivity { Glide.with(this).load(R.drawable.subreddit_default_icon).into(subredditIconCircleImageView); } + subredditIconCircleImageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(ViewPostDetailActivity.this, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, + mPostData.getSubredditNamePrefixed().substring(2)); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_VALUE_KEY, + mPostData.getSubredditNamePrefixed()); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_QUERY_BY_ID_KEY, false); + startActivity(intent); + } + }); + switch (mPostData.getVoteType()) { case 1: //Upvote @@ -167,6 +180,19 @@ public class ViewPostDetailActivity extends AppCompatActivity { mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); subredditTextView.setText(mPostData.getSubredditNamePrefixed()); + subredditTextView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(ViewPostDetailActivity.this, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, + mPostData.getSubredditNamePrefixed().substring(2)); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_VALUE_KEY, + mPostData.getSubredditNamePrefixed()); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_QUERY_BY_ID_KEY, false); + startActivity(intent); + } + }); + postTimeTextView.setText(mPostData.getPostTime()); if(mPostData.getGilded() > 0) { -- cgit v1.2.3