aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-09-22 13:28:28 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-09-22 13:28:28 +0000
commit52b27971ffff6e57247ce06a7363cbaf37495d82 (patch)
treea51f119e7e4e22bbb53607eba74390298450f2bd /app/src
parent9ca494d4b5409b12b8262194f736284036858c01 (diff)
downloadinfinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.tar
infinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.tar.gz
infinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.tar.bz2
infinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.tar.lz
infinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.tar.xz
infinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.tar.zst
infinity-for-reddit-52b27971ffff6e57247ce06a7363cbaf37495d82.zip
Display comments count in the post. Display a comment and a save button in a post. Minor bugs fixed.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java101
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java49
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Post.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java109
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java14
-rw-r--r--app/src/main/res/drawable/gold.xml4
-rw-r--r--app/src/main/res/drawable/ic_archive_outline.xml (renamed from app/src/main/res/drawable/ic_archive_outline_24dp.xml)0
-rw-r--r--app/src/main/res/drawable/ic_outline_lock.xml (renamed from app/src/main/res/drawable/ic_outline_lock_24px.xml)0
-rw-r--r--app/src/main/res/layout/activity_main.xml2
-rw-r--r--app/src/main/res/layout/item_post.xml154
-rw-r--r--app/src/main/res/layout/item_post_detail.xml153
16 files changed, 498 insertions, 156 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
index 5104bef8..46f1c850 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
@@ -150,8 +150,8 @@ public class CommentActivity extends AppCompatActivity {
})
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.build();
- markwon.setMarkdown(commentParentMarkwonView, intent.getExtras().getString(EXTRA_COMMENT_PARENT_TEXT_KEY));
- parentFullname = intent.getExtras().getString(EXTRA_PARENT_FULLNAME_KEY);
+ markwon.setMarkdown(commentParentMarkwonView, intent.getStringExtra(EXTRA_COMMENT_PARENT_TEXT_KEY));
+ parentFullname = intent.getStringExtra(EXTRA_PARENT_FULLNAME_KEY);
parentDepth = intent.getExtras().getInt(EXTRA_PARENT_DEPTH_KEY);
parentPosition = intent.getExtras().getInt(EXTRA_PARENT_POSITION_KEY);
isReplying = intent.getExtras().getBoolean(EXTRA_IS_REPLYING_KEY);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
index ada28849..efb920e4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
@@ -33,7 +33,6 @@ import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
-import com.google.android.material.chip.Chip;
import com.libRG.CustomTextView;
import com.santalu.aspectratioimageview.AspectRatioImageView;
@@ -366,7 +365,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
}
if(mPost.isNSFW()) {
- ((PostDetailViewHolder) holder).mNSFWChip.setOnClickListener(view -> {
+ ((PostDetailViewHolder) holder).mNSFWTextView.setOnClickListener(view -> {
Intent intent = new Intent(mActivity, FilteredThingActivity.class);
intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2));
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
@@ -374,15 +373,15 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
intent.putExtra(FilteredThingActivity.EXTRA_FILTER, Post.NSFW_TYPE);
mActivity.startActivity(intent);
});
- ((PostDetailViewHolder) holder).mNSFWChip.setVisibility(View.VISIBLE);
+ ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE);
} else {
- ((PostDetailViewHolder) holder).mNSFWChip.setVisibility(View.GONE);
+ ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
}
String scoreWithVote = Integer.toString(mPost.getScore() + mPost.getVoteType());
((PostDetailViewHolder) holder).mScoreTextView.setText(scoreWithVote);
- ((PostDetailViewHolder) holder).mTypeChip.setOnClickListener(view -> {
+ ((PostDetailViewHolder) holder).mTypeTextView.setOnClickListener(view -> {
Intent intent = new Intent(mActivity, FilteredThingActivity.class);
intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2));
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
@@ -394,7 +393,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
switch (mPost.getPostType()) {
case Post.IMAGE_TYPE:
- ((PostDetailViewHolder) holder).mTypeChip.setText("IMAGE");
+ ((PostDetailViewHolder) holder).mTypeTextView.setText("IMAGE");
((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
Intent intent = new Intent(mActivity, ViewImageActivity.class);
@@ -406,7 +405,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
});
break;
case Post.LINK_TYPE:
- ((PostDetailViewHolder) holder).mTypeChip.setText("LINK");
+ ((PostDetailViewHolder) holder).mTypeTextView.setText("LINK");
((PostDetailViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
String domain = Uri.parse(mPost.getUrl()).getHost();
@@ -424,7 +423,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
});
break;
case Post.GIF_VIDEO_TYPE:
- ((PostDetailViewHolder) holder).mTypeChip.setText("GIF");
+ ((PostDetailViewHolder) holder).mTypeTextView.setText("GIF");
final Uri gifVideoUri = Uri.parse(mPost.getVideoUrl());
((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
@@ -437,7 +436,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
});
break;
case Post.VIDEO_TYPE:
- ((PostDetailViewHolder) holder).mTypeChip.setText("VIDEO");
+ ((PostDetailViewHolder) holder).mTypeTextView.setText("VIDEO");
final Uri videoUri = Uri.parse(mPost.getVideoUrl());
((PostDetailViewHolder) holder).mImageView.setOnClickListener(view -> {
@@ -450,7 +449,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
});
break;
case Post.NO_PREVIEW_LINK_TYPE:
- ((PostDetailViewHolder) holder).mTypeChip.setText("LINK");
+ ((PostDetailViewHolder) holder).mTypeTextView.setText("LINK");
((PostDetailViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
String noPreviewLinkDomain = Uri.parse(mPost.getUrl()).getHost();
@@ -474,7 +473,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
});
break;
case Post.TEXT_TYPE:
- ((PostDetailViewHolder) holder).mTypeChip.setText("TEXT");
+ ((PostDetailViewHolder) holder).mTypeTextView.setText("TEXT");
if(!mPost.getSelfText().equals("")) {
((PostDetailViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
@@ -482,6 +481,77 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
}
break;
}
+
+ ((PostDetailViewHolder) holder).commentButton.setOnClickListener(view -> {
+ if(mAccessToken == null) {
+ Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ Intent intent = new Intent(mActivity, CommentActivity.class);
+ intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, mPost.getFullName());
+ intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, mPost.getTitle());
+ intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false);
+ intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0);
+ mActivity.startActivity(intent);
+ });
+
+ ((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getnComments()));
+
+ if(mPost.isSaved()) {
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ } else {
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ }
+
+ ((PostDetailViewHolder) holder).saveButton.setOnClickListener(view -> {
+ if(mAccessToken == null) {
+ Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if(mPost.isSaved()) {
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
+ new SaveThing.SaveThingListener() {
+ @Override
+ public void success() {
+ mPost.setSaved(false);
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+
+ @Override
+ public void failed() {
+ mPost.setSaved(true);
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+ });
+ } else {
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
+ new SaveThing.SaveThingListener() {
+ @Override
+ public void success() {
+ mPost.setSaved(true);
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+
+ @Override
+ public void failed() {
+ mPost.setSaved(false);
+ ((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
+ mCommentRecyclerViewAdapterCallback.updatePost(mPost);
+ }
+ });
+ }
+ });
} else if(holder.getItemViewType() == VIEW_TYPE_COMMENT) {
CommentData comment;
if(mIsSingleCommentThreadMode) {
@@ -1100,7 +1170,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
((PostDetailViewHolder) holder).spoilerFlairlinearLayout.setVisibility(View.GONE);
((PostDetailViewHolder) holder).flairTextView.setVisibility(View.GONE);
((PostDetailViewHolder) holder).spoilerTextView.setVisibility(View.GONE);
- ((PostDetailViewHolder) holder).mNSFWChip.setVisibility(View.GONE);
+ ((PostDetailViewHolder) holder).mNSFWTextView.setVisibility(View.GONE);
} else if(holder instanceof LoadMoreChildCommentsViewHolder) {
((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
@@ -1137,13 +1207,13 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
@BindView(R.id.post_time_text_view_item_post_detail) TextView mPostTimeTextView;
@BindView(R.id.title_text_view_item_post_detail) TextView mTitleTextView;
@BindView(R.id.content_markdown_view_item_post_detail) TextView mContentMarkdownView;
- @BindView(R.id.type_text_view_item_post_detail) Chip mTypeChip;
+ @BindView(R.id.type_text_view_item_post_detail) CustomTextView mTypeTextView;
@BindView(R.id.gilded_image_view_item_post_detail) ImageView mGildedImageView;
@BindView(R.id.gilded_number_text_view_item_post_detail) TextView mGildedNumberTextView;
@BindView(R.id.crosspost_image_view_item_post_detail) ImageView mCrosspostImageView;
@BindView(R.id.archived_image_view_item_post_detail) ImageView mArchivedImageView;
@BindView(R.id.locked_image_view_item_post_detail) ImageView mLockedImageView;
- @BindView(R.id.nsfw_text_view_item_post_detail) Chip mNSFWChip;
+ @BindView(R.id.nsfw_text_view_item_post_detail) CustomTextView mNSFWTextView;
@BindView(R.id.spoiler_flair_linear_layout_item_post_detail) LinearLayout spoilerFlairlinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post_detail) CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post_detail) CustomTextView flairTextView;
@@ -1157,6 +1227,9 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
@BindView(R.id.plus_button_item_post_detail) ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail) TextView mScoreTextView;
@BindView(R.id.minus_button_item_post_detail) ImageView mDownvoteButton;
+ @BindView(R.id.comment_button_item_post_detail) ImageView commentButton;
+ @BindView(R.id.comments_count_item_post_detail) TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post_detail) ImageView saveButton;
@BindView(R.id.share_button_item_post_detail) ImageView mShareButton;
PostDetailViewHolder(@NonNull View itemView) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
index f18da1cf..69d1fa9b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
@@ -165,6 +165,7 @@ class ParsePost {
int score = data.getInt(JSONUtils.SCORE_KEY);
int voteType;
int gilded = data.getInt(JSONUtils.GILDED_KEY);
+ int nComments = data.getInt(JSONUtils.NUM_COMMENTS_KEY);
boolean hidden = data.getBoolean(JSONUtils.HIDDEN_KEY);
boolean spoiler = data.getBoolean(JSONUtils.SPOILER_KEY);
boolean nsfw = data.getBoolean(JSONUtils.NSFW_KEY);
@@ -207,23 +208,23 @@ class ParsePost {
Post crosspostParent = parseBasicData(data, locale);
Post post = parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
- score, voteType, gilded, flair, hidden, spoiler, nsfw, stickied, archived, locked,
- saved, true);
+ score, voteType, gilded, nComments, flair, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, true);
post.setCrosspostParentId(crosspostParent.getId());
return post;
} else {
return parseData(data, permalink, id, fullName, subredditName, subredditNamePrefixed,
author, formattedPostTime, title, previewUrl, previewWidth, previewHeight,
- score, voteType, gilded, flair, hidden, spoiler, nsfw, stickied, archived, locked,
- saved, false);
+ score, voteType, gilded, nComments, flair, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, false);
}
}
private static Post parseData(JSONObject data, String permalink, String id, String fullName,
String subredditName, String subredditNamePrefixed, String author,
String formattedPostTime, String title, String previewUrl, int previewWidth,
- int previewHeight, int score, int voteType, int gilded, String flair,
- boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
+ int previewHeight, int score, int voteType, int gilded, int nComments,
+ String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
boolean archived, boolean locked, boolean saved, boolean isCrosspost) throws JSONException {
Post post;
@@ -235,8 +236,8 @@ class ParsePost {
//Text post
int postType = Post.TEXT_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
- title, permalink, score, postType, voteType, gilded, flair, hidden, spoiler, nsfw,
- stickied, archived, locked, saved, isCrosspost);
+ title, permalink, score, postType, voteType, gilded, nComments, flair, hidden,
+ spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
@@ -246,8 +247,8 @@ class ParsePost {
//No preview link post
int postType = Post.NO_PREVIEW_LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
- title, previewUrl, url, permalink, score, postType, voteType, gilded, flair,
- hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
+ title, previewUrl, url, permalink, score, postType, voteType, gilded, nComments,
+ flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
@@ -267,8 +268,8 @@ class ParsePost {
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, formattedPostTime,
- title, previewUrl, permalink, score, postType, voteType, gilded, flair, hidden,
- spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
+ title, previewUrl, permalink, score, postType, voteType, gilded, nComments,
+ flair, hidden, spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@@ -282,8 +283,8 @@ class ParsePost {
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
formattedPostTime, title, previewUrl, permalink, score, postType, voteType,
- gilded, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved,
- isCrosspost);
+ gilded, nComments, flair, hidden, spoiler, nsfw, stickied, archived,
+ locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
post.setVideoUrl(videoUrl);
@@ -294,8 +295,8 @@ class ParsePost {
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
formattedPostTime, title, url, url, permalink, score, postType,
- voteType, gilded, flair, hidden, spoiler, nsfw, stickied, archived,
- locked, saved, isCrosspost);
+ voteType, gilded, nComments, flair, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@@ -306,8 +307,8 @@ class ParsePost {
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
formattedPostTime, title, permalink, score, postType, voteType,
- gilded, flair, hidden, spoiler, nsfw, stickied, archived, locked,
- saved, isCrosspost);
+ gilded, nComments, flair, hidden, spoiler, nsfw, stickied, archived,
+ locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
@@ -323,8 +324,8 @@ class ParsePost {
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
formattedPostTime, title, previewUrl, url, permalink, score, postType,
- voteType, gilded, flair, hidden, spoiler, nsfw, stickied, archived,
- locked, saved, isCrosspost);
+ voteType, gilded, nComments, flair, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, isCrosspost);
if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
@@ -343,8 +344,8 @@ class ParsePost {
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
formattedPostTime, title, previewUrl, url, permalink, score, postType,
- voteType, gilded, flair, hidden, spoiler, nsfw, stickied, archived,
- locked, saved, isCrosspost);
+ voteType, gilded, nComments, flair, hidden, spoiler, nsfw, stickied,
+ archived, locked, saved, isCrosspost);
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
} else {
@@ -353,8 +354,8 @@ class ParsePost {
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
formattedPostTime, title, url, url, permalink, score, postType, voteType,
- gilded, flair, hidden, spoiler, nsfw, stickied, archived, locked, saved,
- isCrosspost);
+ gilded, nComments, flair, hidden, spoiler, nsfw, stickied, archived, locked,
+ saved, isCrosspost);
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java
index 3a522d29..7f1ba645 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java
@@ -38,6 +38,7 @@ class Post implements Parcelable {
private int gilded;
private int previewWidth;
private int previewHeight;
+ private int nComments;
private boolean hidden;
private boolean spoiler;
private boolean nsfw;
@@ -50,8 +51,8 @@ class Post implements Parcelable {
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
String postTime, String title, String previewUrl, String permalink, int score, int postType,
- int voteType, int gilded, String flair, boolean hidden, boolean spoiler, boolean nsfw,
- boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
+ int voteType, int gilded, int nComments, String flair, boolean hidden, boolean spoiler,
+ boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditName = subredditName;
@@ -66,6 +67,7 @@ class Post implements Parcelable {
this.postType = postType;
this.voteType = voteType;
this.gilded = gilded;
+ this.nComments = nComments;
this.flair = flair;
this.hidden = hidden;
this.spoiler = spoiler;
@@ -79,8 +81,9 @@ class Post implements Parcelable {
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
String postTime, String title, String previewUrl, String url, String permalink, int score,
- int postType, int voteType, int gilded, String flair, boolean hidden, boolean spoiler,
- boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
+ int postType, int voteType, int gilded, int nComments, String flair, boolean hidden,
+ boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked,
+ boolean saved, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditName = subredditName;
@@ -96,6 +99,7 @@ class Post implements Parcelable {
this.postType = postType;
this.voteType = voteType;
this.gilded = gilded;
+ this.nComments = nComments;
this.flair = flair;
this.hidden = hidden;
this.spoiler = spoiler;
@@ -109,8 +113,8 @@ class Post implements Parcelable {
Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author,
String postTime, String title, String permalink, int score, int postType, int voteType, int gilded,
- String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived,
- boolean locked, boolean saved, boolean isCrosspost) {
+ int nComments, String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied,
+ boolean archived, boolean locked, boolean saved, boolean isCrosspost) {
this.id = id;
this.fullName = fullName;
this.subredditName = subredditName;
@@ -124,6 +128,7 @@ class Post implements Parcelable {
this.postType = postType;
this.voteType = voteType;
this.gilded = gilded;
+ this.nComments = nComments;
this.flair = flair;
this.hidden = hidden;
this.spoiler = spoiler;
@@ -158,6 +163,7 @@ class Post implements Parcelable {
gilded = in.readInt();
previewWidth = in.readInt();
previewHeight = in.readInt();
+ nComments = in.readInt();
hidden = in.readByte() != 0;
spoiler = in.readByte() != 0;
nsfw = in.readByte() != 0;
@@ -309,6 +315,14 @@ class Post implements Parcelable {
return previewHeight;
}
+ public int getnComments() {
+ return nComments;
+ }
+
+ public void setnComments(int nComments) {
+ this.nComments = nComments;
+ }
+
boolean isHidden() {
return hidden;
}
@@ -394,6 +408,7 @@ class Post implements Parcelable {
parcel.writeInt(gilded);
parcel.writeInt(previewWidth);
parcel.writeInt(previewHeight);
+ parcel.writeInt(nComments);
parcel.writeByte((byte) (hidden ? 1 : 0));
parcel.writeByte((byte) (spoiler ? 1 : 0));
parcel.writeByte((byte) (nsfw ? 1 : 0));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
index 0d13dc2e..5a4f71ce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
@@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit;
-import android.util.Log;
-
import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import androidx.paging.PageKeyedDataSource;
@@ -64,14 +62,13 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
initialLoadStateLiveData = new MutableLiveData<>();
hasPostLiveData = new MutableLiveData<>();
this.postType = postType;
- this.sortType = sortType;
+ this.sortType = sortType == null ? PostDataSource.SORT_TYPE_BEST : sortType;
this.filter = filter;
this.nsfw = nsfw;
}
PostDataSource(Retrofit retrofit, String accessToken, Locale locale, String subredditOrUserName, int postType,
String sortType, int filter, boolean nsfw) {
- Log.i("asfdasdf", "datasource: " + sortType);
this.retrofit = retrofit;
this.accessToken = accessToken;
this.locale = locale;
@@ -80,7 +77,15 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
initialLoadStateLiveData = new MutableLiveData<>();
hasPostLiveData = new MutableLiveData<>();
this.postType = postType;
- this.sortType = sortType;
+ if(sortType == null) {
+ if(subredditOrUserName.equals("popular") || subredditOrUserName.equals("all")) {
+ this.sortType = PostDataSource.SORT_TYPE_HOT;
+ } else {
+ this.sortType = PostDataSource.SORT_TYPE_BEST;
+ }
+ } else {
+ this.sortType = sortType;
+ }
this.filter = filter;
this.nsfw = nsfw;
}
@@ -95,7 +100,7 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
initialLoadStateLiveData = new MutableLiveData<>();
hasPostLiveData = new MutableLiveData<>();
this.postType = postType;
- this.sortType = sortType;
+ this.sortType = sortType == null ? PostDataSource.SORT_TYPE_NEW : sortType;
userWhere = where;
this.filter = filter;
this.nsfw = nsfw;
@@ -112,7 +117,7 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
initialLoadStateLiveData = new MutableLiveData<>();
hasPostLiveData = new MutableLiveData<>();
this.postType = postType;
- this.sortType = sortType;
+ this.sortType = sortType == null ? PostDataSource.SORT_TYPE_RELEVANCE : sortType;
this.filter = filter;
this.nsfw = nsfw;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
index 6e2aaa89..3942bec3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
@@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit;
-import android.util.Log;
-
import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import androidx.paging.DataSource;
@@ -39,7 +37,6 @@ class PostDataSourceFactory extends DataSource.Factory {
PostDataSourceFactory(Retrofit retrofit, String accessToken, Locale locale, String subredditName,
int postType, String sortType, int filter, boolean nsfw) {
- Log.i("asfdasdf", "datasource factory: " + sortType);
this.retrofit = retrofit;
this.accessToken = accessToken;
this.locale = locale;
@@ -89,7 +86,6 @@ class PostDataSourceFactory extends DataSource.Factory {
postDataSource = new PostDataSource(retrofit, accessToken, locale, subredditName, query,
postType, sortType, filter, nsfw);
} else if(postType == PostDataSource.TYPE_SUBREDDIT) {
- Log.i("asfdasdf", "datasource create: " + sortType);
postDataSource = new PostDataSource(retrofit, accessToken, locale, subredditName, postType,
sortType, filter, nsfw);
} else {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java
index fdad950c..d61e9630 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java
@@ -34,7 +34,6 @@ import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.google.android.material.card.MaterialCardView;
-import com.google.android.material.chip.Chip;
import com.libRG.CustomTextView;
import org.greenrobot.eventbus.EventBus;
@@ -309,7 +308,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
if(nsfw) {
if(!(mContext instanceof FilteredThingActivity)) {
- ((DataViewHolder) holder).nsfwChip.setOnClickListener(view -> {
+ ((DataViewHolder) holder).nsfwTextView.setOnClickListener(view -> {
Intent intent = new Intent(mContext, FilteredThingActivity.class);
intent.putExtra(FilteredThingActivity.EXTRA_NAME, post.getSubredditNamePrefixed().substring(2));
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
@@ -318,7 +317,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
mContext.startActivity(intent);
});
}
- ((DataViewHolder) holder).nsfwChip.setVisibility(View.VISIBLE);
+ ((DataViewHolder) holder).nsfwTextView.setVisibility(View.VISIBLE);
}
if(spoiler || flair != null) {
@@ -327,13 +326,11 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
if(spoiler) {
((DataViewHolder) holder).spoilerTextView.setVisibility(View.VISIBLE);
- ((DataViewHolder) holder).spoilerTextView.setBackgroundColor(mContext.getResources().getColor(R.color.backgroundColorPrimaryDark));
}
if(flair != null) {
((DataViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
((DataViewHolder) holder).flairTextView.setText(flair);
- ((DataViewHolder) holder).flairTextView.setBackgroundColor(mContext.getResources().getColor(R.color.backgroundColorPrimaryDark));
}
switch (voteType) {
@@ -377,12 +374,12 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
}
if(!(mContext instanceof FilteredThingActivity)) {
- ((DataViewHolder) holder).typeChip.setOnClickListener(view -> mCallback.typeChipClicked(post.getPostType()));
+ ((DataViewHolder) holder).typeTextView.setOnClickListener(view -> mCallback.typeChipClicked(post.getPostType()));
}
switch (post.getPostType()) {
case Post.IMAGE_TYPE:
- ((DataViewHolder) holder).typeChip.setText(R.string.image);
+ ((DataViewHolder) holder).typeTextView.setText(R.string.image);
final String imageUrl = post.getUrl();
((DataViewHolder) holder).imageView.setOnClickListener(view -> {
@@ -395,7 +392,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.LINK_TYPE:
- ((DataViewHolder) holder).typeChip.setText(R.string.link);
+ ((DataViewHolder) holder).typeTextView.setText(R.string.link);
((DataViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
String domain = Uri.parse(post.getUrl()).getHost();
@@ -413,7 +410,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.GIF_VIDEO_TYPE:
- ((DataViewHolder) holder).typeChip.setText(R.string.gif);
+ ((DataViewHolder) holder).typeTextView.setText(R.string.gif);
final Uri gifVideoUri = Uri.parse(post.getVideoUrl());
((DataViewHolder) holder).imageView.setOnClickListener(view -> {
@@ -426,7 +423,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.VIDEO_TYPE:
- ((DataViewHolder) holder).typeChip.setText(R.string.video);
+ ((DataViewHolder) holder).typeTextView.setText(R.string.video);
final Uri videoUri = Uri.parse(post.getVideoUrl());
((DataViewHolder) holder).imageView.setOnClickListener(view -> {
@@ -439,7 +436,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.NO_PREVIEW_LINK_TYPE:
- ((DataViewHolder) holder).typeChip.setText(R.string.link);
+ ((DataViewHolder) holder).typeTextView.setText(R.string.link);
String noPreviewLinkUrl = post.getUrl();
((DataViewHolder) holder).linkTextView.setVisibility(View.VISIBLE);
@@ -458,7 +455,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.TEXT_TYPE:
- ((DataViewHolder) holder).typeChip.setText(R.string.text);
+ ((DataViewHolder) holder).typeTextView.setText(R.string.text);
break;
}
@@ -516,7 +513,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).downvoteButton.clearColorFilter();
((DataViewHolder) holder).scoreTextView.setText(Integer.toString(post.getScore() + post.getVoteType()));
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post.getId(), post.getVoteType()));
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
@Override
@@ -528,7 +525,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).downvoteButton.setColorFilter(previousDownvoteButtonColorFilter);
((DataViewHolder) holder).scoreTextView.setTextColor(previousScoreTextViewColor);
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post.getId(), post.getVoteType()));
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
}, id, newVoteType, holder.getAdapterPosition());
});
@@ -587,7 +584,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).upvoteButton.clearColorFilter();
((DataViewHolder) holder).scoreTextView.setText(Integer.toString(post.getScore() + post.getVoteType()));
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post.getId(), post.getVoteType()));
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
@Override
@@ -599,11 +596,82 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).downvoteButton.setColorFilter(previousDownvoteButtonColorFilter);
((DataViewHolder) holder).scoreTextView.setTextColor(previousScoreTextViewColor);
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post.getId(), post.getVoteType()));
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
}, id, newVoteType, holder.getAdapterPosition());
});
+ ((DataViewHolder) holder).commentButton.setOnClickListener(view -> {
+ if(mAccessToken == null) {
+ Toast.makeText(mContext, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ Intent intent = new Intent(mContext, CommentActivity.class);
+ intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, post.getFullName());
+ intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, post.getTitle());
+ intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false);
+ intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0);
+ mContext.startActivity(intent);
+ });
+
+ ((DataViewHolder) holder).commentsCountTextView.setText(Integer.toString(post.getnComments()));
+
+ if(post.isSaved()) {
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ } else {
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ }
+
+ ((DataViewHolder) holder).saveButton.setOnClickListener(view -> {
+ if(mAccessToken == null) {
+ Toast.makeText(mContext, R.string.login_first, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if(post.isSaved()) {
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
+ new SaveThing.SaveThingListener() {
+ @Override
+ public void success() {
+ post.setSaved(false);
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ Toast.makeText(mContext, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ }
+
+ @Override
+ public void failed() {
+ post.setSaved(true);
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ Toast.makeText(mContext, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ }
+ });
+ } else {
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ SaveThing.saveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
+ new SaveThing.SaveThingListener() {
+ @Override
+ public void success() {
+ post.setSaved(true);
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
+ Toast.makeText(mContext, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ }
+
+ @Override
+ public void failed() {
+ post.setSaved(false);
+ ((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
+ Toast.makeText(mContext, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
+ EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ }
+ });
+ }
+ });
+
((DataViewHolder) holder).shareButton.setOnClickListener(view -> {
try {
Intent intent = new Intent(Intent.ACTION_SEND);
@@ -703,13 +771,13 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
@BindView(R.id.stickied_post_image_view_item_post) ImageView stickiedPostImageView;
@BindView(R.id.post_time_text_view_best_item_post) TextView postTimeTextView;
@BindView(R.id.title_text_view_best_item_post) TextView titleTextView;
- @BindView(R.id.type_text_view_item_post) Chip typeChip;
+ @BindView(R.id.type_text_view_item_post) CustomTextView typeTextView;
@BindView(R.id.gilded_image_view_item_post) ImageView gildedImageView;
@BindView(R.id.gilded_number_text_view_item_post) TextView gildedNumberTextView;
@BindView(R.id.archived_image_view_item_post) ImageView archivedImageView;
@BindView(R.id.locked_image_view_item_post) ImageView lockedImageView;
@BindView(R.id.crosspost_image_view_item_post) ImageView crosspostImageView;
- @BindView(R.id.nsfw_text_view_item_post) Chip nsfwChip;
+ @BindView(R.id.nsfw_text_view_item_post) CustomTextView nsfwTextView;
@BindView(R.id.spoiler_flair_linear_layout_item_post) LinearLayout spoilerFlairLinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post) CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post) CustomTextView flairTextView;
@@ -722,6 +790,9 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
@BindView(R.id.plus_button_item_post) ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post) TextView scoreTextView;
@BindView(R.id.minus_button_item_post) ImageView downvoteButton;
+ @BindView(R.id.comment_button_item_post) ImageView commentButton;
+ @BindView(R.id.comments_count_item_post) TextView commentsCountTextView;
+ @BindView(R.id.save_button_item_post) ImageView saveButton;
@BindView(R.id.share_button_item_post) ImageView shareButton;
DataViewHolder(View itemView) {
@@ -764,7 +835,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
((DataViewHolder) holder).crosspostImageView.setVisibility(View.GONE);
((DataViewHolder) holder).archivedImageView.setVisibility(View.GONE);
((DataViewHolder) holder).lockedImageView.setVisibility(View.GONE);
- ((DataViewHolder) holder).nsfwChip.setVisibility(View.GONE);
+ ((DataViewHolder) holder).nsfwTextView.setVisibility(View.GONE);
((DataViewHolder) holder).spoilerFlairLinearLayout.setVisibility(View.GONE);
((DataViewHolder) holder).spoilerTextView.setVisibility(View.GONE);
((DataViewHolder) holder).flairTextView.setVisibility(View.GONE);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java
index af3d504f..4646ab84 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java
@@ -1,11 +1,9 @@
package ml.docilealligator.infinityforreddit;
public class PostUpdateEventToDetailActivity {
- public final String postId;
- public final int voteType;
+ public final Post post;
- public PostUpdateEventToDetailActivity(String postId, int voteType) {
- this.postId = postId;
- this.voteType = voteType;
+ public PostUpdateEventToDetailActivity(Post post) {
+ this.post = post;
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
index e3d5d82d..05925be9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
@@ -169,11 +169,7 @@ public class SubredditSelectionActivity extends AppCompatActivity {
getCurrentAccountAndBindView();
} else {
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
- if(mFragment == null) {
- bindView();
- } else {
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
- }
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
index d6d6c0b7..accb7542 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
@@ -902,8 +902,18 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
@Subscribe
public void onPostUpdateEvent(PostUpdateEventToDetailActivity event) {
- if(mPost.getId().equals(event.postId)) {
- mPost.setVoteType(event.voteType);
+ if(mPost.getId().equals(event.post.getId())) {
+ mPost.setVoteType(event.post.getVoteType());
+ mPost.setSaved(event.post.isSaved());
+ if(mMenu != null) {
+ if(event.post.isSaved()) {
+ mMenu.findItem(R.id.action_save_view_post_detail_activity).setIcon(getResources()
+ .getDrawable(R.drawable.ic_baseline_bookmark_24px));
+ } else {
+ mMenu.findItem(R.id.action_save_view_post_detail_activity).setIcon(getResources()
+ .getDrawable(R.drawable.ic_baseline_bookmark_border_24px));
+ }
+ }
mAdapter.updatePost(mPost);
}
}
diff --git a/app/src/main/res/drawable/gold.xml b/app/src/main/res/drawable/gold.xml
index 333984f4..1666013e 100644
--- a/app/src/main/res/drawable/gold.xml
+++ b/app/src/main/res/drawable/gold.xml
@@ -1,5 +1,5 @@
-<vector android:height="24dp" android:viewportHeight="512"
- android:viewportWidth="512" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+<vector android:height="16dp" android:viewportHeight="512"
+ android:viewportWidth="512" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF3636" android:pathData="M470.191,46.036L408.754,5.824c-16.42,-10.748 -38.501,-6.19 -49.334,10.141L248.83,175.589c-2.666,3.847 -2.86,8.89 -0.497,12.931l67.332,115.201c2.184,3.737 6.135,6.208 10.463,6.233c0.029,0 0.058,0 0.087,0c4.785,0 9.487,-2.287 12.388,-6.537L480.357,95.734l0.162,-0.242C491.306,79.01 486.673,56.824 470.191,46.036z"/>
<path android:fillColor="#FF712F" android:pathData="M338.563,286.469L152.591,16.703c-5.229,-7.892 -13.204,-13.301 -22.479,-15.238c-9.342,-1.95 -18.883,-0.147 -26.867,5.079L41.808,46.757C25.326,57.546 20.694,79.732 31.482,96.214l0.112,0.172l141.293,203.513c1.582,2.279 4.139,3.687 6.911,3.805l146.445,6.251c2.932,0 5.894,-0.859 8.49,-2.649C341.544,302.611 343.259,293.281 338.563,286.469z"/>
<path android:fillColor="#FFD561" android:pathData="M383.798,384.115c0,70.514 -57.37,127.885 -127.885,127.885s-127.885,-57.37 -127.885,-127.885c0,-70.524 57.37,-127.895 127.885,-127.895S383.798,313.59 383.798,384.115z"/>
diff --git a/app/src/main/res/drawable/ic_archive_outline_24dp.xml b/app/src/main/res/drawable/ic_archive_outline.xml
index adb84ff6..adb84ff6 100644
--- a/app/src/main/res/drawable/ic_archive_outline_24dp.xml
+++ b/app/src/main/res/drawable/ic_archive_outline.xml
diff --git a/app/src/main/res/drawable/ic_outline_lock_24px.xml b/app/src/main/res/drawable/ic_outline_lock.xml
index f4299e6c..f4299e6c 100644
--- a/app/src/main/res/drawable/ic_outline_lock_24px.xml
+++ b/app/src/main/res/drawable/ic_outline_lock.xml
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 4cf0b16f..50207592 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -205,7 +205,7 @@
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="32dp"
- android:src="@drawable/ic_outline_lock_24px"
+ android:src="@drawable/ic_outline_lock"
android:tint="@color/primaryTextColor"/>
<TextView
diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml
index cb45fbd0..3de19829 100644
--- a/app/src/main/res/layout/item_post.xml
+++ b/app/src/main/res/layout/item_post.xml
@@ -21,9 +21,8 @@
<LinearLayout
android:id="@+id/icon_name_linear_layout_view_item_post"
- android:layout_width="0dp"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- app:layout_constrainedWidth="true"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -58,19 +57,19 @@
app:layout_constraintStart_toEndOf="@id/icon_name_linear_layout_view_item_post"
app:layout_constraintEnd_toStartOf="@+id/post_time_text_view_best_item_post"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintTop_toTopOf="parent"/>
+ app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/post_time_text_view_best_item_post"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
+ android:gravity="end"
android:textSize="?attr/font_default"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/stickied_post_image_view_item_post"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintHorizontal_bias="1"/>
+ app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -88,20 +87,26 @@
android:layout_height="wrap_content"
android:padding="16dp">
- <com.google.android.material.chip.Chip
+ <com.libRG.CustomTextView
android:id="@+id/type_text_view_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
android:textColor="@android:color/white"
- app:chipBackgroundColor="@color/backgroundColorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent"
+ app:lib_setRoundedBGColor="@color/backgroundColorPrimaryDark"
+ app:lib_setRoundedBorderColor="@color/backgroundColorPrimaryDark"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
<ImageView
android:id="@+id/gilded_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
android:src="@drawable/gold"
android:visibility="gone"
@@ -115,7 +120,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:textColor="@color/gold"
- android:textSize="?attr/font_20"
+ android:textSize="?attr/font_default"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/gilded_image_view_item_post"
@@ -123,53 +128,60 @@
<ImageView
android:id="@+id/archived_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
- android:src="@drawable/ic_archive_outline_24dp"
+ android:src="@drawable/ic_archive_outline"
android:tint="@color/archivedTint"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/crosspost_image_view_item_post"
+ app:layout_constraintStart_toEndOf="@+id/gilded_number_text_view_item_post"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/locked_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
- android:src="@drawable/ic_outline_lock_24px"
+ android:src="@drawable/ic_outline_lock"
android:tint="@color/lockedIconTint"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/nsfw_text_view_item_post"
app:layout_constraintStart_toEndOf="@+id/archived_image_view_item_post"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0" />
<ImageView
android:id="@+id/crosspost_image_view_item_post"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
android:src="@drawable/crosspost"
android:tint="@color/colorAccent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/gilded_number_text_view_item_post"
+ app:layout_constraintStart_toEndOf="@+id/locked_image_view_item_post"
app:layout_constraintTop_toTopOf="parent" />
- <com.google.android.material.chip.Chip
+ <com.libRG.CustomTextView
android:id="@+id/nsfw_text_view_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:padding="4dp"
android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
android:textColor="@android:color/white"
android:visibility="gone"
- app:chipBackgroundColor="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/crosspost_image_view_item_post"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="1"
+ app:lib_setRoundedBGColor="@color/colorAccent"
+ app:lib_setRoundedBorderColor="@color/colorAccent"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -192,7 +204,8 @@
android:padding="4dp"
android:visibility="gone"
app:lib_setRadius="3dp"
- app:lib_setRoundedBorderColor="@color/colorPrimaryDarkDayNightTheme"
+ app:lib_setRoundedBGColor="@color/backgroundColorPrimaryDark"
+ app:lib_setRoundedBorderColor="@color/backgroundColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
@@ -207,7 +220,8 @@
android:padding="4dp"
android:visibility="gone"
app:lib_setRadius="3dp"
- app:lib_setRoundedBorderColor="@color/colorPrimaryDarkDayNightTheme"
+ app:lib_setRoundedBGColor="@color/backgroundColorPrimaryDark"
+ app:lib_setRoundedBorderColor="@color/backgroundColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
@@ -221,7 +235,7 @@
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textSize="?attr/font_12"
- android:visibility="gone"/>
+ android:visibility="gone" />
<RelativeLayout
android:id="@+id/image_view_wrapper_item_post"
@@ -272,7 +286,7 @@
android:background="@color/grey"
android:visibility="gone"/>
- <RelativeLayout
+ <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -280,52 +294,98 @@
android:id="@+id/plus_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:padding="16dp"
+ android:padding="12dp"
android:src="@drawable/ic_arrow_upward_black_24dp"
- android:layout_centerVertical="true"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
- android:focusable="true"/>
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/score_text_view_item_post"
android:layout_width="64dp"
android:layout_height="match_parent"
- android:layout_toEndOf="@id/plus_button_item_post"
- android:layout_alignBottom="@id/plus_button_item_post"
- android:layout_alignParentTop="true"
android:gravity="center"
- android:textSize="?attr/font_default" />
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post" />
<ImageView
android:id="@+id/minus_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:layout_toEndOf="@id/score_text_view_item_post"
- android:padding="16dp"
+ android:padding="12dp"
android:src="@drawable/ic_arrow_downward_black_24dp"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
- android:focusable="true"/>
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post" />
+
+ <ImageView
+ android:id="@+id/comment_button_item_post"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_comment_white_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comment_button_item_post" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post" />
<ImageView
android:id="@+id/share_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_centerVertical="true"
- android:padding="16dp"
+ android:padding="12dp"
android:src="@drawable/ic_outline_share_24px"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
- android:focusable="true" />
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1" />
- </RelativeLayout>
+ </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml
index c0979ca8..c6dff0a7 100644
--- a/app/src/main/res/layout/item_post_detail.xml
+++ b/app/src/main/res/layout/item_post_detail.xml
@@ -13,7 +13,7 @@
<RelativeLayout
android:id="@+id/subreddit_icon_name_relative_layout_item_post_detail"
- android:layout_width="0dp"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:layout_constrainedWidth="true"
@@ -53,10 +53,11 @@
<TextView
android:id="@+id/post_time_text_view_item_post_detail"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
+ android:gravity="end"
android:textSize="?attr/font_default"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/subreddit_icon_name_relative_layout_item_post_detail"
@@ -89,15 +90,22 @@
android:layout_height="wrap_content"
android:padding="16dp">
- <com.google.android.material.chip.Chip
+ <com.libRG.CustomTextView
android:id="@+id/type_text_view_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:padding="4dp"
+ android:textSize="?attr/font_12"
android:textColor="@android:color/white"
app:chipBackgroundColor="@color/backgroundColorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent"
+ app:lib_setRoundedBGColor="@color/backgroundColorPrimaryDark"
+ app:lib_setRoundedBorderColor="@color/backgroundColorPrimaryDark"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
<ImageView
android:id="@+id/gilded_image_view_item_post_detail"
@@ -116,7 +124,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:textColor="@color/gold"
- android:textSize="?attr/font_20"
+ android:textSize="?attr/font_default"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/gilded_image_view_item_post_detail"
@@ -124,10 +132,10 @@
<ImageView
android:id="@+id/archived_image_view_item_post_detail"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
- android:src="@drawable/ic_archive_outline_24dp"
+ android:src="@drawable/ic_archive_outline"
android:tint="@color/archivedTint"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
@@ -136,10 +144,10 @@
<ImageView
android:id="@+id/locked_image_view_item_post_detail"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
- android:src="@drawable/ic_outline_lock_24px"
+ android:src="@drawable/ic_outline_lock"
android:tint="@color/lockedIconTint"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
@@ -150,8 +158,8 @@
<ImageView
android:id="@+id/crosspost_image_view_item_post_detail"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
android:layout_marginStart="16dp"
android:src="@drawable/crosspost"
android:tint="@color/colorAccent"
@@ -160,17 +168,25 @@
app:layout_constraintStart_toEndOf="@+id/gilded_number_text_view_item_post_detail"
app:layout_constraintTop_toTopOf="parent" />
- <com.google.android.material.chip.Chip
+ <com.libRG.CustomTextView
android:id="@+id/nsfw_text_view_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:padding="4dp"
android:text="@string/nsfw"
+ android:textSize="?attr/font_12"
android:textColor="@android:color/white"
android:visibility="gone"
app:chipBackgroundColor="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintHorizontal_bias="1"
+ app:lib_setRoundedBGColor="@color/colorAccent"
+ app:lib_setRoundedBorderColor="@color/colorAccent"
+ app:lib_setRadius="3dp"
+ app:lib_setRoundedView="true"
+ app:lib_setShape="rectangle" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -203,9 +219,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
+ android:padding="4dp"
android:textSize="?attr/font_12"
android:textColor="@android:color/white"
- android:padding="4dp"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBorderColor="@color/colorPrimaryDarkDayNightTheme"
@@ -274,7 +290,7 @@
android:tint="@android:color/tab_indicator_text"
android:visibility="gone" />
- <RelativeLayout
+ <!--<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -326,6 +342,107 @@
android:src="@drawable/ic_outline_share_24px"
android:tint="@android:color/tab_indicator_text" />
- </RelativeLayout>
+ </RelativeLayout>-->
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:id="@+id/plus_button_item_post_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_upward_black_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <TextView
+ android:id="@+id/score_text_view_item_post_detail"
+ android:layout_width="64dp"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail" />
+
+ <ImageView
+ android:id="@+id/minus_button_item_post_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_arrow_downward_black_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail" />
+
+ <ImageView
+ android:id="@+id/comment_button_item_post_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_comment_white_24dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail" />
+
+ <TextView
+ android:id="@+id/comments_count_item_post_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="?attr/font_12"
+ android:textStyle="bold"
+ app:layout_constraintHorizontal_bias="0"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comment_button_item_post_detail" />
+
+ <ImageView
+ android:id="@+id/save_button_item_post_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintHorizontal_bias="1"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail"
+ app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail" />
+
+ <ImageView
+ android:id="@+id/share_button_item_post_detail"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="12dp"
+ android:src="@drawable/ic_outline_share_24px"
+ android:tint="@android:color/tab_indicator_text"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> \ No newline at end of file