aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Post.java4
-rw-r--r--app/src/main/res/drawable/ic_expand_more_grey_24dp.xml4
-rw-r--r--app/src/main/res/layout/item_comment.xml162
7 files changed, 210 insertions, 24 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<Recy
mActivity.startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE);
});
- ((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getnComments()));
+ ((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getNComments()));
if (mPost.isSaved()) {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
@@ -1697,6 +1697,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment)
TextView commentMarkdownView;
+ @BindView(R.id.bottom_constraint_layout_item_post_comment)
+ ConstraintLayout bottomConstraintLayout;
@BindView(R.id.up_vote_button_item_post_comment)
ImageView upVoteButton;
@BindView(R.id.score_text_view_item_post_comment)
@@ -1768,6 +1770,29 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
expandButton.performClick();
return true;
});
+
+ if (mVoteButtonsOnTheRight) {
+ ConstraintSet constraintSet = new ConstraintSet();
+ constraintSet.clone(bottomConstraintLayout);
+ constraintSet.clear(upVoteButton.getId(), ConstraintSet.START);
+ constraintSet.clear(scoreTextView.getId(), ConstraintSet.START);
+ constraintSet.clear(downVoteButton.getId(), ConstraintSet.START);
+ constraintSet.clear(expandButton.getId(), ConstraintSet.END);
+ constraintSet.clear(saveButton.getId(), ConstraintSet.END);
+ constraintSet.clear(replyButton.getId(), ConstraintSet.END);
+ constraintSet.clear(shareButton.getId(), ConstraintSet.END);
+ constraintSet.connect(upVoteButton.getId(), ConstraintSet.END, scoreTextView.getId(), ConstraintSet.START);
+ constraintSet.connect(scoreTextView.getId(), ConstraintSet.END, downVoteButton.getId(), ConstraintSet.START);
+ constraintSet.connect(downVoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END);
+ constraintSet.connect(moreButton.getId(), ConstraintSet.START, expandButton.getId(), ConstraintSet.END);
+ constraintSet.connect(moreButton.getId(), ConstraintSet.END, upVoteButton.getId(), ConstraintSet.END);
+ constraintSet.connect(expandButton.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END);
+ constraintSet.connect(saveButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END);
+ constraintSet.connect(replyButton.getId(), ConstraintSet.START, shareButton.getId(), ConstraintSet.END);
+ constraintSet.connect(shareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
+ constraintSet.setHorizontalBias(moreButton.getId(), 0);
+ constraintSet.applyTo(bottomConstraintLayout);
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java
index 5924fa94..0ac21d44 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java
@@ -17,6 +17,8 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.content.ContextCompat;
import androidx.paging.PagedListAdapter;
import androidx.recyclerview.widget.DiffUtil;
@@ -64,11 +66,13 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
private String mAccountName;
private int mTextColorPrimaryDark;
private int mColorAccent;
+ private boolean mVoteButtonsOnTheRight;
private NetworkState networkState;
private RetryLoadingMoreCallback mRetryLoadingMoreCallback;
public CommentsListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit,
String accessToken, String accountName,
+ boolean voteButtonsOnTheRight,
RetryLoadingMoreCallback retryLoadingMoreCallback) {
super(DIFF_CALLBACK);
mContext = context;
@@ -94,6 +98,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
.build();
mAccessToken = accessToken;
mAccountName = accountName;
+ mVoteButtonsOnTheRight = voteButtonsOnTheRight;
mRetryLoadingMoreCallback = retryLoadingMoreCallback;
mTextColorPrimaryDark = mContext.getResources().getColor(R.color.colorPrimaryDarkDayNightTheme);
mColorAccent = mContext.getResources().getColor(R.color.colorAccent);
@@ -407,6 +412,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment)
TextView commentMarkdownView;
+ @BindView(R.id.bottom_constraint_layout_item_post_comment)
+ ConstraintLayout bottomConstraintLayout;
@BindView(R.id.up_vote_button_item_post_comment)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_comment)
@@ -417,6 +424,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
ImageView moreButton;
@BindView(R.id.save_button_item_post_comment)
ImageView saveButton;
+ @BindView(R.id.expand_button_item_post_comment)
+ ImageView expandButton;
@BindView(R.id.share_button_item_post_comment)
ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment)
@@ -425,6 +434,29 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
DataViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
+
+ if (mVoteButtonsOnTheRight) {
+ ConstraintSet constraintSet = new ConstraintSet();
+ constraintSet.clone(bottomConstraintLayout);
+ constraintSet.clear(upvoteButton.getId(), ConstraintSet.START);
+ constraintSet.clear(scoreTextView.getId(), ConstraintSet.START);
+ constraintSet.clear(downvoteButton.getId(), ConstraintSet.START);
+ constraintSet.clear(expandButton.getId(), ConstraintSet.END);
+ constraintSet.clear(saveButton.getId(), ConstraintSet.END);
+ constraintSet.clear(replyButton.getId(), ConstraintSet.END);
+ constraintSet.clear(shareButton.getId(), ConstraintSet.END);
+ constraintSet.connect(upvoteButton.getId(), ConstraintSet.END, scoreTextView.getId(), ConstraintSet.START);
+ constraintSet.connect(scoreTextView.getId(), ConstraintSet.END, downvoteButton.getId(), ConstraintSet.START);
+ constraintSet.connect(downvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END);
+ constraintSet.connect(moreButton.getId(), ConstraintSet.START, expandButton.getId(), ConstraintSet.END);
+ constraintSet.connect(moreButton.getId(), ConstraintSet.END, upvoteButton.getId(), ConstraintSet.END);
+ constraintSet.connect(expandButton.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END);
+ constraintSet.connect(saveButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END);
+ constraintSet.connect(replyButton.getId(), ConstraintSet.START, shareButton.getId(), ConstraintSet.END);
+ constraintSet.connect(shareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
+ constraintSet.setHorizontalBias(moreButton.getId(), 0);
+ constraintSet.applyTo(bottomConstraintLayout);
+ }
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 6be7c9e7..e221d03e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -616,7 +616,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}, fullName, newVoteType, holder.getAdapterPosition());
});
- ((DataViewHolder) holder).commentsCountTextView.setText(Integer.toString(post.getnComments()));
+ ((DataViewHolder) holder).commentsCountTextView.setText(Integer.toString(post.getNComments()));
if (post.isSaved()) {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java
index 48823b32..7b721869 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java
@@ -143,9 +143,10 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
private void bindView(Resources resources) {
mCommentRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
+ boolean voteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false);
mAdapter = new CommentsListingRecyclerViewAdapter(activity, mOauthRetrofit,
getArguments().getString(EXTRA_ACCESS_TOKEN), getArguments().getString(EXTRA_ACCOUNT_NAME),
- () -> 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 @@
-<vector android:height="20dp" android:viewportHeight="24.0"
- android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
+<vector android:height="24dp" android:viewportHeight="24.0"
+ android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF808080" android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
</vector>
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" />
+ <!--<androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/bottom_constraint_layout_item_post_comment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="4dp"
+ android:paddingEnd="4dp">
+
+ <ImageView
+ android:id="@+id/up_vote_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_arrow_upward_grey_24dp"
+ app:layout_constraintEnd_toStartOf="@id/score_text_view_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_comment"
+ android:layout_width="64dp"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toStartOf="@+id/down_vote_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/down_vote_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_arrow_downward_grey_24dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+
+ <ImageView
+ android:id="@+id/more_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_more_vert_grey_24dp"
+ android:visibility="gone"
+ app:layout_constraintStart_toEndOf="@+id/expand_button_item_post_comment"
+ app:layout_constraintEnd_toStartOf="@id/up_vote_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <ImageView
+ android:id="@+id/expand_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_expand_less_grey_24dp"
+ android:visibility="gone"
+ app:layout_constraintStart_toEndOf="@+id/save_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/save_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintStart_toEndOf="@+id/reply_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/reply_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_reply_grey_24dp"
+ app:layout_constraintStart_toEndOf="@id/share_button_item_post_comment"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ <ImageView
+ android:id="@+id/share_button_item_post_comment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_share_grey_24dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+ </androidx.constraintlayout.widget.ConstraintLayout>-->
+
<androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/bottom_constraint_layout_item_post_comment"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:paddingStart="4dp"
+ android:paddingEnd="4dp">
<ImageView
android:id="@+id/up_vote_button_item_post_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="12dp"
+ android:paddingStart="8dp"
+ android:paddingEnd="8dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_arrow_upward_grey_24dp"
- android:tint="@android:color/tab_indicator_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
@@ -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,36 +276,39 @@
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_constraintEnd_toStartOf="@+id/reply_button_item_post_comment"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
- android:id="@+id/share_button_item_post_comment"
+ android:id="@+id/reply_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"
- android:src="@drawable/ic_share_grey_24dp"
- app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment"
+ 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"/>
<ImageView
- android:id="@+id/reply_button_item_post_comment"
+ android:id="@+id/share_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"
+ android:src="@drawable/ic_share_grey_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>