From ebc2cac0a6bf61ec4a161aa907cf68f751d03071 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 21 Jan 2019 17:32:21 +0800 Subject: Click user names in comment to view the user's details. Minor visual redesign. --- .../infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java | 9 ++++++++- .../infinityforreddit/PostRecyclerViewAdapter.java | 2 ++ app/src/main/res/layout/activity_view_user_detail.xml | 2 +- app/src/main/res/layout/item_post_comment.xml | 3 ++- 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java index 89ecf3bf..935826c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java @@ -68,7 +68,14 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter { public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { final CommentData commentItem = mCommentData.get(position); - ((CommentViewHolder) holder).authorTextView.setText(commentItem.getAuthor()); + String authorPrefixed = "u/" + commentItem.getAuthor(); + ((CommentViewHolder) holder).authorTextView.setText(authorPrefixed); + ((CommentViewHolder) holder).authorTextView.setOnClickListener(view -> { + Intent intent = new Intent(mContext, ViewUserDetailActivity.class); + intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, commentItem.getAuthor()); + mContext.startActivity(intent); + }); + ((CommentViewHolder) holder).commentTimeTextView.setText(commentItem.getCommentTime()); SpannableConfiguration spannableConfiguration = SpannableConfiguration.builder(mContext).linkResolver((view, link) -> { if(link.startsWith("/u/")) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java index 46a0ac66..a789b03b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java @@ -222,6 +222,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter { @@ -305,6 +306,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter { diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml index 4d82dc6a..664230ce 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -60,7 +60,7 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:textSize="18sp" - android:textColor="@color/colorAccent" + android:textColor="@color/colorPrimaryDark" android:layout_gravity="center_horizontal"/> + android:layout_marginBottom="8dp" + android:textColor="@android:color/black"/>