diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-09-15 21:50:36 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-09-15 21:50:36 +0000 |
commit | 7252dce6e3f7df54440e1c2cdb88a02270e61f48 (patch) | |
tree | 4ad0cfd71ea91a148a40728b3e74082bcdbdcf08 /app | |
parent | 6453d41f288fbb4f485481388ca6ed29e094d802 (diff) | |
download | infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.tar infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.tar.gz infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.tar.bz2 infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.tar.lz infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.tar.xz infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.tar.zst infinity-for-reddit-7252dce6e3f7df54440e1c2cdb88a02270e61f48.zip |
Continue changing vote button icons.
Diffstat (limited to '')
10 files changed, 1350 insertions, 1454 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 1aad70b1..3867c3c7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -8,7 +8,6 @@ import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; -import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.net.Uri; @@ -20,10 +19,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; -import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; @@ -48,6 +44,8 @@ import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.DefaultTimeBar; import com.google.android.exoplayer2.ui.PlayerView; import com.google.android.exoplayer2.ui.TimeBar; +import com.google.android.material.button.MaterialButton; +import com.google.android.material.button.MaterialButtonToggleGroup; import com.google.common.collect.ImmutableList; import com.libRG.CustomTextView; @@ -57,8 +55,6 @@ import java.util.concurrent.Executor; import javax.inject.Provider; -import butterknife.BindView; -import butterknife.ButterKnife; import io.noties.markwon.AbstractMarkwonPlugin; import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; @@ -99,6 +95,14 @@ import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView; import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface; import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailGalleryBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailImageAndGifAutoplayBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailLinkBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailNoPreviewBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailTextBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailVideoAndGifPreviewBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailVideoAutoplayBinding; +import ml.docilealligator.infinityforreddit.databinding.ItemPostDetailVideoAutoplayLegacyControllerBinding; import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment; import ml.docilealligator.infinityforreddit.markdown.MarkdownUtils; import ml.docilealligator.infinityforreddit.post.Post; @@ -430,47 +434,52 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler case VIEW_TYPE_POST_DETAIL_VIDEO_AUTOPLAY: if (mDataSavingMode) { if (mDisableImagePreview || mOnlyDisablePreviewInVideoAndGifPosts) { - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailVideoAndGifPreviewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_video_and_gif_preview, parent, false)); + return new PostDetailVideoAndGifPreviewHolder(ItemPostDetailVideoAndGifPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); + } + + if (mLegacyAutoplayVideoControllerUI) { + return new PostDetailVideoAutoplayLegacyControllerViewHolder(ItemPostDetailVideoAutoplayLegacyControllerBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); + } else { + return new PostDetailVideoAutoplayViewHolder(ItemPostDetailVideoAutoplayBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailVideoAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(mLegacyAutoplayVideoControllerUI ? R.layout.item_post_detail_video_autoplay_legacy_controller : R.layout.item_post_detail_video_autoplay, parent, false)); case VIEW_TYPE_POST_DETAIL_VIDEO_AND_GIF_PREVIEW: if (mDataSavingMode && (mDisableImagePreview || mOnlyDisablePreviewInVideoAndGifPosts)) { - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailVideoAndGifPreviewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_video_and_gif_preview, parent, false)); + return new PostDetailVideoAndGifPreviewHolder(ItemPostDetailVideoAndGifPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); case VIEW_TYPE_POST_DETAIL_IMAGE: if (mDataSavingMode && mDisableImagePreview) { - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailImageAndGifAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_image_and_gif_autoplay, parent, false)); + return new PostDetailImageAndGifAutoplayViewHolder(ItemPostDetailImageAndGifAutoplayBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); case VIEW_TYPE_POST_DETAIL_GIF_AUTOPLAY: if (mDataSavingMode && (mDisableImagePreview || mOnlyDisablePreviewInVideoAndGifPosts)) { - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailImageAndGifAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_image_and_gif_autoplay, parent, false)); + return new PostDetailImageAndGifAutoplayViewHolder(ItemPostDetailImageAndGifAutoplayBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); case VIEW_TYPE_POST_DETAIL_LINK: if (mDataSavingMode && mDisableImagePreview) { - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailLinkViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_link, parent, false)); + return new PostDetailLinkViewHolder(ItemPostDetailLinkBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); case VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK: - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); case VIEW_TYPE_POST_DETAIL_GALLERY: if (mDataSavingMode && mDisableImagePreview) { - return new PostDetailNoPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_no_preview, parent, false)); + return new PostDetailNoPreviewViewHolder(ItemPostDetailNoPreviewBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } - return new PostDetailGalleryViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_gallery, parent, false)); + return new PostDetailGalleryViewHolder(ItemPostDetailGalleryBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); default: - return new PostDetailTextViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_detail_text, parent, false)); + return new PostDetailTextViewHolder(ItemPostDetailTextBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof PostDetailBaseViewHolder) { - ((PostDetailBaseViewHolder) holder).mTitleTextView.setText(mPost.getTitle()); + ((PostDetailBaseViewHolder) holder).titleTextView.setText(mPost.getTitle()); if (mPost.getSubredditNamePrefixed().startsWith("u/")) { if (mPost.getAuthorIconUrl() == null) { String authorName = mPost.isAuthorDeleted() ? mPost.getSubredditNamePrefixed().substring(2) : mPost.getAuthor(); @@ -479,13 +488,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if (iconImageUrl == null || iconImageUrl.equals("")) { mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } else { mGlide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } if (holder.getBindingAdapterPosition() >= 0) { @@ -498,11 +507,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } else { mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } } else { if (mPost.getSubredditIconUrl() == null) { @@ -512,13 +521,13 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if (iconImageUrl == null || iconImageUrl.equals("")) { mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } else { mGlide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } mPost.setSubredditIconUrl(iconImageUrl); @@ -528,147 +537,148 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } else { mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((PostDetailBaseViewHolder) holder).mIconGifImageView); + .into(((PostDetailBaseViewHolder) holder).iconGifImageView); } } if (mPost.getAuthorFlairHTML() != null && !mPost.getAuthorFlairHTML().equals("")) { - ((PostDetailBaseViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE); - Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mAuthorFlairTextView, mPost.getAuthorFlairHTML(), true); + ((PostDetailBaseViewHolder) holder).authorFlairTextView.setVisibility(View.VISIBLE); + Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).authorFlairTextView, mPost.getAuthorFlairHTML(), true); } else if (mPost.getAuthorFlair() != null && !mPost.getAuthorFlair().equals("")) { - ((PostDetailBaseViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE); - ((PostDetailBaseViewHolder) holder).mAuthorFlairTextView.setText(mPost.getAuthorFlair()); + ((PostDetailBaseViewHolder) holder).authorFlairTextView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).authorFlairTextView.setText(mPost.getAuthorFlair()); } switch (mPost.getVoteType()) { case 1: - //Upvote - ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mUpvotedColor); + //Upvoted + ((PostDetailBaseViewHolder) holder).upvoteButton.setTextColor(mUpvotedColor); + ((PostDetailBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp); + ((PostDetailBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor)); break; case -1: - //Downvote - ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mDownvotedColor); + //Downvoted + ((PostDetailBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp); + ((PostDetailBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor)); break; case 0: - ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor); + ((PostDetailBaseViewHolder) holder).upvoteButton.setTextColor(mPostIconAndInfoColor); + ((PostDetailBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); + ((PostDetailBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); + ((PostDetailBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); + ((PostDetailBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); } if (mPost.isArchived()) { - ((PostDetailBaseViewHolder) holder).mUpvoteButton - .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mDownvoteButton - .setColorFilter(mVoteAndReplyUnavailableVoteButtonColor, PorterDuff.Mode.SRC_IN); + ((PostDetailBaseViewHolder) holder).upvoteButton.setBackgroundTintList(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor)); + ((PostDetailBaseViewHolder) holder).downvoteButton.setBackgroundTintList(ColorStateList.valueOf(mVoteAndReplyUnavailableVoteButtonColor)); } if (mPost.isCrosspost()) { - ((PostDetailBaseViewHolder) holder).mCrosspostImageView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).crosspostImageView.setVisibility(View.VISIBLE); } if (!mHideSubredditAndUserPrefix) { - ((PostDetailBaseViewHolder) holder).mSubredditTextView.setText("r/" + mPost.getSubredditName()); - ((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthorNamePrefixed()); + ((PostDetailBaseViewHolder) holder).subredditTextView.setText("r/" + mPost.getSubredditName()); + ((PostDetailBaseViewHolder) holder).userTextView.setText(mPost.getAuthorNamePrefixed()); } else { - ((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditName()); - ((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthor()); + ((PostDetailBaseViewHolder) holder).subredditTextView.setText(mPost.getSubredditName()); + ((PostDetailBaseViewHolder) holder).userTextView.setText(mPost.getAuthor()); } if (mPost.isModerator()) { - ((PostDetailBaseViewHolder) holder).mUserTextView.setTextColor(mModeratorColor); + ((PostDetailBaseViewHolder) holder).userTextView.setTextColor(mModeratorColor); Drawable moderatorDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_verified_user_14dp, mModeratorColor); - ((PostDetailBaseViewHolder) holder).mUserTextView.setCompoundDrawablesWithIntrinsicBounds( + ((PostDetailBaseViewHolder) holder).userTextView.setCompoundDrawablesWithIntrinsicBounds( moderatorDrawable, null, null, null); } if (mShowElapsedTime) { - ((PostDetailBaseViewHolder) holder).mPostTimeTextView.setText( + ((PostDetailBaseViewHolder) holder).postTimeTextView.setText( Utils.getElapsedTime(mActivity, mPost.getPostTimeMillis())); } else { - ((PostDetailBaseViewHolder) holder).mPostTimeTextView.setText(Utils.getFormattedTime(mLocale, mPost.getPostTimeMillis(), mTimeFormatPattern)); + ((PostDetailBaseViewHolder) holder).postTimeTextView.setText(Utils.getFormattedTime(mLocale, mPost.getPostTimeMillis(), mTimeFormatPattern)); } if (mPost.isArchived()) { - ((PostDetailBaseViewHolder) holder).mArchivedImageView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).archivedImageView.setVisibility(View.VISIBLE); } if (mPost.isLocked()) { - ((PostDetailBaseViewHolder) holder).mLockedImageView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).lockedImageView.setVisibility(View.VISIBLE); } if (mPost.isSpoiler()) { - ((PostDetailBaseViewHolder) holder).mSpoilerTextView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).spoilerTextView.setVisibility(View.VISIBLE); } if (!mHidePostFlair && mPost.getFlair() != null && !mPost.getFlair().equals("")) { - ((PostDetailBaseViewHolder) holder).mFlairTextView.setVisibility(View.VISIBLE); - Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mFlairTextView, mPost.getFlair(), false); + ((PostDetailBaseViewHolder) holder).flairTextView.setVisibility(View.VISIBLE); + Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).flairTextView, mPost.getFlair(), false); } if (!mHideTheNumberOfAwards && mPost.getAwards() != null && !mPost.getAwards().equals("")) { - ((PostDetailBaseViewHolder) holder).mAwardsTextView.setVisibility(View.VISIBLE); - Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).mAwardsTextView, mPost.getAwards(), true); + ((PostDetailBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE); + Utils.setHTMLWithImageToTextView(((PostDetailBaseViewHolder) holder).awardsTextView, mPost.getAwards(), true); } if (mHideUpvoteRatio) { - ((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setVisibility(View.GONE); + ((PostDetailBaseViewHolder) holder).upvoteRatioTextView.setVisibility(View.GONE); } else { - ((PostDetailBaseViewHolder) holder).mUpvoteRatioTextView.setText(mPost.getUpvoteRatio() + "%"); + ((PostDetailBaseViewHolder) holder).upvoteRatioTextView.setText(mPost.getUpvoteRatio() + "%"); } if (mPost.isNSFW()) { - ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).nsfwTextView.setVisibility(View.VISIBLE); } else { - ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.GONE); + ((PostDetailBaseViewHolder) holder).nsfwTextView.setVisibility(View.GONE); } if (!mHideTheNumberOfVotes) { - ((PostDetailBaseViewHolder) holder).mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); + ((PostDetailBaseViewHolder) holder).upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); } else { - ((PostDetailBaseViewHolder) holder).mScoreTextView.setText(mActivity.getString(R.string.vote)); + ((PostDetailBaseViewHolder) holder).upvoteButton.setText(mActivity.getString(R.string.vote)); } - ((PostDetailBaseViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getNComments())); + ((PostDetailBaseViewHolder) holder).commentsCountButton.setText(Integer.toString(mPost.getNComments())); if (mPost.isSaved()) { - ((PostDetailBaseViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + ((PostDetailBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); } else { - ((PostDetailBaseViewHolder) holder).mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + ((PostDetailBaseViewHolder) holder).saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); } if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) { - ((PostDetailBaseViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE); - ((PostDetailBaseViewHolder) holder).mContentMarkdownView.setAdapter(mMarkwonAdapter); + ((PostDetailBaseViewHolder) holder).contentMarkdownView.setVisibility(View.VISIBLE); + ((PostDetailBaseViewHolder) holder).contentMarkdownView.setAdapter(mMarkwonAdapter); mMarkwonAdapter.setMarkdown(mPostDetailMarkwon, mPost.getSelfText()); // noinspection NotifyDataSetChanged mMarkwonAdapter.notifyDataSetChanged(); } - if (holder instanceof PostDetailVideoAutoplayViewHolder) { - ((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE); + if (holder instanceof PostDetailBaseVideoAutoplayViewHolder) { + ((PostDetailBaseVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.VISIBLE); Post.Preview preview = getSuitablePreview(mPost.getPreviews()); if (preview != null) { - ((PostDetailVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewWidth() / preview.getPreviewHeight()); - mGlide.load(preview.getPreviewUrl()).centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailVideoAutoplayViewHolder) holder).previewImageView); + ((PostDetailBaseVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio((float) preview.getPreviewWidth() / preview.getPreviewHeight()); + mGlide.load(preview.getPreviewUrl()).centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailBaseVideoAutoplayViewHolder) holder).previewImageView); } else { - ((PostDetailVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio(1); + ((PostDetailBaseVideoAutoplayViewHolder) holder).aspectRatioFrameLayout.setAspectRatio(1); } - if (!((PostDetailVideoAutoplayViewHolder) holder).isManuallyPaused) { - ((PostDetailVideoAutoplayViewHolder) holder).setVolume((mMuteAutoplayingVideos || (mPost.isNSFW() && mMuteNSFWVideo)) ? 0f : 1f); + if (!((PostDetailBaseVideoAutoplayViewHolder) holder).isManuallyPaused) { + ((PostDetailBaseVideoAutoplayViewHolder) holder).setVolume((mMuteAutoplayingVideos || (mPost.isNSFW() && mMuteNSFWVideo)) ? 0f : 1f); } if (mPost.isGfycat() || mPost.isRedgifs() && !mPost.isLoadGfycatOrStreamableVideoSuccess()) { - ((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall = + ((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall = mPost.isGfycat() ? mGfycatRetrofit.create(GfycatAPI.class).getGfycatData(mPost.getGfycatId()) : mRedgifsRetrofit.create(RedgifsAPI.class).getRedgifsData(APIUtils.getRedgifsOAuthHeader(mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.REDGIFS_ACCESS_TOKEN, "")), mPost.getGfycatId(), APIUtils.USER_AGENT); FetchGfycatOrRedgifsVideoLinks.fetchGfycatOrRedgifsVideoLinksInRecyclerViewAdapter(mExecutor, new Handler(), - ((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall, + ((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall, mPost.isGfycat(), mAutomaticallyTryRedgifs, new FetchGfycatOrRedgifsVideoLinks.FetchGfycatOrRedgifsVideoLinksListener() { @Override @@ -676,19 +686,19 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mPost.setVideoDownloadUrl(mp4); mPost.setVideoUrl(mp4); mPost.setLoadGfyOrStreamableVideoSuccess(true); - ((PostDetailVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl())); + ((PostDetailBaseVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl())); } @Override public void failed(int errorCode) { - ((PostDetailVideoAutoplayViewHolder) holder).mErrorLoadingGfycatImageView.setVisibility(View.VISIBLE); + ((PostDetailBaseVideoAutoplayViewHolder) holder).mErrorLoadingGfycatImageView.setVisibility(View.VISIBLE); } }); } else if(mPost.isStreamable() && !mPost.isLoadGfycatOrStreamableVideoSuccess()) { - ((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall = + ((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall = mStreamableApiProvider.get().getStreamableData(mPost.getStreamableShortCode()); FetchStreamableVideo.fetchStreamableVideoInRecyclerViewAdapter(mExecutor, new Handler(), - ((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall, + ((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall, new FetchStreamableVideo.FetchStreamableVideoListener() { @Override public void success(StreamableVideo streamableVideo) { @@ -696,36 +706,36 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mPost.setVideoDownloadUrl(media.url); mPost.setVideoUrl(media.url); mPost.setLoadGfyOrStreamableVideoSuccess(true); - ((PostDetailVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl())); + ((PostDetailBaseVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl())); } @Override public void failed() { - ((PostDetailVideoAutoplayViewHolder) holder).mErrorLoadingGfycatImageView.setVisibility(View.VISIBLE); + ((PostDetailBaseVideoAutoplayViewHolder) holder).mErrorLoadingGfycatImageView.setVisibility(View.VISIBLE); } }); } else { - ((PostDetailVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl())); + ((PostDetailBaseVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(mPost.getVideoUrl())); } } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) { if (!mHidePostType) { if (mPost.getPostType() == Post.GIF_TYPE) { - ((PostDetailVideoAndGifPreviewHolder) holder).mTypeTextView.setText(mActivity.getString(R.string.gif)); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.typeTextViewItemPostDetailVideoAndGifPreview.setText(mActivity.getString(R.string.gif)); } else { - ((PostDetailVideoAndGifPreviewHolder) holder).mTypeTextView.setText(mActivity.getString(R.string.video)); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.typeTextViewItemPostDetailVideoAndGifPreview.setText(mActivity.getString(R.string.video)); } } Post.Preview preview = getSuitablePreview(mPost.getPreviews()); if (preview != null) { - ((PostDetailVideoAndGifPreviewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth()); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.imageViewItemPostDetailVideoAndGifPreview.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth()); loadImage((PostDetailVideoAndGifPreviewHolder) holder, preview); } } else if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) { if (!mHidePostType) { if (mPost.getPostType() == Post.IMAGE_TYPE) { - ((PostDetailImageAndGifAutoplayViewHolder) holder).mTypeTextView.setText(R.string.image); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.typeTextViewItemPostDetailImageAndGifAutoplay.setText(R.string.image); } else { - ((PostDetailImageAndGifAutoplayViewHolder) holder).mTypeTextView.setText(R.string.gif); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.typeTextViewItemPostDetailImageAndGifAutoplay.setText(R.string.gif); } } @@ -733,66 +743,66 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if (preview != null) { if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { int height = (int) (400 * mScale); - ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); - ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.getLayoutParams().height = height; + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.imageViewItemPostDetailImageAndGifAutoplay.setScaleType(ImageView.ScaleType.CENTER_CROP); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.imageViewItemPostDetailImageAndGifAutoplay.getLayoutParams().height = height; } else { - ((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth()); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.imageViewItemPostDetailImageAndGifAutoplay.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth()); } loadImage((PostDetailImageAndGifAutoplayViewHolder) holder, preview); } } else if (holder instanceof PostDetailLinkViewHolder) { String domain = Uri.parse(mPost.getUrl()).getHost(); - ((PostDetailLinkViewHolder) holder).mLinkTextView.setText(domain); + ((PostDetailLinkViewHolder) holder).binding.linkTextViewItemPostDetailLink.setText(domain); Post.Preview preview = getSuitablePreview(mPost.getPreviews()); if (preview != null) { - ((PostDetailLinkViewHolder) holder).mImageView.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth()); + ((PostDetailLinkViewHolder) holder).binding.imageViewItemPostDetailLink.setRatio((float) preview.getPreviewHeight() / (float) preview.getPreviewWidth()); loadImage((PostDetailLinkViewHolder) holder, preview); } } else if (holder instanceof PostDetailNoPreviewViewHolder) { if (mPost.getPostType() == Post.LINK_TYPE || mPost.getPostType() == Post.NO_PREVIEW_LINK_TYPE) { if (!mHidePostType) { - ((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.link); + ((PostDetailNoPreviewViewHolder) holder).binding.typeTextViewItemPostDetailNoPreview.setText(R.string.link); } String noPreviewLinkDomain = Uri.parse(mPost.getUrl()).getHost(); - ((PostDetailNoPreviewViewHolder) holder).mLinkTextView.setVisibility(View.VISIBLE); - ((PostDetailNoPreviewViewHolder) holder).mLinkTextView.setText(noPreviewLinkDomain); - ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_link); + ((PostDetailNoPreviewViewHolder) holder).binding.linkTextViewItemPostDetailNoPreview.setVisibility(View.VISIBLE); + ((PostDetailNoPreviewViewHolder) holder).binding.linkTextViewItemPostDetailNoPreview.setText(noPreviewLinkDomain); + ((PostDetailNoPreviewViewHolder) holder).binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setImageResource(R.drawable.ic_link); } else { - ((PostDetailNoPreviewViewHolder) holder).mLinkTextView.setVisibility(View.GONE); + ((PostDetailNoPreviewViewHolder) holder).binding.linkTextViewItemPostDetailNoPreview.setVisibility(View.GONE); switch (mPost.getPostType()) { case Post.VIDEO_TYPE: if (!mHidePostType) { - ((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.video); + ((PostDetailNoPreviewViewHolder) holder).binding.typeTextViewItemPostDetailNoPreview.setText(R.string.video); } - ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_outline_video_24dp); + ((PostDetailNoPreviewViewHolder) holder).binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setImageResource(R.drawable.ic_outline_video_24dp); break; case Post.IMAGE_TYPE: if (!mHidePostType) { - ((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.image); + ((PostDetailNoPreviewViewHolder) holder).binding.typeTextViewItemPostDetailNoPreview.setText(R.string.image); } - ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_image_24dp); + ((PostDetailNoPreviewViewHolder) holder).binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setImageResource(R.drawable.ic_image_24dp); break; case Post.GIF_TYPE: if (!mHidePostType) { - ((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.gif); + ((PostDetailNoPreviewViewHolder) holder).binding.typeTextViewItemPostDetailNoPreview.setText(R.string.gif); } - ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_image_24dp); + ((PostDetailNoPreviewViewHolder) holder).binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setImageResource(R.drawable.ic_image_24dp); break; case Post.GALLERY_TYPE: if (!mHidePostType) { - ((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.gallery); + ((PostDetailNoPreviewViewHolder) holder).binding.typeTextViewItemPostDetailNoPreview.setText(R.string.gallery); } - ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_gallery_24dp); + ((PostDetailNoPreviewViewHolder) holder).binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setImageResource(R.drawable.ic_gallery_24dp); break; } } } else if (holder instanceof PostDetailGalleryViewHolder) { if (mDataSavingMode && mDisableImagePreview) { - ((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.VISIBLE); - ((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_gallery_24dp); + ((PostDetailGalleryViewHolder) holder).binding.noPreviewPostTypeImageViewItemPostDetailGallery.setVisibility(View.VISIBLE); + ((PostDetailGalleryViewHolder) holder).binding.noPreviewPostTypeImageViewItemPostDetailGallery.setImageResource(R.drawable.ic_gallery_24dp); } else { - ((PostDetailGalleryViewHolder) holder).galleryFrameLayout.setVisibility(View.VISIBLE); - ((PostDetailGalleryViewHolder) holder).imageIndexTextView.setText(mActivity.getString(R.string.image_index_in_gallery, 1, mPost.getGallery().size())); + ((PostDetailGalleryViewHolder) holder).binding.galleryFrameLayoutItemPostDetailGallery.setVisibility(View.VISIBLE); + ((PostDetailGalleryViewHolder) holder).binding.imageIndexTextViewItemPostDetailGallery.setText(mActivity.getString(R.string.image_index_in_gallery, 1, mPost.getGallery().size())); Post.Preview preview = getSuitablePreview(mPost.getPreviews()); if (preview != null) { if (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0) { @@ -845,11 +855,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler .listener(new RequestListener<>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { - ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE); - ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE); - ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> { - ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE); - ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.progressBarItemPostDetailImageAndGifAutoplay.setVisibility(View.GONE); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.loadImageErrorTextViewItemPostDetailImageAndGifAutoplay.setVisibility(View.VISIBLE); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.loadImageErrorTextViewItemPostDetailImageAndGifAutoplay.setOnClickListener(view -> { + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.progressBarItemPostDetailImageAndGifAutoplay.setVisibility(View.VISIBLE); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.loadImageErrorTextViewItemPostDetailImageAndGifAutoplay.setVisibility(View.GONE); loadImage(holder, preview); }); return false; @@ -857,26 +867,26 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { - ((PostDetailImageAndGifAutoplayViewHolder) holder).mLoadWrapper.setVisibility(View.GONE); + ((PostDetailImageAndGifAutoplayViewHolder) holder).binding.loadWrapperItemPostDetailImageAndGifAutoplay.setVisibility(View.GONE); return false; } }); if (blurImage) { - imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); + imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailImageAndGifAutoplayViewHolder) holder).binding.imageViewItemPostDetailImageAndGifAutoplay); } else { - imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailImageAndGifAutoplayViewHolder) holder).binding.imageViewItemPostDetailImageAndGifAutoplay); } } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(preview.getPreviewUrl()) .listener(new RequestListener<>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { - ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE); - ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE); - ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> { - ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE); - ((PostDetailVideoAndGifPreviewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.progressBarItemPostDetailVideoAndGifPreview.setVisibility(View.GONE); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.loadImageErrorTextViewItemPostDetailVideoAndGifPreview.setVisibility(View.VISIBLE); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.loadImageErrorTextViewItemPostDetailVideoAndGifPreview.setOnClickListener(view -> { + ((PostDetailVideoAndGifPreviewHolder) holder).binding.progressBarItemPostDetailVideoAndGifPreview.setVisibility(View.VISIBLE); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.loadImageErrorTextViewItemPostDetailVideoAndGifPreview.setVisibility(View.GONE); loadImage(holder, preview); }); return false; @@ -884,27 +894,27 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { - ((PostDetailVideoAndGifPreviewHolder) holder).mLoadWrapper.setVisibility(View.GONE); + ((PostDetailVideoAndGifPreviewHolder) holder).binding.loadWrapperItemPostDetailVideoAndGifPreview.setVisibility(View.GONE); return false; } }); if ((mPost.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (mPost.isSpoiler() && mNeedBlurSpoiler)) { imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) - .into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); + .into(((PostDetailVideoAndGifPreviewHolder) holder).binding.imageViewItemPostDetailVideoAndGifPreview); } else { - imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailVideoAndGifPreviewHolder) holder).binding.imageViewItemPostDetailVideoAndGifPreview); } } else if (holder instanceof PostDetailLinkViewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(preview.getPreviewUrl()) .listener(new RequestListener<>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { - ((PostDetailLinkViewHolder) holder).mLoadImageProgressBar.setVisibility(View.GONE); - ((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.VISIBLE); - ((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setOnClickListener(view -> { - ((PostDetailLinkViewHolder) holder).mLoadImageProgressBar.setVisibility(View.VISIBLE); - ((PostDetailLinkViewHolder) holder).mLoadImageErrorTextView.setVisibility(View.GONE); + ((PostDetailLinkViewHolder) holder).binding.progressBarItemPostDetailLink.setVisibility(View.GONE); + ((PostDetailLinkViewHolder) holder).binding.loadImageErrorTextViewItemPostDetailLink.setVisibility(View.VISIBLE); + ((PostDetailLinkViewHolder) holder).binding.loadImageErrorTextViewItemPostDetailLink.setOnClickListener(view -> { + ((PostDetailLinkViewHolder) holder).binding.progressBarItemPostDetailLink.setVisibility(View.VISIBLE); + ((PostDetailLinkViewHolder) holder).binding.loadImageErrorTextViewItemPostDetailLink.setVisibility(View.GONE); loadImage(holder, preview); }); return false; @@ -912,16 +922,16 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { - ((PostDetailLinkViewHolder) holder).mLoadWrapper.setVisibility(View.GONE); + ((PostDetailLinkViewHolder) holder).binding.loadWrapperItemPostDetailLink.setVisibility(View.GONE); return false; } }); if ((mPost.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (mPost.isSpoiler() && mNeedBlurSpoiler)) { imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) - .into(((PostDetailLinkViewHolder) holder).mImageView); + .into(((PostDetailLinkViewHolder) holder).binding.imageViewItemPostDetailLink); } else { - imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailLinkViewHolder) holder).mImageView); + imageRequestBuilder.centerInside().downsample(mSaveMemoryCenterInsideDownsampleStrategy).into(((PostDetailLinkViewHolder) holder).binding.imageViewItemPostDetailLink); } } } @@ -952,15 +962,15 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if (viewHolder instanceof PostDetailBaseViewHolder) { if (direction == ItemTouchHelper.LEFT || direction == ItemTouchHelper.START) { if (swipeLeftAction == SharedPreferencesUtils.SWIPE_ACITON_UPVOTE) { - ((PostDetailBaseViewHolder) viewHolder).mUpvoteButton.performClick(); + ((PostDetailBaseViewHolder) viewHolder).upvoteButton.performClick(); } else if (swipeLeftAction == SharedPreferencesUtils.SWIPE_ACITON_DOWNVOTE) { - ((PostDetailBaseViewHolder) viewHolder).mDownvoteButton.performClick(); + ((PostDetailBaseViewHolder) viewHolder).downvoteButton.performClick(); } } else { if (swipeRightAction == SharedPreferencesUtils.SWIPE_ACITON_UPVOTE) { - ((PostDetailBaseViewHolder) viewHolder).mUpvoteButton.performClick(); + ((PostDetailBaseViewHolder) viewHolder).upvoteButton.performClick(); } else if (swipeRightAction == SharedPreferencesUtils.SWIPE_ACITON_DOWNVOTE) { - ((PostDetailBaseViewHolder) viewHolder).mDownvoteButton.performClick(); + ((PostDetailBaseViewHolder) viewHolder).downvoteButton.performClick(); } } } @@ -984,35 +994,37 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { if (holder instanceof PostDetailBaseViewHolder) { - ((PostDetailBaseViewHolder) holder).mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mScoreTextView.setTextColor(mPostIconAndInfoColor); - ((PostDetailBaseViewHolder) holder).mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - ((PostDetailBaseViewHolder) holder).mFlairTextView.setVisibility(View.GONE); - ((PostDetailBaseViewHolder) holder).mSpoilerTextView.setVisibility(View.GONE); - ((PostDetailBaseViewHolder) holder).mNSFWTextView.setVisibility(View.GONE); - ((PostDetailBaseViewHolder) holder).mContentMarkdownView.setVisibility(View.GONE); - - if (holder instanceof PostDetailVideoAutoplayViewHolder) { - if (((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall != null && !((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall.isCanceled()) { - ((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall.cancel(); - ((PostDetailVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall = null; + ((PostDetailBaseViewHolder) holder).upvoteButton.setTextColor(mPostIconAndInfoColor); + ((PostDetailBaseViewHolder) holder).upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); + ((PostDetailBaseViewHolder) holder).upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); + ((PostDetailBaseViewHolder) holder).downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); + ((PostDetailBaseViewHolder) holder).downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); + ((PostDetailBaseViewHolder) holder).flairTextView.setVisibility(View.GONE); + ((PostDetailBaseViewHolder) holder).spoilerTextView.setVisibility(View.GONE); + ((PostDetailBaseViewHolder) holder).nsfwTextView.setVisibility(View.GONE); + ((PostDetailBaseViewHolder) holder).contentMarkdownView.setVisibility(View.GONE); + + if (holder instanceof PostDetailBaseVideoAutoplayViewHolder) { + if (((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall != null && !((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall.isCanceled()) { + ((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall.cancel(); + ((PostDetailBaseVideoAutoplayViewHolder) holder).fetchGfycatOrStreamableVideoCall = null; } - ((PostDetailVideoAutoplayViewHolder) holder).mErrorLoadingGfycatImageView.setVisibility(View.GONE); - ((PostDetailVideoAutoplayViewHolder) holder).muteButton.setVisibility(View.GONE); - if (!((PostDetailVideoAutoplayViewHolder) holder).isManuallyPaused) { - ((PostDetailVideoAutoplayViewHolder) holder).resetVolume(); + ((PostDetailBaseVideoAutoplayViewHolder) holder).mErrorLoadingGfycatImageView.setVisibility(View.GONE); + ((PostDetailBaseVideoAutoplayViewHolder) holder).muteButton.setVisibility(View.GONE); + if (!((PostDetailBaseVideoAutoplayViewHolder) holder).isManuallyPaused) { + ((PostDetailBaseVideoAutoplayViewHolder) holder).resetVolume(); } - mGlide.clear(((PostDetailVideoAutoplayViewHolder) holder).previewImageView); - ((PostDetailVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.GONE); + mGlide.clear(((PostDetailBaseVideoAutoplayViewHolder) holder).previewImageView); + ((PostDetailBaseVideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.GONE); } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) { - mGlide.clear(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); + mGlide.clear(((PostDetailVideoAndGifPreviewHolder) holder).binding.imageViewItemPostDetailVideoAndGifPreview); } else if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) { - mGlide.clear(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); + mGlide.clear(((PostDetailImageAndGifAutoplayViewHolder) holder).binding.imageViewItemPostDetailImageAndGifAutoplay); } else if (holder instanceof PostDetailLinkViewHolder) { - mGlide.clear(((PostDetailLinkViewHolder) holder).mImageView); + mGlide.clear(((PostDetailLinkViewHolder) holder).binding.imageViewItemPostDetailLink); } else if (holder instanceof PostDetailGalleryViewHolder) { - ((PostDetailGalleryViewHolder) holder).galleryFrameLayout.setVisibility(View.GONE); - ((PostDetailGalleryViewHolder) holder).mNoPreviewPostTypeImageView.setVisibility(View.GONE); + ((PostDetailGalleryViewHolder) holder).binding.galleryFrameLayoutItemPostDetailGallery.setVisibility(View.GONE); + ((PostDetailGalleryViewHolder) holder).binding.noPreviewPostTypeImageViewItemPostDetailGallery.setVisibility(View.GONE); } } } @@ -1043,84 +1055,82 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } public class PostDetailBaseViewHolder extends RecyclerView.ViewHolder { - AspectRatioGifImageView mIconGifImageView; - TextView mSubredditTextView; - TextView mUserTextView; - TextView mAuthorFlairTextView; - TextView mPostTimeTextView; - TextView mTitleTextView; - CustomTextView mTypeTextView; - ImageView mCrosspostImageView; - ImageView mArchivedImageView; - ImageView mLockedImageView; - CustomTextView mNSFWTextView; - CustomTextView mSpoilerTextView; - CustomTextView mFlairTextView; - TextView mAwardsTextView; - TextView mUpvoteRatioTextView; - RecyclerView mContentMarkdownView; - ConstraintLayout mBottomConstraintLayout; - ImageView mUpvoteButton; - TextView mScoreTextView; - ImageView mDownvoteButton; - TextView commentsCountTextView; - ImageView mSaveButton; - ImageView mShareButton; + AspectRatioGifImageView iconGifImageView; + TextView subredditTextView; + TextView userTextView; + TextView authorFlairTextView; + TextView postTimeTextView; + TextView titleTextView; + CustomTextView typeTextView; + ImageView crosspostImageView; + ImageView archivedImageView; + ImageView lockedImageView; + CustomTextView nsfwTextView; + CustomTextView spoilerTextView; + CustomTextView flairTextView; + TextView awardsTextView; + TextView upvoteRatioTextView; + RecyclerView contentMarkdownView; + ConstraintLayout bottomConstraintLayout; + MaterialButton upvoteButton; + MaterialButton downvoteButton; + MaterialButton commentsCountButton; + MaterialButton saveButton; + MaterialButton shareButton; PostDetailBaseViewHolder(@NonNull View itemView) { super(itemView); } - void setBaseView(AspectRatioGifImageView mIconGifImageView, - TextView mSubredditTextView, - TextView mUserTextView, - TextView mAuthorFlairTextView, - TextView mPostTimeTextView, - TextView mTitleTextView, - CustomTextView mTypeTextView, - ImageView mCrosspostImageView, - ImageView mArchivedImageView, - ImageView mLockedImageView, - CustomTextView mNSFWTextView, - CustomTextView mSpoilerTextView, - CustomTextView mFlairTextView, - TextView mAwardsTextView, - TextView mUpvoteRatioTextView, - RecyclerView mContentMarkdownView, - ConstraintLayout mBottomConstraintLayout, - ImageView mUpvoteButton, - TextView mScoreTextView, - ImageView mDownvoteButton, - TextView commentsCountTextView, - ImageView mSaveButton, - ImageView mShareButton) { - this.mIconGifImageView = mIconGifImageView; - this.mSubredditTextView = mSubredditTextView; - this.mUserTextView = mUserTextView; - this.mAuthorFlairTextView = mAuthorFlairTextView; - this.mPostTimeTextView = mPostTimeTextView; - this.mTitleTextView = mTitleTextView; - this.mTypeTextView = mTypeTextView; - this.mCrosspostImageView = mCrosspostImageView; - this.mArchivedImageView = mArchivedImageView; - this.mLockedImageView = mLockedImageView; - this.mNSFWTextView = mNSFWTextView; - this.mSpoilerTextView = mSpoilerTextView; - this.mFlairTextView = mFlairTextView; - this.mAwardsTextView = mAwardsTextView; - this.mUpvoteRatioTextView = mUpvoteRatioTextView; - this.mContentMarkdownView = mContentMarkdownView; - this.mBottomConstraintLayout = mBottomConstraintLayout; - this.mUpvoteButton = mUpvoteButton; - this.mScoreTextView = mScoreTextView; - this.mDownvoteButton = mDownvoteButton; - this.commentsCountTextView = commentsCountTextView; - this.mSaveButton = mSaveButton; - this.mShareButton = mShareButton; - - mIconGifImageView.setOnClickListener(view -> mSubredditTextView.performClick()); - - mSubredditTextView.setOnClickListener(view -> { + void setBaseView(AspectRatioGifImageView iconGifImageView, + TextView subredditTextView, + TextView userTextView, + TextView authorFlairTextView, + TextView postTimeTextView, + TextView titleTextView, + CustomTextView typeTextView, + ImageView crosspostImageView, + ImageView archivedImageView, + ImageView lockedImageView, + CustomTextView nSFWTextView, + CustomTextView spoilerTextView, + CustomTextView flairTextView, + TextView awardsTextView, + TextView upvoteRatioTextView, + RecyclerView contentMarkdownView, + ConstraintLayout bottomConstraintLayout, + MaterialButtonToggleGroup voteButtonToggleGroup, + MaterialButton upvoteButton, + MaterialButton downvoteButton, + MaterialButton commentsCountButton, + MaterialButton saveButton, + MaterialButton shareButton) { + this.iconGifImageView = iconGifImageView; + this.subredditTextView = subredditTextView; + this.userTextView = userTextView; + this.authorFlairTextView = authorFlairTextView; + this.postTimeTextView = postTimeTextView; + this.titleTextView = titleTextView; + this.typeTextView = typeTextView; + this.crosspostImageView = crosspostImageView; + this.archivedImageView = archivedImageView; + this.lockedImageView = lockedImageView; + this.nsfwTextView = nSFWTextView; + this.spoilerTextView = spoilerTextView; + this.flairTextView = flairTextView; + this.awardsTextView = awardsTextView; + this.upvoteRatioTextView = upvoteRatioTextView; + this.contentMarkdownView = contentMarkdownView; + this.bottomConstraintLayout = bottomConstraintLayout; + this.upvoteButton = upvoteButton; + this.downvoteButton = downvoteButton; + this.commentsCountButton = commentsCountButton; + this.saveButton = saveButton; + this.shareButton = shareButton; + + iconGifImageView.setOnClickListener(view -> subredditTextView.performClick()); + + subredditTextView.setOnClickListener(view -> { Intent intent; intent = new Intent(mActivity, ViewSubredditDetailActivity.class); intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, @@ -1128,7 +1138,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mActivity.startActivity(intent); }); - mUserTextView.setOnClickListener(view -> { + userTextView.setOnClickListener(view -> { if (mPost.isAuthorDeleted()) { return; } @@ -1137,16 +1147,16 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mActivity.startActivity(intent); }); - mAuthorFlairTextView.setOnClickListener(view -> mUserTextView.performClick()); + authorFlairTextView.setOnClickListener(view -> userTextView.performClick()); - mCrosspostImageView.setOnClickListener(view -> { + crosspostImageView.setOnClickListener(view -> { Intent crosspostIntent = new Intent(mActivity, ViewPostDetailActivity.class); crosspostIntent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, mPost.getCrosspostParentId()); mActivity.startActivity(crosspostIntent); }); if (!mHidePostType) { - mTypeTextView.setOnClickListener(view -> { + typeTextView.setOnClickListener(view -> { Intent intent = new Intent(mActivity, FilteredPostsActivity.class); intent.putExtra(FilteredPostsActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, PostPagingSource.TYPE_SUBREDDIT); @@ -1154,11 +1164,11 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mActivity.startActivity(intent); }); } else { - mTypeTextView.setVisibility(View.GONE); + typeTextView.setVisibility(View.GONE); } if (!mHidePostFlair) { - mFlairTextView.setOnClickListener(view -> { + flairTextView.setOnClickListener(view -> { Intent intent = new Intent(mActivity, FilteredPostsActivity.class); intent.putExtra(FilteredPostsActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, PostPagingSource.TYPE_SUBREDDIT); @@ -1166,10 +1176,10 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mActivity.startActivity(intent); }); } else { - mFlairTextView.setVisibility(View.GONE); + flairTextView.setVisibility(View.GONE); } - mNSFWTextView.setOnClickListener(view -> { + nSFWTextView.setOnClickListener(view -> { Intent intent = new Intent(mActivity, FilteredPostsActivity.class); intent.putExtra(FilteredPostsActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, PostPagingSource.TYPE_SUBREDDIT); @@ -1177,7 +1187,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mActivity.startActivity(intent); }); - mContentMarkdownView.setLayoutManager(new SwipeLockLinearLayoutManager(mActivity, new SwipeLockInterface() { + contentMarkdownView.setLayoutManager(new SwipeLockLinearLayoutManager(mActivity, new SwipeLockInterface() { @Override public void lockSwipe() { ((ViewPostDetailActivity) mActivity).lockSwipeRightToGoBack(); @@ -1189,7 +1199,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } })); - mUpvoteButton.setOnClickListener(view -> { + upvoteButton.setOnClickListener(view -> { if (mPost.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -1200,31 +1210,35 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler return; } - ColorFilter previousUpvoteButtonColorFilter = mUpvoteButton.getColorFilter(); - ColorFilter previousDownvoteButtonColorFilter = mDownvoteButton.getColorFilter(); - int previousScoreTextViewColor = mScoreTextView.getCurrentTextColor(); + int previousUpvoteButtonTextColor = upvoteButton.getCurrentTextColor(); + int previousDownvoteButtonTextColor = downvoteButton.getCurrentTextColor(); + Drawable previousUpvoteButtonDrawable = upvoteButton.getIcon(); + Drawable previousDownvoteButtonDrawable = downvoteButton.getIcon(); int previousVoteType = mPost.getVoteType(); String newVoteType; - mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); + downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); + downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); if (previousVoteType != 1) { //Not upvoted before mPost.setVoteType(1); newVoteType = APIUtils.DIR_UPVOTE; - mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mUpvotedColor); + upvoteButton.setTextColor(mUpvotedColor); + upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp); + upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor)); } else { //Upvoted before mPost.setVoteType(0); newVoteType = APIUtils.DIR_UNVOTE; - mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mPostIconAndInfoColor); + upvoteButton.setTextColor(mPostIconAndInfoColor); + upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); + upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); } if (!mHideTheNumberOfVotes) { - mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); } @@ -1235,17 +1249,20 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler public void onVoteThingSuccess() { if (newVoteType.equals(APIUtils.DIR_UPVOTE)) { mPost.setVoteType(1); - mUpvoteButton.setColorFilter(mUpvotedColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mUpvotedColor); + upvoteButton.setTextColor(mUpvotedColor); + upvoteButton.setIconResource(R.drawable.ic_upvote_filled_24dp); + upvoteButton.setIconTint(ColorStateList.valueOf(mUpvotedColor)); } else { mPost.setVoteType(0); - mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mPostIconAndInfoColor); + upvoteButton.setTextColor(mPostIconAndInfoColor); + upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); + upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); } - mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); + downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); + downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); if (!mHideTheNumberOfVotes) { - mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); } @@ -1257,19 +1274,21 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); mPost.setVoteType(previousVoteType); if (!mHideTheNumberOfVotes) { - mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + previousVoteType)); } - mUpvoteButton.setColorFilter(previousUpvoteButtonColorFilter); - mDownvoteButton.setColorFilter(previousDownvoteButtonColorFilter); - mScoreTextView.setTextColor(previousScoreTextViewColor); + upvoteButton.setTextColor(previousUpvoteButtonTextColor); + upvoteButton.setIcon(previousUpvoteButtonDrawable); + upvoteButton.setIconTint(ColorStateList.valueOf(previousUpvoteButtonTextColor)); + downvoteButton.setIcon(previousDownvoteButtonDrawable); + downvoteButton.setIconTint(ColorStateList.valueOf(previousDownvoteButtonTextColor)); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); } }, mPost.getFullName(), newVoteType); }); - mDownvoteButton.setOnClickListener(view -> { + downvoteButton.setOnClickListener(view -> { if (mPost.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -1280,31 +1299,34 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler return; } - ColorFilter previousUpvoteButtonColorFilter = mUpvoteButton.getColorFilter(); - ColorFilter previousDownvoteButtonColorFilter = mDownvoteButton.getColorFilter(); - int previousScoreTextViewColor = mScoreTextView.getCurrentTextColor(); + int previousUpvoteButtonTextColor = upvoteButton.getTextColors().getDefaultColor(); + int previousDownvoteButtonTextColor = downvoteButton.getTextColors().getDefaultColor(); + Drawable previousUpvoteButtonDrawable = upvoteButton.getIcon(); + Drawable previousDownvoteButtonDrawable = downvoteButton.getIcon(); int previousVoteType = mPost.getVoteType(); String newVoteType; - mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); + upvoteButton.setTextColor(mPostIconAndInfoColor); + upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); + upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); if (previousVoteType != -1) { - //Not upvoted before + //Not downvoted before mPost.setVoteType(-1); newVoteType = APIUtils.DIR_DOWNVOTE; - mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mDownvotedColor); + downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp); + downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor)); } else { - //Upvoted before + //Downvoted before mPost.setVoteType(0); newVoteType = APIUtils.DIR_UNVOTE; - mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mPostIconAndInfoColor); + downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); + downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); } if (!mHideTheNumberOfVotes) { - mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); } @@ -1315,17 +1337,19 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler public void onVoteThingSuccess() { if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) { mPost.setVoteType(-1); - mDownvoteButton.setColorFilter(mDownvotedColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mDownvotedColor); + downvoteButton.setIconResource(R.drawable.ic_downvote_filled_24dp); + downvoteButton.setIconTint(ColorStateList.valueOf(mDownvotedColor)); } else { mPost.setVoteType(0); - mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mPostIconAndInfoColor); + downvoteButton.setIconResource(R.drawable.ic_downvote_24dp); + downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); } - mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); + upvoteButton.setTextColor(mPostIconAndInfoColor); + upvoteButton.setIconResource(R.drawable.ic_upvote_24dp); + upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); if (!mHideTheNumberOfVotes) { - mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + mPost.getVoteType())); } @@ -1337,12 +1361,14 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); mPost.setVoteType(previousVoteType); if (!mHideTheNumberOfVotes) { - mScoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + upvoteButton.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, mPost.getScore() + previousVoteType)); } - mUpvoteButton.setColorFilter(previousUpvoteButtonColorFilter); - mDownvoteButton.setColorFilter(previousDownvoteButtonColorFilter); - mScoreTextView.setTextColor(previousScoreTextViewColor); + upvoteButton.setTextColor(previousUpvoteButtonTextColor); + upvoteButton.setIcon(previousUpvoteButtonDrawable); + upvoteButton.setIconTint(ColorStateList.valueOf(previousUpvoteButtonTextColor)); + downvoteButton.setIcon(previousDownvoteButtonDrawable); + downvoteButton.setIconTint(ColorStateList.valueOf(previousDownvoteButtonTextColor)); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); } @@ -1350,7 +1376,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler }); if (!mHideTheNumberOfComments) { - commentsCountTextView.setOnClickListener(view -> { + this.commentsCountButton.setOnClickListener(view -> { if (mPost.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_comment_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -1376,23 +1402,23 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mActivity.startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE); }); } else { - commentsCountTextView.setVisibility(View.GONE); + this.commentsCountButton.setVisibility(View.GONE); } - mSaveButton.setOnClickListener(view -> { + this.saveButton.setOnClickListener(view -> { if (mAccessToken == null) { Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); return; } if (mPost.isSaved()) { - mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + this.saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { mPost.setSaved(false); - mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + PostDetailBaseViewHolder.this.saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show(); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); } @@ -1400,19 +1426,19 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public void failed() { mPost.setSaved(true); - mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + PostDetailBaseViewHolder.this.saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show(); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); } }); } else { - mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + this.saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { mPost.setSaved(true); - mSaveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + PostDetailBaseViewHolder.this.saveButton.setIconResource(R.drawable.ic_bookmark_grey_24dp); Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show(); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); } @@ -1420,7 +1446,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public void failed() { mPost.setSaved(false); - mSaveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + PostDetailBaseViewHolder.this.saveButton.setIconResource(R.drawable.ic_bookmark_border_grey_24dp); Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show(); mPostDetailRecyclerViewAdapterCallback.updatePost(mPost); } @@ -1428,7 +1454,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } }); - mShareButton.setOnClickListener(view -> { + this.shareButton.setOnClickListener(view -> { Bundle bundle = new Bundle(); bundle.putString(ShareLinkBottomSheetFragment.EXTRA_POST_LINK, mPost.getPermalink()); if (mPost.getPostType() != Post.TEXT_TYPE) { @@ -1450,149 +1476,112 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler shareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), shareLinkBottomSheetFragment.getTag()); }); - mShareButton.setOnLongClickListener(view -> { + this.shareButton.setOnLongClickListener(view -> { mActivity.copyLink(mPost.getPermalink()); return true; }); if (mVoteButtonsOnTheRight) { ConstraintSet constraintSet = new ConstraintSet(); - constraintSet.clone(mBottomConstraintLayout); - constraintSet.clear(mUpvoteButton.getId(), ConstraintSet.START); - constraintSet.clear(mScoreTextView.getId(), ConstraintSet.START); - constraintSet.clear(mDownvoteButton.getId(), ConstraintSet.START); - constraintSet.clear(mSaveButton.getId(), ConstraintSet.END); - constraintSet.clear(mShareButton.getId(), ConstraintSet.END); - constraintSet.connect(mUpvoteButton.getId(), ConstraintSet.END, mScoreTextView.getId(), ConstraintSet.START); - constraintSet.connect(mScoreTextView.getId(), ConstraintSet.END, mDownvoteButton.getId(), ConstraintSet.START); - constraintSet.connect(mDownvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); - constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.START, mSaveButton.getId(), ConstraintSet.END); - constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.END, mUpvoteButton.getId(), ConstraintSet.START); - constraintSet.connect(mSaveButton.getId(), ConstraintSet.START, mShareButton.getId(), ConstraintSet.END); - constraintSet.connect(mShareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); - constraintSet.setHorizontalBias(commentsCountTextView.getId(), 0); - constraintSet.applyTo(mBottomConstraintLayout); + constraintSet.clone(bottomConstraintLayout); + constraintSet.clear(voteButtonToggleGroup.getId(), ConstraintSet.START); + constraintSet.clear(saveButton.getId(), ConstraintSet.END); + constraintSet.clear(shareButton.getId(), ConstraintSet.END); + constraintSet.connect(voteButtonToggleGroup.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); + constraintSet.connect(commentsCountButton.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END); + constraintSet.connect(commentsCountButton.getId(), ConstraintSet.END, upvoteButton.getId(), ConstraintSet.START); + constraintSet.connect(saveButton.getId(), ConstraintSet.START, shareButton.getId(), ConstraintSet.END); + constraintSet.connect(shareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); + constraintSet.setHorizontalBias(commentsCountButton.getId(), 0); + constraintSet.applyTo(bottomConstraintLayout); } if (mActivity.typeface != null) { - mSubredditTextView.setTypeface(mActivity.typeface); - mUserTextView.setTypeface(mActivity.typeface); - mAuthorFlairTextView.setTypeface(mActivity.typeface); - mPostTimeTextView.setTypeface(mActivity.typeface); - mTypeTextView.setTypeface(mActivity.typeface); - mSpoilerTextView.setTypeface(mActivity.typeface); - mNSFWTextView.setTypeface(mActivity.typeface); - mFlairTextView.setTypeface(mActivity.typeface); - mAwardsTextView.setTypeface(mActivity.typeface); - mUpvoteRatioTextView.setTypeface(mActivity.typeface); - mScoreTextView.setTypeface(mActivity.typeface); - commentsCountTextView.setTypeface(mActivity.typeface); + subredditTextView.setTypeface(mActivity.typeface); + userTextView.setTypeface(mActivity.typeface); + authorFlairTextView.setTypeface(mActivity.typeface); + postTimeTextView.setTypeface(mActivity.typeface); + typeTextView.setTypeface(mActivity.typeface); + spoilerTextView.setTypeface(mActivity.typeface); + nSFWTextView.setTypeface(mActivity.typeface); + flairTextView.setTypeface(mActivity.typeface); + awardsTextView.setTypeface(mActivity.typeface); + upvoteRatioTextView.setTypeface(mActivity.typeface); + upvoteButton.setTypeface(mActivity.typeface); + commentsCountButton.setTypeface(mActivity.typeface); } if (mActivity.titleTypeface != null) { - mTitleTextView.setTypeface(mActivity.typeface); + titleTextView.setTypeface(mActivity.typeface); } itemView.setBackgroundColor(mCardViewColor); - mSubredditTextView.setTextColor(mSubredditColor); - mUserTextView.setTextColor(mUsernameColor); - mAuthorFlairTextView.setTextColor(mAuthorFlairTextColor); - mPostTimeTextView.setTextColor(mSecondaryTextColor); - mTitleTextView.setTextColor(mPostTitleColor); - mTypeTextView.setBackgroundColor(mPostTypeBackgroundColor); - mTypeTextView.setBorderColor(mPostTypeBackgroundColor); - mTypeTextView.setTextColor(mPostTypeTextColor); - mSpoilerTextView.setBackgroundColor(mSpoilerBackgroundColor); - mSpoilerTextView.setBorderColor(mSpoilerBackgroundColor); - mSpoilerTextView.setTextColor(mSpoilerTextColor); - mNSFWTextView.setBackgroundColor(mNSFWBackgroundColor); - mNSFWTextView.setBorderColor(mNSFWBackgroundColor); - mNSFWTextView.setTextColor(mNSFWTextColor); - mFlairTextView.setBackgroundColor(mFlairBackgroundColor); - mFlairTextView.setBorderColor(mFlairBackgroundColor); - mFlairTextView.setTextColor(mFlairTextColor); - mArchivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); - mLockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); - mCrosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); - mAwardsTextView.setTextColor(mSecondaryTextColor); + subredditTextView.setTextColor(mSubredditColor); + userTextView.setTextColor(mUsernameColor); + authorFlairTextView.setTextColor(mAuthorFlairTextColor); + postTimeTextView.setTextColor(mSecondaryTextColor); + titleTextView.setTextColor(mPostTitleColor); + typeTextView.setBackgroundColor(mPostTypeBackgroundColor); + typeTextView.setBorderColor(mPostTypeBackgroundColor); + typeTextView.setTextColor(mPostTypeTextColor); + spoilerTextView.setBackgroundColor(mSpoilerBackgroundColor); + spoilerTextView.setBorderColor(mSpoilerBackgroundColor); + spoilerTextView.setTextColor(mSpoilerTextColor); + nSFWTextView.setBackgroundColor(mNSFWBackgroundColor); + nSFWTextView.setBorderColor(mNSFWBackgroundColor); + nSFWTextView.setTextColor(mNSFWTextColor); + flairTextView.setBackgroundColor(mFlairBackgroundColor); + flairTextView.setBorderColor(mFlairBackgroundColor); + flairTextView.setTextColor(mFlairTextColor); + archivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); + lockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); + crosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); + awardsTextView.setTextColor(mSecondaryTextColor); Drawable upvoteRatioDrawable = Utils.getTintedDrawable(mActivity, R.drawable.ic_upvote_ratio, mUpvoteRatioTintColor); - mUpvoteRatioTextView.setCompoundDrawablesWithIntrinsicBounds( + upvoteRatioTextView.setCompoundDrawablesWithIntrinsicBounds( upvoteRatioDrawable, null, null, null); - mUpvoteRatioTextView.setTextColor(mSecondaryTextColor); - mUpvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - mScoreTextView.setTextColor(mPostIconAndInfoColor); - mDownvoteButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - commentsCountTextView.setTextColor(mPostIconAndInfoColor); - commentsCountTextView.setCompoundDrawablesWithIntrinsicBounds(mCommentIcon, null, null, null); - mSaveButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); - mShareButton.setColorFilter(mPostIconAndInfoColor, PorterDuff.Mode.SRC_IN); + upvoteRatioTextView.setTextColor(mSecondaryTextColor); + upvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); + upvoteButton.setTextColor(mPostIconAndInfoColor); + downvoteButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); + commentsCountButton.setTextColor(mPostIconAndInfoColor); + commentsCountButton.setIcon(mCommentIcon); + saveButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); + shareButton.setIconTint(ColorStateList.valueOf(mPostIconAndInfoColor)); } } - class PostDetailVideoAutoplayViewHolder extends PostDetailBaseViewHolder implements ToroPlayer { + class PostDetailBaseVideoAutoplayViewHolder extends PostDetailBaseViewHolder implements ToroPlayer { public Call<String> fetchGfycatOrStreamableVideoCall; - @BindView(R.id.icon_gif_image_view_item_post_detail_video_autoplay) AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_video_autoplay) TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_video_autoplay) TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_video_autoplay) TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_video_autoplay) TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_video_autoplay) TextView mTitleTextView; - @BindView(R.id.type_text_view_item_post_detail_video_autoplay) CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_video_autoplay) ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_video_autoplay) ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_video_autoplay) ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_video_autoplay) CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_video_autoplay) CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_video_autoplay) CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_video_autoplay) TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_video_autoplay) TextView mUpvoteRatioTextView; - @BindView(R.id.aspect_ratio_frame_layout_item_post_detail_video_autoplay) AspectRatioFrameLayout aspectRatioFrameLayout; - @BindView(R.id.player_view_item_post_detail_video_autoplay) PlayerView playerView; - @BindView(R.id.preview_image_view_item_post_detail_video_autoplay) GifImageView previewImageView; - @BindView(R.id.error_loading_gfycat_image_view_item_post_detail_video_autoplay) ImageView mErrorLoadingGfycatImageView; - @BindView(R.id.mute_exo_playback_control_view) ImageView muteButton; - @BindView(R.id.fullscreen_exo_playback_control_view) ImageView fullscreenButton; - @BindView(R.id.exo_pause) ImageView pauseButton; - @BindView(R.id.exo_play) ImageView playButton; - @BindView(R.id.exo_progress) DefaultTimeBar progressBar; - @BindView(R.id.content_markdown_view_item_post_detail_video_autoplay) RecyclerView mContentMarkdownView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_video_autoplay) ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_video_autoplay) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_video_autoplay) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_video_autoplay) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_video_autoplay) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_video_autoplay) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_video_autoplay) - ImageView mShareButton; + MaterialButton mUpvoteButton; + MaterialButton mDownvoteButton; + MaterialButton commentsCountButton; + MaterialButton mSaveButton; + MaterialButton mShareButton; @Nullable Container container; @Nullable @@ -1601,32 +1590,73 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler private float volume; private boolean isManuallyPaused; - public PostDetailVideoAutoplayViewHolder(@NonNull View itemView) { + public PostDetailBaseVideoAutoplayViewHolder(@NonNull View itemView, + AspectRatioGifImageView iconGifImageView, + TextView subredditTextView, + TextView userTextView, + TextView authorFlairTextView, + TextView postTimeTextView, + TextView titleTextView, + CustomTextView typeTextView, + ImageView crosspostImageView, + ImageView archivedImageView, + ImageView lockedImageView, + CustomTextView nsfwTextView, + CustomTextView spoilerTextView, + CustomTextView flairTextView, + TextView awardsTextView, + TextView upvoteRatioTextView, + AspectRatioFrameLayout aspectRatioFrameLayout, + PlayerView playerView, + GifImageView previewImageView, + ImageView errorLoadingGfycatImageView, + ImageView muteButton, + ImageView fullscreenButton, + ImageView pauseButton, + ImageView playButton, + DefaultTimeBar progressBar, + RecyclerView contentMarkdownView, + ConstraintLayout bottomConstraintLayout, + MaterialButtonToggleGroup voteButtonToggleGroup, + MaterialButton upvoteButton, + MaterialButton downvoteButton, + MaterialButton commentsCountButton, + MaterialButton saveButton, + MaterialButton shareButton) { super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); + setBaseView(iconGifImageView, + subredditTextView, + userTextView, + authorFlairTextView, + postTimeTextView, + titleTextView, + typeTextView, + crosspostImageView, + archivedImageView, + lockedImageView, + nsfwTextView, + spoilerTextView, + flairTextView, + awardsTextView, + upvoteRatioTextView, + contentMarkdownView, + bottomConstraintLayout, + voteButtonToggleGroup, + upvoteButton, + downvoteButton, + commentsCountButton, + saveButton, + shareButton); + + this.aspectRatioFrameLayout = aspectRatioFrameLayout; + this.previewImageView = previewImageView; + this.mErrorLoadingGfycatImageView = errorLoadingGfycatImageView; + this.playerView = playerView; + this.muteButton = muteButton; + this.fullscreenButton = fullscreenButton; + this.pauseButton = pauseButton; + this.playButton = playButton; + this.progressBar = progressBar; aspectRatioFrameLayout.setOnClickListener(null); @@ -1835,97 +1865,118 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } } + class PostDetailVideoAutoplayViewHolder extends PostDetailBaseVideoAutoplayViewHolder { + PostDetailVideoAutoplayViewHolder(@NonNull ItemPostDetailVideoAutoplayBinding binding) { + super(binding.getRoot(), + binding.iconGifImageViewItemPostDetailVideoAutoplay, + binding.subredditTextViewItemPostDetailVideoAutoplay, + binding.userTextViewItemPostDetailVideoAutoplay, + binding.authorFlairTextViewItemPostDetailVideoAutoplay, + binding.postTimeTextViewItemPostDetailVideoAutoplay, + binding.titleTextViewItemPostDetailVideoAutoplay, + binding.typeTextViewItemPostDetailVideoAutoplay, + binding.crosspostImageViewItemPostDetailVideoAutoplay, + binding.archivedImageViewItemPostDetailVideoAutoplay, + binding.lockedImageViewItemPostDetailVideoAutoplay, + binding.nsfwTextViewItemPostDetailVideoAutoplay, + binding.spoilerCustomTextViewItemPostDetailVideoAutoplay, + binding.flairCustomTextViewItemPostDetailVideoAutoplay, + binding.awardsTextViewItemPostDetailVideoAutoplay, + binding.upvoteRatioTextViewItemPostDetailVideoAutoplay, + binding.aspectRatioFrameLayoutItemPostDetailVideoAutoplay, + binding.playerViewItemPostDetailVideoAutoplay, + binding.previewImageViewItemPostDetailVideoAutoplay, + binding.errorLoadingGfycatImageViewItemPostDetailVideoAutoplay, + binding.getRoot().findViewById(R.id.mute_exo_playback_control_view), + binding.getRoot().findViewById(R.id.fullscreen_exo_playback_control_view), + binding.getRoot().findViewById(R.id.exo_pause), + binding.getRoot().findViewById(R.id.exo_play), + binding.getRoot().findViewById(R.id.exo_progress), + binding.contentMarkdownViewItemPostDetailVideoAutoplay, + binding.bottomConstraintLayoutItemPostDetailVideoAutoplay, + binding.voteButtonToggleItemPostDetailVideoAutoplay, + binding.upvoteButtonItemPostDetailVideoAutoplay, + binding.downvoteButtonItemPostDetailVideoAutoplay, + binding.commentsCountButtonItemPostDetailVideoAutoplay, + binding.saveButtonItemPostDetailVideoAutoplay, + binding.shareButtonItemPostDetailVideoAutoplay); + } + } + + class PostDetailVideoAutoplayLegacyControllerViewHolder extends PostDetailBaseVideoAutoplayViewHolder { + PostDetailVideoAutoplayLegacyControllerViewHolder(ItemPostDetailVideoAutoplayLegacyControllerBinding binding) { + super(binding.getRoot(), + binding.iconGifImageViewItemPostDetailVideoAutoplay, + binding.subredditTextViewItemPostDetailVideoAutoplay, + binding.userTextViewItemPostDetailVideoAutoplay, + binding.authorFlairTextViewItemPostDetailVideoAutoplay, + binding.postTimeTextViewItemPostDetailVideoAutoplay, + binding.titleTextViewItemPostDetailVideoAutoplay, + binding.typeTextViewItemPostDetailVideoAutoplay, + binding.crosspostImageViewItemPostDetailVideoAutoplay, + binding.archivedImageViewItemPostDetailVideoAutoplay, + binding.lockedImageViewItemPostDetailVideoAutoplay, + binding.nsfwTextViewItemPostDetailVideoAutoplay, + binding.spoilerCustomTextViewItemPostDetailVideoAutoplay, + binding.flairCustomTextViewItemPostDetailVideoAutoplay, + binding.awardsTextViewItemPostDetailVideoAutoplay, + binding.upvoteRatioTextViewItemPostDetailVideoAutoplay, + binding.aspectRatioFrameLayoutItemPostDetailVideoAutoplay, + binding.playerViewItemPostDetailVideoAutoplay, + binding.previewImageViewItemPostDetailVideoAutoplay, + binding.errorLoadingGfycatImageViewItemPostDetailVideoAutoplay, + binding.getRoot().findViewById(R.id.mute_exo_playback_control_view), + binding.getRoot().findViewById(R.id.fullscreen_exo_playback_control_view), + binding.getRoot().findViewById(R.id.exo_pause), + binding.getRoot().findViewById(R.id.exo_play), + binding.getRoot().findViewById(R.id.exo_progress), + binding.contentMarkdownViewItemPostDetailVideoAutoplay, + binding.bottomConstraintLayoutItemPostDetailVideoAutoplay, + binding.voteButtonToggleItemPostDetailVideoAutoplay, + binding.upvoteButtonItemPostDetailVideoAutoplay, + binding.downvoteButtonItemPostDetailVideoAutoplay, + binding.commentsCountButtonItemPostDetailVideoAutoplay, + binding.saveButtonItemPostDetailVideoAutoplay, + binding.shareButtonItemPostDetailVideoAutoplay); + } + } + class PostDetailVideoAndGifPreviewHolder extends PostDetailBaseViewHolder { - @BindView(R.id.icon_gif_image_view_item_post_detail_video_and_gif_preview) - AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_video_and_gif_preview) - TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_video_and_gif_preview) - TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_video_and_gif_preview) - TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_video_and_gif_preview) - TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_video_and_gif_preview) - TextView mTitleTextView; - @BindView(R.id.type_text_view_item_post_detail_video_and_gif_preview) - CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_video_and_gif_preview) - ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_video_and_gif_preview) - ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_video_and_gif_preview) - ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_video_and_gif_preview) - CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_video_and_gif_preview) - CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_video_and_gif_preview) - CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_video_and_gif_preview) - TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_video_and_gif_preview) - TextView mUpvoteRatioTextView; - @BindView(R.id.load_wrapper_item_post_detail_video_and_gif_preview) - RelativeLayout mLoadWrapper; - @BindView(R.id.progress_bar_item_post_detail_video_and_gif_preview) - ProgressBar mLoadImageProgressBar; - @BindView(R.id.load_image_error_text_view_item_post_detail_video_and_gif_preview) - TextView mLoadImageErrorTextView; - @BindView(R.id.video_or_gif_indicator_image_view_item_post_detail) - ImageView videoOrGifIndicatorImageView; - @BindView(R.id.image_view_item_post_detail_video_and_gif_preview) - AspectRatioGifImageView mImageView; - @BindView(R.id.content_markdown_view_item_post_detail_video_and_gif_preview) - RecyclerView mContentMarkdownView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_video_and_gif_preview) - ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_video_and_gif_preview) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_video_and_gif_preview) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_video_and_gif_preview) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_video_and_gif_preview) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_video_and_gif_preview) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_video_and_gif_preview) - ImageView mShareButton; - - PostDetailVideoAndGifPreviewHolder(@NonNull View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); - - videoOrGifIndicatorImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN); - videoOrGifIndicatorImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor)); - mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); - mLoadImageErrorTextView.setTextColor(mPrimaryTextColor); - - mImageView.setOnClickListener(view -> { + ItemPostDetailVideoAndGifPreviewBinding binding; + + PostDetailVideoAndGifPreviewHolder(@NonNull ItemPostDetailVideoAndGifPreviewBinding binding) { + super(binding.getRoot()); + this.binding = binding; + setBaseView(binding.iconGifImageViewItemPostDetailVideoAndGifPreview, + binding.subredditTextViewItemPostDetailVideoAndGifPreview, + binding.userTextViewItemPostDetailVideoAndGifPreview, + binding.authorFlairTextViewItemPostDetailVideoAndGifPreview, + binding.postTimeTextViewItemPostDetailVideoAndGifPreview, + binding.titleTextViewItemPostDetailVideoAndGifPreview, + binding.typeTextViewItemPostDetailVideoAndGifPreview, + binding.crosspostImageViewItemPostDetailVideoAndGifPreview, + binding.archivedImageViewItemPostDetailVideoAndGifPreview, + binding.lockedImageViewItemPostDetailVideoAndGifPreview, + binding.nsfwTextViewItemPostDetailVideoAndGifPreview, + binding.spoilerCustomTextViewItemPostDetailVideoAndGifPreview, + binding.flairCustomTextViewItemPostDetailVideoAndGifPreview, + binding.awardsTextViewItemPostDetailVideoAndGifPreview, + binding.upvoteRatioTextViewItemPostDetailVideoAndGifPreview, + binding.contentMarkdownViewItemPostDetailVideoAndGifPreview, + binding.bottomConstraintLayoutItemPostDetailVideoAndGifPreview, + binding.voteButtonToggleItemPostDetailVideoAndGifPreview, + binding.upvoteButtonItemPostDetailVideoAndGifPreview, + binding.downvoteButtonItemPostDetailVideoAndGifPreview, + binding.commentsCountButtonItemPostDetailVideoAndGifPreview, + binding.saveButtonItemPostDetailVideoAndGifPreview, + binding.shareButtonItemPostDetailVideoAndGifPreview); + + binding.videoOrGifIndicatorImageViewItemPostDetail.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN); + binding.videoOrGifIndicatorImageViewItemPostDetail.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor)); + binding.progressBarItemPostDetailVideoAndGifPreview.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); + binding.loadImageErrorTextViewItemPostDetailVideoAndGifPreview.setTextColor(mPrimaryTextColor); + + binding.imageViewItemPostDetailVideoAndGifPreview.setOnClickListener(view -> { if (canStartActivity) { canStartActivity = false; if (mPost.getPostType() == Post.VIDEO_TYPE) { @@ -1966,94 +2017,39 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } class PostDetailImageAndGifAutoplayViewHolder extends PostDetailBaseViewHolder { - @BindView(R.id.icon_gif_image_view_item_post_detail_image_and_gif_autoplay) - AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_image_and_gif_autoplay) - TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_image_and_gif_autoplay) - TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_image_and_gif_autoplay) - TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_image_and_gif_autoplay) - TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_image_and_gif_autoplay) - TextView mTitleTextView; - @BindView(R.id.type_text_view_item_post_detail_image_and_gif_autoplay) - CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_image_and_gif_autoplay) - ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_image_and_gif_autoplay) - ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_image_and_gif_autoplay) - ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_image_and_gif_autoplay) - CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_image_and_gif_autoplay) - CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_image_and_gif_autoplay) - CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_image_and_gif_autoplay) - TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_image_and_gif_autoplay) - TextView mUpvoteRatioTextView; - @BindView(R.id.image_view_wrapper_item_post_detail_image_and_gif_autoplay) - RelativeLayout mRelativeLayout; - @BindView(R.id.load_wrapper_item_post_detail_image_and_gif_autoplay) - RelativeLayout mLoadWrapper; - @BindView(R.id.progress_bar_item_post_detail_image_and_gif_autoplay) - ProgressBar mLoadImageProgressBar; - @BindView(R.id.load_image_error_text_view_item_post_detail_image_and_gif_autoplay) - TextView mLoadImageErrorTextView; - @BindView(R.id.image_view_item_post_detail_image_and_gif_autoplay) - AspectRatioGifImageView mImageView; - @BindView(R.id.content_markdown_view_item_post_detail_image_and_gif_autoplay) - RecyclerView mContentMarkdownView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_image_and_gif_autoplay) - ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_image_and_gif_autoplay) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_image_and_gif_autoplay) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_image_and_gif_autoplay) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_image_and_gif_autoplay) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_image_and_gif_autoplay) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_image_and_gif_autoplay) - ImageView mShareButton; - - PostDetailImageAndGifAutoplayViewHolder(@NonNull View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); - - mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); - mLoadImageErrorTextView.setTextColor(mPrimaryTextColor); - - mImageView.setOnClickListener(view -> { + ItemPostDetailImageAndGifAutoplayBinding binding; + + PostDetailImageAndGifAutoplayViewHolder(@NonNull ItemPostDetailImageAndGifAutoplayBinding binding) { + super(binding.getRoot()); + this.binding = binding; + setBaseView(binding.iconGifImageViewItemPostDetailImageAndGifAutoplay, + binding.subredditTextViewItemPostDetailImageAndGifAutoplay, + binding.userTextViewItemPostDetailImageAndGifAutoplay, + binding.authorFlairTextViewItemPostDetailImageAndGifAutoplay, + binding.postTimeTextViewItemPostDetailImageAndGifAutoplay, + binding.titleTextViewItemPostDetailImageAndGifAutoplay, + binding.typeTextViewItemPostDetailImageAndGifAutoplay, + binding.crosspostImageViewItemPostDetailImageAndGifAutoplay, + binding.archivedImageViewItemPostDetailImageAndGifAutoplay, + binding.lockedImageViewItemPostDetailImageAndGifAutoplay, + binding.nsfwTextViewItemPostDetailImageAndGifAutoplay, + binding.spoilerCustomTextViewItemPostDetailImageAndGifAutoplay, + binding.flairCustomTextViewItemPostDetailImageAndGifAutoplay, + binding.awardsTextViewItemPostDetailImageAndGifAutoplay, + binding.upvoteRatioTextViewItemPostDetailImageAndGifAutoplay, + binding.contentMarkdownViewItemPostDetailImageAndGifAutoplay, + binding.bottomConstraintLayoutItemPostDetailImageAndGifAutoplay, + binding.voteButtonToggleItemPostDetailImageAndGifAutoplay, + binding.upvoteButtonItemPostDetailImageAndGifAutoplay, + binding.downvoteButtonItemPostDetailImageAndGifAutoplay, + binding.commentsCountButtonItemPostDetailImageAndGifAutoplay, + binding.saveButtonItemPostDetailImageAndGifAutoplay, + binding.shareButtonItemPostDetailImageAndGifAutoplay); + + binding.progressBarItemPostDetailImageAndGifAutoplay.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); + binding.loadImageErrorTextViewItemPostDetailImageAndGifAutoplay.setTextColor(mPrimaryTextColor); + + binding.imageViewItemPostDetailImageAndGifAutoplay.setOnClickListener(view -> { if (canStartActivity) { canStartActivity = false; if (mPost.getPostType() == Post.IMAGE_TYPE) { @@ -2079,100 +2075,43 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } class PostDetailLinkViewHolder extends PostDetailBaseViewHolder { - @BindView(R.id.icon_gif_image_view_item_post_detail_link) - AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_link) - TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_link) - TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_link) - TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_link) - TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_link) - TextView mTitleTextView; - @BindView(R.id.type_text_view_item_post_detail_link) - CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_link) - ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_link) - ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_link) - ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_link) - CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_link) - CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_link) - CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_link) - TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_link) - TextView mUpvoteRatioTextView; - @BindView(R.id.link_text_view_item_post_detail_link) - TextView mLinkTextView; - @BindView(R.id.image_view_wrapper_item_post_detail_link) - RelativeLayout mRelativeLayout; - @BindView(R.id.load_wrapper_item_post_detail_link) - RelativeLayout mLoadWrapper; - @BindView(R.id.progress_bar_item_post_detail_link) - ProgressBar mLoadImageProgressBar; - @BindView(R.id.load_image_error_text_view_item_post_detail_link) - TextView mLoadImageErrorTextView; - @BindView(R.id.image_view_item_post_detail_link) - AspectRatioGifImageView mImageView; - @BindView(R.id.content_markdown_view_item_post_detail_link) - RecyclerView mContentMarkdownView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_link) - ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_link) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_link) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_link) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_link) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_link) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_link) - ImageView mShareButton; - - PostDetailLinkViewHolder(@NonNull View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); + ItemPostDetailLinkBinding binding; + + PostDetailLinkViewHolder(@NonNull ItemPostDetailLinkBinding binding) { + super(binding.getRoot()); + this.binding = binding; + setBaseView(binding.iconGifImageViewItemPostDetailLink, + binding.subredditTextViewItemPostDetailLink, + binding.userTextViewItemPostDetailLink, + binding.authorFlairTextViewItemPostDetailLink, + binding.postTimeTextViewItemPostDetailLink, + binding.titleTextViewItemPostDetailLink, + binding.typeTextViewItemPostDetailLink, + binding.crosspostImageViewItemPostDetailLink, + binding.archivedImageViewItemPostDetailLink, + binding.lockedImageViewItemPostDetailLink, + binding.nsfwTextViewItemPostDetailLink, + binding.spoilerCustomTextViewItemPostDetailLink, + binding.flairCustomTextViewItemPostDetailLink, + binding.awardsTextViewItemPostDetailLink, + binding.upvoteRatioTextViewItemPostDetailLink, + binding.contentMarkdownViewItemPostDetailLink, + binding.bottomConstraintLayoutItemPostDetailLink, + binding.voteButtonToggleItemPostDetailLink, + binding.upvoteButtonItemPostDetailLink, + binding.downvoteButtonItemPostDetailLink, + binding.commentsCountButtonItemPostDetailLink, + binding.saveButtonItemPostDetailLink, + binding.shareButtonItemPostDetailLink); if (mActivity.typeface != null) { - mLinkTextView.setTypeface(mActivity.typeface); + binding.linkTextViewItemPostDetailLink.setTypeface(mActivity.typeface); } - mLinkTextView.setTextColor(mSecondaryTextColor); - mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); - mLoadImageErrorTextView.setTextColor(mPrimaryTextColor); + binding.linkTextViewItemPostDetailLink.setTextColor(mSecondaryTextColor); + binding.progressBarItemPostDetailLink.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); + binding.loadImageErrorTextViewItemPostDetailLink.setTextColor(mPrimaryTextColor); - mImageView.setOnClickListener(view -> { + binding.imageViewItemPostDetailLink.setOnClickListener(view -> { Intent intent = new Intent(mActivity, LinkResolverActivity.class); Uri uri = Uri.parse(mPost.getUrl()); intent.setData(uri); @@ -2183,92 +2122,43 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } class PostDetailNoPreviewViewHolder extends PostDetailBaseViewHolder { - @BindView(R.id.icon_gif_image_view_item_post_detail_no_preview_link) - AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_no_preview_link) - TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_no_preview_link) - TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_no_preview_link) - TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_no_preview_link) - TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_no_preview_link) - TextView mTitleTextView; - @BindView(R.id.content_markdown_view_item_post_detail_no_preview_link) - RecyclerView mContentMarkdownView; - @BindView(R.id.type_text_view_item_post_detail_no_preview_link) - CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_no_preview_link) - ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_no_preview_link) - ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_no_preview_link) - ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_no_preview_link) - CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_no_preview_link) - CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_no_preview_link) - CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_no_preview_link) - TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_no_preview_link) - TextView mUpvoteRatioTextView; - @BindView(R.id.link_text_view_item_post_detail_no_preview_link) - TextView mLinkTextView; - @BindView(R.id.image_view_no_preview_post_type_item_post_detail_no_preview_link) - ImageView mNoPreviewPostTypeImageView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_no_preview_link) - ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_no_preview_link) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_no_preview_link) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_no_preview_link) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_no_preview_link) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_no_preview_link) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_no_preview_link) - ImageView mShareButton; - - PostDetailNoPreviewViewHolder(@NonNull View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); + ItemPostDetailNoPreviewBinding binding; + + PostDetailNoPreviewViewHolder(@NonNull ItemPostDetailNoPreviewBinding binding) { + super(binding.getRoot()); + this.binding = binding; + setBaseView(binding.iconGifImageViewItemPostDetailNoPreview, + binding.subredditTextViewItemPostDetailNoPreview, + binding.userTextViewItemPostDetailNoPreview, + binding.authorFlairTextViewItemPostDetailNoPreview, + binding.postTimeTextViewItemPostDetailNoPreview, + binding.titleTextViewItemPostDetailNoPreview, + binding.typeTextViewItemPostDetailNoPreview, + binding.crosspostImageViewItemPostDetailNoPreview, + binding.archivedImageViewItemPostDetailNoPreview, + binding.lockedImageViewItemPostDetailNoPreview, + binding.nsfwTextViewItemPostDetailNoPreview, + binding.spoilerCustomTextViewItemPostDetailNoPreview, + binding.flairCustomTextViewItemPostDetailNoPreview, + binding.awardsTextViewItemPostDetailNoPreview, + binding.upvoteRatioTextViewItemPostDetailNoPreview, + binding.contentMarkdownViewItemPostDetailNoPreview, + binding.bottomConstraintLayoutItemPostDetailNoPreview, + binding.voteButtonToggleItemPostDetailNoPreview, + binding.upvoteButtonItemPostDetailNoPreview, + binding.downvoteButtonItemPostDetailNoPreview, + binding.commentsCountButtonItemPostDetailNoPreview, + binding.saveButtonItemPostDetailNoPreview, + binding.shareButtonItemPostDetailNoPreview); if (mActivity.typeface != null) { - mLinkTextView.setTypeface(mActivity.typeface); + binding.linkTextViewItemPostDetailNoPreview.setTypeface(mActivity.typeface); } - mLinkTextView.setTextColor(mSecondaryTextColor); - mNoPreviewPostTypeImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor); - mNoPreviewPostTypeImageView.setColorFilter(mNoPreviewPostTypeIconTint, PorterDuff.Mode.SRC_IN); + binding.linkTextViewItemPostDetailNoPreview.setTextColor(mSecondaryTextColor); + binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setBackgroundColor(mNoPreviewPostTypeBackgroundColor); + binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setColorFilter(mNoPreviewPostTypeIconTint, PorterDuff.Mode.SRC_IN); - mNoPreviewPostTypeImageView.setOnClickListener(view -> { + binding.imageViewNoPreviewPostTypeItemPostDetailNoPreview.setOnClickListener(view -> { if (mPost != null) { if (mPost.getPostType() == Post.VIDEO_TYPE) { Intent intent = new Intent(mActivity, ViewVideoActivity.class); @@ -2324,105 +2214,52 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } class PostDetailGalleryViewHolder extends PostDetailBaseViewHolder { - @BindView(R.id.icon_gif_image_view_item_post_detail_gallery) - AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_gallery) - TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_gallery) - TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_gallery) - TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_gallery) - TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_gallery) - TextView mTitleTextView; - @BindView(R.id.type_text_view_item_post_detail_gallery) - CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_gallery) - ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_gallery) - ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_gallery) - ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_gallery) - CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_gallery) - CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_gallery) - CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_gallery) - TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_gallery) - TextView mUpvoteRatioTextView; - @BindView(R.id.gallery_frame_layout_item_post_detail_gallery) - FrameLayout galleryFrameLayout; - @BindView(R.id.gallery_recycler_view_item_post_detail_gallery) - RecyclerView galleryRecyclerView; - @BindView(R.id.image_index_text_view_item_post_detail_gallery) - CustomTextView imageIndexTextView; - @BindView(R.id.image_view_no_preview_link_item_post_detail_gallery) - ImageView mNoPreviewPostTypeImageView; - @BindView(R.id.content_markdown_view_item_post_detail_gallery) - RecyclerView mContentMarkdownView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_gallery) - ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_gallery) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_gallery) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_gallery) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_gallery) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_gallery) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_gallery) - ImageView mShareButton; + ItemPostDetailGalleryBinding binding; PostGalleryTypeImageRecyclerViewAdapter adapter; - PostDetailGalleryViewHolder(@NonNull View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); + PostDetailGalleryViewHolder(@NonNull ItemPostDetailGalleryBinding binding) { + super(binding.getRoot()); + this.binding = binding; + setBaseView(binding.iconGifImageViewItemPostDetailGallery, + binding.subredditTextViewItemPostDetailGallery, + binding.userTextViewItemPostDetailGallery, + binding.authorFlairTextViewItemPostDetailGallery, + binding.postTimeTextViewItemPostDetailGallery, + binding.titleTextViewItemPostDetailGallery, + binding.typeTextViewItemPostDetailGallery, + binding.crosspostImageViewItemPostDetailGallery, + binding.archivedImageViewItemPostDetailGallery, + binding.lockedImageViewItemPostDetailGallery, + binding.nsfwTextViewItemPostDetailGallery, + binding.spoilerCustomTextViewItemPostDetailGallery, + binding.flairCustomTextViewItemPostDetailGallery, + binding.awardsTextViewItemPostDetailGallery, + binding.upvoteRatioTextViewItemPostDetailGallery, + binding.contentMarkdownViewItemPostDetailGallery, + binding.bottomConstraintLayoutItemPostDetailGallery, + binding.voteButtonToggleItemPostDetailGallery, + binding.upvoteButtonItemPostDetailGallery, + binding.downvoteButtonItemPostDetailGallery, + binding.commentsCountButtonItemPostDetailGallery, + binding.saveButtonItemPostDetailGallery, + binding.shareButtonItemPostDetailGallery); if (mActivity.typeface != null) { - imageIndexTextView.setTypeface(mActivity.typeface); + binding.imageIndexTextViewItemPostDetailGallery.setTypeface(mActivity.typeface); } - imageIndexTextView.setTextColor(mMediaIndicatorIconTint); - imageIndexTextView.setBackgroundColor(mMediaIndicatorBackgroundColor); - imageIndexTextView.setBorderColor(mMediaIndicatorBackgroundColor); - mNoPreviewPostTypeImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor); - mNoPreviewPostTypeImageView.setColorFilter(mNoPreviewPostTypeIconTint, PorterDuff.Mode.SRC_IN); + binding.imageIndexTextViewItemPostDetailGallery.setTextColor(mMediaIndicatorIconTint); + binding.imageIndexTextViewItemPostDetailGallery.setBackgroundColor(mMediaIndicatorBackgroundColor); + binding.imageIndexTextViewItemPostDetailGallery.setBorderColor(mMediaIndicatorBackgroundColor); + binding.noPreviewPostTypeImageViewItemPostDetailGallery.setBackgroundColor(mNoPreviewPostTypeBackgroundColor); + binding.noPreviewPostTypeImageViewItemPostDetailGallery.setColorFilter(mNoPreviewPostTypeIconTint, PorterDuff.Mode.SRC_IN); adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface, mPostDetailMarkwon, mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mCardViewColor, mCommentColor, mScale); - galleryRecyclerView.setAdapter(adapter); - new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView); - galleryRecyclerView.setOnTouchListener((v, motionEvent) -> { + binding.galleryRecyclerViewItemPostDetailGallery.setAdapter(adapter); + new PagerSnapHelper().attachToRecyclerView(binding.galleryRecyclerViewItemPostDetailGallery); + binding.galleryRecyclerViewItemPostDetailGallery.setOnTouchListener((v, motionEvent) -> { if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) { if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); @@ -2444,8 +2281,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler return false; }); LinearLayoutManagerBugFixed layoutManager = new LinearLayoutManagerBugFixed(mActivity, RecyclerView.HORIZONTAL, false); - galleryRecyclerView.setLayoutManager(layoutManager); - galleryRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { + binding.galleryRecyclerViewItemPostDetailGallery.setLayoutManager(layoutManager); + binding.galleryRecyclerViewItemPostDetailGallery.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); @@ -2454,10 +2291,10 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); - imageIndexTextView.setText(mActivity.getString(R.string.image_index_in_gallery, layoutManager.findFirstVisibleItemPosition() + 1, mPost.getGallery().size())); + binding.imageIndexTextViewItemPostDetailGallery.setText(mActivity.getString(R.string.image_index_in_gallery, layoutManager.findFirstVisibleItemPosition() + 1, mPost.getGallery().size())); } }); - galleryRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { + binding.galleryRecyclerViewItemPostDetailGallery.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { private float downX; private float downY; private boolean dragged; @@ -2508,7 +2345,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } }); - mNoPreviewPostTypeImageView.setOnClickListener(view -> { + binding.noPreviewPostTypeImageViewItemPostDetailGallery.setOnClickListener(view -> { Intent intent = new Intent(mActivity, ViewRedditGalleryActivity.class); intent.putParcelableArrayListExtra(ViewRedditGalleryActivity.EXTRA_REDDIT_GALLERY, mPost.getGallery()); intent.putExtra(ViewRedditGalleryActivity.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName()); @@ -2519,79 +2356,34 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } class PostDetailTextViewHolder extends PostDetailBaseViewHolder { - @BindView(R.id.icon_gif_image_view_item_post_detail_text) - AspectRatioGifImageView mIconGifImageView; - @BindView(R.id.subreddit_text_view_item_post_detail_text) - TextView mSubredditTextView; - @BindView(R.id.user_text_view_item_post_detail_text) - TextView mUserTextView; - @BindView(R.id.author_flair_text_view_item_post_detail_text) - TextView mAuthorFlairTextView; - @BindView(R.id.post_time_text_view_item_post_detail_text) - TextView mPostTimeTextView; - @BindView(R.id.title_text_view_item_post_detail_text) - TextView mTitleTextView; - @BindView(R.id.content_markdown_view_item_post_detail_text) - RecyclerView mContentMarkdownView; - @BindView(R.id.type_text_view_item_post_detail_text) - CustomTextView mTypeTextView; - @BindView(R.id.crosspost_image_view_item_post_detail_text) - ImageView mCrosspostImageView; - @BindView(R.id.archived_image_view_item_post_detail_text) - ImageView mArchivedImageView; - @BindView(R.id.locked_image_view_item_post_detail_text) - ImageView mLockedImageView; - @BindView(R.id.nsfw_text_view_item_post_detail_text) - CustomTextView mNSFWTextView; - @BindView(R.id.spoiler_custom_text_view_item_post_detail_text) - CustomTextView mSpoilerTextView; - @BindView(R.id.flair_custom_text_view_item_post_detail_text) - CustomTextView mFlairTextView; - @BindView(R.id.awards_text_view_item_post_detail_text) - TextView mAwardsTextView; - @BindView(R.id.upvote_ratio_text_view_item_post_detail_text) - TextView mUpvoteRatioTextView; - @BindView(R.id.bottom_constraint_layout_item_post_detail_text) - ConstraintLayout mBottomConstraintLayout; - @BindView(R.id.plus_button_item_post_detail_text) - ImageView mUpvoteButton; - @BindView(R.id.score_text_view_item_post_detail_text) - TextView mScoreTextView; - @BindView(R.id.minus_button_item_post_detail_text) - ImageView mDownvoteButton; - @BindView(R.id.comments_count_item_post_detail_text) - TextView commentsCountTextView; - @BindView(R.id.save_button_item_post_detail_text) - ImageView mSaveButton; - @BindView(R.id.share_button_item_post_detail_text) - ImageView mShareButton; - - PostDetailTextViewHolder(@NonNull View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - setBaseView(mIconGifImageView, - mSubredditTextView, - mUserTextView, - mAuthorFlairTextView, - mPostTimeTextView, - mTitleTextView, - mTypeTextView, - mCrosspostImageView, - mArchivedImageView, - mLockedImageView, - mNSFWTextView, - mSpoilerTextView, - mFlairTextView, - mAwardsTextView, - mUpvoteRatioTextView, - mContentMarkdownView, - mBottomConstraintLayout, - mUpvoteButton, - mScoreTextView, - mDownvoteButton, - commentsCountTextView, - mSaveButton, - mShareButton); + ItemPostDetailTextBinding binding; + + PostDetailTextViewHolder(@NonNull ItemPostDetailTextBinding binding) { + super(binding.getRoot()); + this.binding = binding; + setBaseView(binding.iconGifImageViewItemPostDetailText, + binding.subredditTextViewItemPostDetailText, + binding.userTextViewItemPostDetailText, + binding.authorFlairTextViewItemPostDetailText, + binding.postTimeTextViewItemPostDetailText, + binding.titleTextViewItemPostDetailText, + binding.typeTextViewItemPostDetailText, + binding.crosspostImageViewItemPostDetailText, + binding.archivedImageViewItemPostDetailText, + binding.lockedImageViewItemPostDetailText, + binding.nsfwTextViewItemPostDetailText, + binding.spoilerCustomTextViewItemPostDetailText, + binding.flairCustomTextViewItemPostDetailText, + binding.awardsTextViewItemPostDetailText, + binding.upvoteRatioTextViewItemPostDetailText, + binding.contentMarkdownViewItemPostDetailText, + binding.bottomConstraintLayoutItemPostDetailText, + binding.voteButtonToggleItemPostDetailText, + binding.upvoteButtonItemPostDetailText, + binding.downvoteButtonItemPostDetailText, + binding.commentsCountButtonItemPostDetailText, + binding.saveButtonItemPostDetailText, + binding.shareButtonItemPostDetailText); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index e7fd43fc..853105e3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -3316,6 +3316,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ImageView stickiedPostImageView, TextView postTimeTextView, TextView titleTextView, + CustomTextView typeTextView, + ImageView crosspostImageView, + ImageView archivedImageView, + ImageView lockedImageView, + CustomTextView nsfwTextView, + CustomTextView spoilerTextView, + CustomTextView flairTextView, + CustomTextView awardsTextView, AspectRatioFrameLayout aspectRatioFrameLayout, GifImageView previewImageView, ImageView errorLoadingGfycatImageView, @@ -3597,6 +3605,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie binding.stickiedPostImageViewItemPostVideoTypeAutoplay, binding.postTimeTextViewItemPostVideoTypeAutoplay, binding.titleTextViewItemPostVideoTypeAutoplay, + binding.typeTextViewItemPostVideoTypeAutoplay, + binding.crosspostImageViewItemPostVideoTypeAutoplay, + binding.archivedImageViewItemPostVideoTypeAutoplay, + binding.lockedImageViewItemPostVideoTypeAutoplay, + binding.nsfwTextViewItemPostVideoTypeAutoplay, + binding.spoilerCustomTextViewItemPostVideoTypeAutoplay, + binding.flairCustomTextViewItemPostVideoTypeAutoplay, + binding.awardsTextViewItemPostVideoTypeAutoplay, binding.aspectRatioFrameLayoutItemPostVideoTypeAutoplay, binding.previewImageViewItemPostVideoTypeAutoplay, binding.errorLoadingGfycatImageViewItemPostVideoTypeAutoplay, @@ -3625,6 +3641,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie binding.stickiedPostImageViewItemPostVideoTypeAutoplay, binding.postTimeTextViewItemPostVideoTypeAutoplay, binding.titleTextViewItemPostVideoTypeAutoplay, + binding.typeTextViewItemPostVideoTypeAutoplay, + binding.crosspostImageViewItemPostVideoTypeAutoplay, + binding.archivedImageViewItemPostVideoTypeAutoplay, + binding.lockedImageViewItemPostVideoTypeAutoplay, + binding.nsfwTextViewItemPostVideoTypeAutoplay, + binding.spoilerCustomTextViewItemPostVideoTypeAutoplay, + binding.flairCustomTextViewItemPostVideoTypeAutoplay, + binding.awardsTextViewItemPostVideoTypeAutoplay, binding.aspectRatioFrameLayoutItemPostVideoTypeAutoplay, binding.previewImageViewItemPostVideoTypeAutoplay, binding.errorLoadingGfycatImageViewItemPostVideoTypeAutoplay, @@ -4997,29 +5021,37 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie private boolean isManuallyPaused; PostCard2BaseVideoAutoplayViewHolder(View itemView, - AspectRatioGifImageView iconGifImageView, - TextView subredditTextView, - TextView userTextView, - ImageView stickiedPostImageView, - TextView postTimeTextView, - TextView titleTextView, - AspectRatioFrameLayout aspectRatioFrameLayout, - GifImageView previewImageView, - ImageView errorLoadingGfycatImageView, - PlayerView videoPlayer, - ImageView muteButton, - ImageView fullscreenButton, - ImageView pauseButton, - ImageView playButton, - DefaultTimeBar progressBar, - ConstraintLayout bottomConstraintLayout, - MaterialButtonToggleGroup voteButtonToggleGroup, - MaterialButton upvoteButton, - MaterialButton downvoteButton, - MaterialButton commentsCountButton, - MaterialButton saveButton, - MaterialButton shareButton, - View divider) { + AspectRatioGifImageView iconGifImageView, + TextView subredditTextView, + TextView userTextView, + ImageView stickiedPostImageView, + TextView postTimeTextView, + TextView titleTextView, + CustomTextView typeTextView, + ImageView crosspostImageView, + ImageView archivedImageView, + ImageView lockedImageView, + CustomTextView nsfwTextView, + CustomTextView spoilerTextView, + CustomTextView flairTextView, + CustomTextView awardsTextView, + AspectRatioFrameLayout aspectRatioFrameLayout, + GifImageView previewImageView, + ImageView errorLoadingGfycatImageView, + PlayerView videoPlayer, + ImageView muteButton, + ImageView fullscreenButton, + ImageView pauseButton, + ImageView playButton, + DefaultTimeBar progressBar, + ConstraintLayout bottomConstraintLayout, + MaterialButtonToggleGroup voteButtonToggleGroup, + MaterialButton upvoteButton, + MaterialButton downvoteButton, + MaterialButton commentsCountButton, + MaterialButton saveButton, + MaterialButton shareButton, + View divider) { super(itemView); setBaseView( iconGifImageView, @@ -5286,6 +5318,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie binding.stickiedPostImageViewItemPostCard2VideoAutoplay, binding.postTimeTextViewItemPostCard2VideoAutoplay, binding.titleTextViewItemPostCard2VideoAutoplay, + binding.typeTextViewItemPostCard2VideoAutoplay, + binding.crosspostImageViewItemPostCard2VideoAutoplay, + binding.archivedImageViewItemPostCard2VideoAutoplay, + binding.lockedImageViewItemPostCard2VideoAutoplay, + binding.nsfwTextViewItemPostCard2VideoAutoplay, + binding.spoilerCustomTextViewItemPostCard2VideoAutoplay, + binding.flairCustomTextViewItemPostCard2VideoAutoplay, + binding.awardsTextViewItemPostCard2VideoAutoplay, binding.aspectRatioFrameLayoutItemPostCard2VideoAutoplay, binding.previewImageViewItemPostCard2VideoAutoplay, binding.errorLoadingGfycatImageViewItemPostCard2VideoAutoplay, @@ -5315,6 +5355,14 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie binding.stickiedPostImageViewItemPostCard2VideoAutoplay, binding.postTimeTextViewItemPostCard2VideoAutoplay, binding.titleTextViewItemPostCard2VideoAutoplay, + binding.typeTextViewItemPostCard2VideoAutoplay, + binding.crosspostImageViewItemPostCard2VideoAutoplay, + binding.archivedImageViewItemPostCard2VideoAutoplay, + binding.lockedImageViewItemPostCard2VideoAutoplay, + binding.nsfwTextViewItemPostCard2VideoAutoplay, + binding.spoilerCustomTextViewItemPostCard2VideoAutoplay, + binding.flairCustomTextViewItemPostCard2VideoAutoplay, + binding.awardsTextViewItemPostCard2VideoAutoplay, binding.aspectRatioFrameLayoutItemPostCard2VideoAutoplay, binding.previewImageViewItemPostCard2VideoAutoplay, binding.errorLoadingGfycatImageViewItemPostCard2VideoAutoplay, diff --git a/app/src/main/res/layout/item_post_detail_gallery.xml b/app/src/main/res/layout/item_post_detail_gallery.xml index bb9f2903..d9016438 100644 --- a/app/src/main/res/layout/item_post_detail_gallery.xml +++ b/app/src/main/res/layout/item_post_detail_gallery.xml @@ -229,7 +229,7 @@ </FrameLayout> <ImageView - android:id="@+id/image_view_no_preview_link_item_post_detail_gallery" + android:id="@+id/no_preview_post_type_image_view_item_post_detail_gallery" android:layout_width="match_parent" android:layout_height="150dp" android:scaleType="center" @@ -249,87 +249,94 @@ <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/bottom_constraint_layout_item_post_detail_gallery" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_gallery" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_gallery" + android:layout_width="0dp" android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - app:layout_constraintBottom_toBottomOf="parent" + app:singleSelection="true" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/score_text_view_item_post_detail_gallery" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:fontFamily="?attr/font_family" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_gallery" - app:layout_constraintTop_toTopOf="parent" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_gallery" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_gallery" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/comments_count_item_post_detail_gallery" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_gallery" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_gallery" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_gallery" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" - android:fontFamily="?attr/font_family" - android:gravity="center_vertical" - android:padding="12dp" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_gallery" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_gallery" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_gallery" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="12dp" + app:strokeWidth="0dp" + app:iconSize="24dp" + app:layout_constraintHorizontal_bias="1" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_gallery" app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_gallery" - app:layout_constraintHorizontal_bias="1" - app:layout_constraintStart_toEndOf="@id/comments_count_item_post_detail_gallery" - app:layout_constraintTop_toTopOf="parent" /> + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_gallery" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" + app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml index 900ce5d1..b71ae921 100644 --- a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml +++ b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml @@ -252,89 +252,96 @@ android:nestedScrollingEnabled="false" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_image_and_gif_autoplay" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_image_and_gif_autoplay"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_image_and_gif_autoplay" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - 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_image_and_gif_autoplay" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_image_and_gif_autoplay" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_image_and_gif_autoplay" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_image_and_gif_autoplay" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_image_and_gif_autoplay" /> + app:layout_constraintBottom_toBottomOf="parent"> - <TextView - android:id="@+id/comments_count_item_post_detail_image_and_gif_autoplay" + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_image_and_gif_autoplay" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_image_and_gif_autoplay" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_image_and_gif_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_image_and_gif_autoplay" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_image_and_gif_autoplay" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_image_and_gif_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_image_and_gif_autoplay" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_image_and_gif_autoplay" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_image_and_gif_autoplay" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_image_and_gif_autoplay" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_image_and_gif_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_link.xml b/app/src/main/res/layout/item_post_detail_link.xml index a6299212..4074f4b4 100644 --- a/app/src/main/res/layout/item_post_detail_link.xml +++ b/app/src/main/res/layout/item_post_detail_link.xml @@ -262,89 +262,96 @@ android:nestedScrollingEnabled="false" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_link" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_link"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_link" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - 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_link" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_link" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_link" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_link" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_link" /> + app:layout_constraintBottom_toBottomOf="parent"> - <TextView - android:id="@+id/comments_count_item_post_detail_link" + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_link" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_link" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_link" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_link" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_link" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_link" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_link" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_link" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_link" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_link" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_link" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_no_preview.xml b/app/src/main/res/layout/item_post_detail_no_preview.xml index e96a45a3..b460f0d7 100644 --- a/app/src/main/res/layout/item_post_detail_no_preview.xml +++ b/app/src/main/res/layout/item_post_detail_no_preview.xml @@ -8,13 +8,13 @@ android:background="?attr/cardViewBackgroundColor"> <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/constraint_layout_item_post_detail_no_preview_link" + android:id="@+id/constraint_layout_item_post_detail_no_preview" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"> <ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView - android:id="@+id/icon_gif_image_view_item_post_detail_no_preview_link" + android:id="@+id/icon_gif_image_view_item_post_detail_no_preview" android:layout_width="24dp" android:layout_height="24dp" app:layout_constraintBottom_toBottomOf="parent" @@ -22,36 +22,36 @@ app:layout_constraintTop_toTopOf="parent" /> <TextView - android:id="@+id/subreddit_text_view_item_post_detail_no_preview_link" + android:id="@+id/subreddit_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" - app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link" + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview" app:layout_constraintEnd_toStartOf="@id/guideline" app:layout_constraintTop_toTopOf="parent" app:layout_constraintHorizontal_bias="0" app:layout_constrainedWidth="true" /> <TextView - android:id="@+id/user_text_view_item_post_detail_no_preview_link" + android:id="@+id/user_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" - app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_no_preview_link" - app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link" + app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_no_preview" + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview" app:layout_constraintEnd_toStartOf="@id/guideline" - app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_no_preview_link" + app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail_no_preview" app:layout_constraintHorizontal_bias="0" app:layout_constrainedWidth="true"/> <TextView - android:id="@+id/author_flair_text_view_item_post_detail_no_preview_link" + android:id="@+id/author_flair_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" @@ -60,15 +60,15 @@ android:fontFamily="?attr/font_family" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link" + app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview" app:layout_constraintEnd_toStartOf="@id/guideline" - app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_no_preview_link" + app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail_no_preview" app:layout_constraintHorizontal_bias="0" app:layout_constrainedWidth="true" tools:visibility="visible" /> <TextView - android:id="@+id/post_time_text_view_item_post_detail_no_preview_link" + android:id="@+id/post_time_text_view_item_post_detail_no_preview" android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="end" @@ -90,7 +90,7 @@ </androidx.constraintlayout.widget.ConstraintLayout> <TextView - android:id="@+id/title_text_view_item_post_detail_no_preview_link" + android:id="@+id/title_text_view_item_post_detail_no_preview" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="16dp" @@ -104,7 +104,7 @@ android:longClickable="true" /> <androidx.recyclerview.widget.RecyclerView - android:id="@+id/content_markdown_view_item_post_detail_no_preview_link" + android:id="@+id/content_markdown_view_item_post_detail_no_preview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="8dp" @@ -123,7 +123,7 @@ app:flRowVerticalGravity="center"> <com.libRG.CustomTextView - android:id="@+id/type_text_view_item_post_detail_no_preview_link" + android:id="@+id/type_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="4dp" @@ -135,7 +135,7 @@ app:lib_setShape="rectangle" /> <com.libRG.CustomTextView - android:id="@+id/spoiler_custom_text_view_item_post_detail_no_preview_link" + android:id="@+id/spoiler_custom_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" @@ -149,7 +149,7 @@ app:lib_setShape="rectangle" /> <com.libRG.CustomTextView - android:id="@+id/nsfw_text_view_item_post_detail_no_preview_link" + android:id="@+id/nsfw_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="4dp" @@ -162,7 +162,7 @@ app:lib_setShape="rectangle" /> <com.libRG.CustomTextView - android:id="@+id/flair_custom_text_view_item_post_detail_no_preview_link" + android:id="@+id/flair_custom_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" @@ -175,35 +175,35 @@ app:lib_setShape="rectangle" /> <TextView - android:id="@+id/upvote_ratio_text_view_item_post_detail_no_preview_link" + android:id="@+id/upvote_ratio_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="?attr/font_12" android:fontFamily="?attr/font_family" /> <ImageView - android:id="@+id/archived_image_view_item_post_detail_no_preview_link" + android:id="@+id/archived_image_view_item_post_detail_no_preview" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_archive_outline" android:visibility="gone" /> <ImageView - android:id="@+id/locked_image_view_item_post_detail_no_preview_link" + android:id="@+id/locked_image_view_item_post_detail_no_preview" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_outline_lock_24dp" android:visibility="gone" /> <ImageView - android:id="@+id/crosspost_image_view_item_post_detail_no_preview_link" + android:id="@+id/crosspost_image_view_item_post_detail_no_preview" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/crosspost" android:visibility="gone" /> <TextView - android:id="@+id/awards_text_view_item_post_detail_no_preview_link" + android:id="@+id/awards_text_view_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="?attr/font_12" @@ -213,7 +213,7 @@ </com.nex3z.flowlayout.FlowLayout> <TextView - android:id="@+id/link_text_view_item_post_detail_no_preview_link" + android:id="@+id/link_text_view_item_post_detail_no_preview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" @@ -223,95 +223,102 @@ android:fontFamily="?attr/font_family" /> <ImageView - android:id="@+id/image_view_no_preview_post_type_item_post_detail_no_preview_link" + android:id="@+id/image_view_no_preview_post_type_item_post_detail_no_preview" android:layout_width="match_parent" android:layout_height="150dp" android:scaleType="center" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_no_preview" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_no_preview_link"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_no_preview_link" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - 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_no_preview_link" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_no_preview_link" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_no_preview_link" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_no_preview" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_no_preview_link" /> - - <TextView - android:id="@+id/comments_count_item_post_detail_no_preview_link" + app:layout_constraintBottom_toBottomOf="parent"> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_no_preview" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_no_preview" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_no_preview_link" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_no_preview" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView - android:id="@+id/save_button_item_post_detail_no_preview_link" + <com.google.android.material.button.MaterialButton + android:id="@+id/save_button_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_no_preview_link" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_no_preview_link" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_no_preview" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_no_preview" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView - android:id="@+id/share_button_item_post_detail_no_preview_link" + <com.google.android.material.button.MaterialButton + android:id="@+id/share_button_item_post_detail_no_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_text.xml b/app/src/main/res/layout/item_post_detail_text.xml index 936ef740..625a598d 100644 --- a/app/src/main/res/layout/item_post_detail_text.xml +++ b/app/src/main/res/layout/item_post_detail_text.xml @@ -213,89 +213,96 @@ </com.nex3z.flowlayout.FlowLayout> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_text"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_text" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_text" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintBottom_toBottomOf="parent"> - <TextView - android:id="@+id/score_text_view_item_post_detail_text" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_text" /> + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_text" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> - <ImageView - android:id="@+id/minus_button_item_post_detail_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - 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_text" /> + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_text" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> - <TextView - android:id="@+id/comments_count_item_post_detail_text" + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_text" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_text" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_text" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_text" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_text" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_text" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml index f1d84e27..8a7c8044 100644 --- a/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml +++ b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml @@ -265,89 +265,96 @@ android:nestedScrollingEnabled="false" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_video_and_gif_preview" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_video_and_gif_preview"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_video_and_gif_preview" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - 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_video_and_gif_preview" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_and_gif_preview" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_video_and_gif_preview" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_video_and_gif_preview" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_and_gif_preview" /> + app:layout_constraintBottom_toBottomOf="parent"> - <TextView - android:id="@+id/comments_count_item_post_detail_video_and_gif_preview" + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_video_and_gif_preview" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_video_and_gif_preview" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_video_and_gif_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_and_gif_preview" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_video_and_gif_preview" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_video_and_gif_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_video_and_gif_preview" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_and_gif_preview" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_video_and_gif_preview" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_and_gif_preview" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_video_and_gif_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_video_autoplay.xml b/app/src/main/res/layout/item_post_detail_video_autoplay.xml index d4818d41..69af5ffd 100644 --- a/app/src/main/res/layout/item_post_detail_video_autoplay.xml +++ b/app/src/main/res/layout/item_post_detail_video_autoplay.xml @@ -246,89 +246,96 @@ android:nestedScrollingEnabled="false" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_video_autoplay" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_video_autoplay"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_video_autoplay" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - 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_video_autoplay" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_autoplay" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_video_autoplay" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_video_autoplay" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" /> - - <TextView - android:id="@+id/comments_count_item_post_detail_video_autoplay" + app:layout_constraintBottom_toBottomOf="parent"> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_video_autoplay" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_video_autoplay" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_video_autoplay" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_video_autoplay" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_autoplay" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_video_autoplay" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_autoplay" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/item_post_detail_video_autoplay_legacy_controller.xml b/app/src/main/res/layout/item_post_detail_video_autoplay_legacy_controller.xml index c21efc56..36400f28 100644 --- a/app/src/main/res/layout/item_post_detail_video_autoplay_legacy_controller.xml +++ b/app/src/main/res/layout/item_post_detail_video_autoplay_legacy_controller.xml @@ -247,89 +247,96 @@ android:nestedScrollingEnabled="false" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_detail_video_autoplay" android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/bottom_constraint_layout_item_post_detail_video_autoplay"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> - <ImageView - android:id="@+id/plus_button_item_post_detail_video_autoplay" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - 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_video_autoplay" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_autoplay" /> - - <ImageView - android:id="@+id/minus_button_item_post_detail_video_autoplay" - android:layout_width="wrap_content" + <com.google.android.material.button.MaterialButtonToggleGroup + android:id="@+id/vote_button_toggle_item_post_detail_video_autoplay" + android:layout_width="0dp" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:singleSelection="true" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail_video_autoplay" /> - - <TextView - android:id="@+id/comments_count_item_post_detail_video_autoplay" + app:layout_constraintBottom_toBottomOf="parent"> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/upvote_button_item_post_detail_video_autoplay" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:strokeWidth="0dp" + app:icon="@drawable/ic_upvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + <com.google.android.material.button.MaterialButton + style="?attr/materialButtonOutlinedStyle" + android:id="@+id/downvote_button_item_post_detail_video_autoplay" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_downvote_24dp" + app:iconSize="24dp" + android:backgroundTint="#00000000" /> + + </com.google.android.material.button.MaterialButtonToggleGroup> + + <com.google.android.material.button.MaterialButton + android:id="@+id/comments_count_button_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:gravity="center_vertical" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:minWidth="0dp" android:textSize="?attr/font_12" android:textStyle="bold" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" + app:strokeWidth="0dp" + app:icon="@drawable/ic_comment_grey_24dp" + app:iconTint="@null" + app:iconSize="24dp" + app:iconPadding="12dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail_video_autoplay" /> + app:layout_constraintStart_toEndOf="@id/vote_button_toggle_item_post_detail_video_autoplay" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/save_button_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:iconSize="24dp" 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_video_autoplay" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_autoplay" /> + app:layout_constraintStart_toEndOf="@id/comments_count_button_item_post_detail_video_autoplay" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_detail_video_autoplay" + style="?attr/materialIconButtonOutlinedStyle" /> - <ImageView + <com.google.android.material.button.MaterialButton android:id="@+id/share_button_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="12dp" - android:src="@drawable/ic_share_grey_24dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" + app:strokeWidth="0dp" + app:icon="@drawable/ic_share_grey_24dp" + app:iconSize="24dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + style="?attr/materialIconButtonOutlinedStyle" /> </androidx.constraintlayout.widget.ConstraintLayout> |