Click the subreddit icon or the subreddit name to view the subreddit's details in ViewPostDetailActivity.

This commit is contained in:
Alex Ning 2018-09-22 11:09:57 +08:00
parent fc356c6505
commit a7d4485fc1

View File

@ -125,6 +125,19 @@ public class ViewPostDetailActivity extends AppCompatActivity {
Glide.with(this).load(R.drawable.subreddit_default_icon).into(subredditIconCircleImageView); 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()) { switch (mPostData.getVoteType()) {
case 1: case 1:
//Upvote //Upvote
@ -167,6 +180,19 @@ public class ViewPostDetailActivity extends AppCompatActivity {
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
subredditTextView.setText(mPostData.getSubredditNamePrefixed()); 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()); postTimeTextView.setText(mPostData.getPostTime());
if(mPostData.getGilded() > 0) { if(mPostData.getGilded() > 0) {