From b9733e69e9fe58a972401d58cfdb344c7abf8328 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 29 Oct 2019 13:52:30 +0800 Subject: [PATCH] Placing vote buttons on the right for comments is now available. --- .../CommentAndPostRecyclerViewAdapter.java | 27 ++- .../CommentsListingRecyclerViewAdapter.java | 32 ++++ .../Adapter/PostRecyclerViewAdapter.java | 2 +- .../Fragment/CommentsListingFragment.java | 3 +- .../infinityforreddit/Post.java | 4 +- .../res/drawable/ic_expand_more_grey_24dp.xml | 4 +- app/src/main/res/layout/item_comment.xml | 176 +++++++++++++++--- 7 files changed, 217 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 169a5cee..97c7fb98 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -510,7 +510,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter mCommentViewModel.retryLoadingMore()); + voteButtonsOnTheRight, () -> mCommentViewModel.retryLoadingMore()); String username = getArguments().getString(EXTRA_USERNAME); String sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_COMMENT, SortType.Type.NEW.value); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java index 1f2c3681..47f4a6a3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java @@ -323,11 +323,11 @@ public class Post implements Parcelable { this.previewHeight = previewHeight; } - public int getnComments() { + public int getNComments() { return nComments; } - public void setnComments(int nComments) { + public void setNComments(int nComments) { this.nComments = nComments; } diff --git a/app/src/main/res/drawable/ic_expand_more_grey_24dp.xml b/app/src/main/res/drawable/ic_expand_more_grey_24dp.xml index 71b8f17a..d0231df5 100644 --- a/app/src/main/res/drawable/ic_expand_more_grey_24dp.xml +++ b/app/src/main/res/drawable/ic_expand_more_grey_24dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index 1e594578..242841b2 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -71,20 +71,144 @@ android:textColor="@color/primaryTextColor" android:textSize="?attr/content_font_default" /> - + android:layout_height="wrap_content" + android:paddingStart="4dp" + android:paddingEnd="4dp"> + + + + + + + + + + + + + + + + --> + + + + @@ -93,7 +217,6 @@ android:id="@+id/score_text_view_item_post_comment" android:layout_width="64dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" @@ -105,8 +228,8 @@ android:id="@+id/down_vote_button_item_post_comment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="16dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -122,7 +245,8 @@ android:id="@+id/more_button_item_post_comment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="16dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -136,7 +260,8 @@ android:id="@+id/expand_button_item_post_comment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="16dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -151,23 +276,11 @@ android:id="@+id/save_button_item_post_comment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="16dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - app:layout_constraintEnd_toStartOf="@+id/share_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - @@ -176,11 +289,26 @@ android:id="@+id/reply_button_item_post_comment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="12dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" android:src="@drawable/ic_reply_grey_24dp" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + +