From e01574d0785e0376f83d588e45d38cb02e71d5a9 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:15:52 -0400 Subject: Continue adding Card Layout 3. --- .../adapters/PostRecyclerViewAdapter.java | 301 ++++++--------------- 1 file changed, 78 insertions(+), 223 deletions(-) (limited to 'app/src/main/java/ml') 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 16bdbcff..bce379ef 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -1751,36 +1751,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter 0 && !mHideTheNumberOfAwards) { - ((PostMaterial3CardBaseViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE); - if (post.getNAwards() == 1) { - ((PostMaterial3CardBaseViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award)); - } else { - ((PostMaterial3CardBaseViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.n_awards, post.getNAwards())); - } - } - switch (post.getVoteType()) { case 1: //Upvoted @@ -1802,16 +1772,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter userTextView.performClick()); } - if (!(mActivity instanceof FilteredPostsActivity)) { - nsfwTextView.setOnClickListener(view -> { - int position = getBindingAdapterPosition(); - if (position < 0) { - return; - } - Post post = getItem(position); - if (post != null) { - mCallback.nsfwChipClicked(); - } - }); - typeTextView.setOnClickListener(view -> { - int position = getBindingAdapterPosition(); - if (position < 0) { - return; - } - Post post = getItem(position); - if (post != null) { - mCallback.typeChipClicked(post.getPostType()); - } - }); - - flairTextView.setOnClickListener(view -> { - int position = getBindingAdapterPosition(); - if (position < 0) { - return; - } - Post post = getItem(position); - if (post != null) { - mCallback.flairChipClicked(post.getFlair()); - } - }); - } - upvoteButton.setOnClickListener(view -> { int position = getBindingAdapterPosition(); if (position < 0) { @@ -6422,41 +6285,33 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { + binding.linkTextViewItemPostCard3WithPreview.setTextColor(mSecondaryTextColor); + binding.imageViewNoPreviewGalleryItemPostCard3WithPreview.setBackgroundColor(mNoPreviewPostTypeBackgroundColor); + binding.imageViewNoPreviewGalleryItemPostCard3WithPreview.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN); + binding.progressBarItemPostCard3WithPreview.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); + binding.videoOrGifIndicatorImageViewItemPostCard3WithPreview.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN); + binding.videoOrGifIndicatorImageViewItemPostCard3WithPreview.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor)); + binding.loadImageErrorTextViewItemPostCard3WithPreview.setTextColor(mPrimaryTextColor); + + binding.imageViewItemPostCard3WithPreview.setOnClickListener(view -> { int position = getBindingAdapterPosition(); if (position < 0) { return; @@ -6468,28 +6323,28 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { - binding.progressBarItemPostWithPreview.setVisibility(View.VISIBLE); - binding.loadImageErrorTextViewItemPostWithPreview.setVisibility(View.GONE); + binding.loadImageErrorTextViewItemPostCard3WithPreview.setOnClickListener(view -> { + binding.progressBarItemPostCard3WithPreview.setVisibility(View.VISIBLE); + binding.loadImageErrorTextViewItemPostCard3WithPreview.setVisibility(View.GONE); loadImage(this); }); - binding.imageViewNoPreviewGalleryItemPostWithPreview.setOnClickListener(view -> { - binding.imageViewItemPostWithPreview.performClick(); + binding.imageViewNoPreviewGalleryItemPostCard3WithPreview.setOnClickListener(view -> { + binding.imageViewItemPostCard3WithPreview.performClick(); }); glideRequestListener = new RequestListener<>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) { - binding.progressBarItemPostWithPreview.setVisibility(View.GONE); - binding.loadImageErrorTextViewItemPostWithPreview.setVisibility(View.VISIBLE); + binding.progressBarItemPostCard3WithPreview.setVisibility(View.GONE); + binding.loadImageErrorTextViewItemPostCard3WithPreview.setVisibility(View.VISIBLE); return false; } @Override public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) { - binding.loadImageErrorTextViewItemPostWithPreview.setVisibility(View.GONE); - binding.progressBarItemPostWithPreview.setVisibility(View.GONE); + binding.loadImageErrorTextViewItemPostCard3WithPreview.setVisibility(View.GONE); + binding.progressBarItemPostCard3WithPreview.setVisibility(View.GONE); return false; } }; -- cgit v1.2.3