aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java34
1 files changed, 21 insertions, 13 deletions
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 0f66c665..c22b1a7e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -29,6 +29,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.Barrier;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
+import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.paging.PagedListAdapter;
import androidx.recyclerview.widget.DiffUtil;
@@ -757,10 +758,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
} else if (holder instanceof PostWithPreviewTypeViewHolder) {
if (post.getPostType() == Post.VIDEO_TYPE) {
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
+ ((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.video));
} else if (post.getPostType() == Post.GIF_TYPE) {
if (!mAutoplay) {
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
+ ((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
}
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
} else if (post.getPostType() == Post.IMAGE_TYPE) {
@@ -776,6 +779,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
} else if (post.getPostType() == Post.GALLERY_TYPE) {
((PostWithPreviewTypeViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gallery));
+ ((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
+ ((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_reverse_color_24dp));
}
if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
@@ -885,10 +890,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
} else if (holder instanceof PostCard2WithPreviewViewHolder) {
if (post.getPostType() == Post.VIDEO_TYPE) {
((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
+ ((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
((PostCard2WithPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.video));
} else if (post.getPostType() == Post.GIF_TYPE) {
if (!mAutoplay) {
((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
+ ((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
}
((PostCard2WithPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gif));
} else if (post.getPostType() == Post.IMAGE_TYPE) {
@@ -904,6 +911,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
} else if (post.getPostType() == Post.GALLERY_TYPE) {
((PostCard2WithPreviewViewHolder) holder).typeTextView.setText(mActivity.getString(R.string.gallery));
+ ((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
+ ((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_reverse_color_24dp));
}
if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
@@ -1345,7 +1354,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_outline_video_24dp);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.GONE);
} else if (post.getPostType() == Post.IMAGE_TYPE || post.getPostType() == Post.GIF_TYPE) {
-
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.GONE);
} else if (post.getPostType() == Post.LINK_TYPE) {
((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_link);
@@ -1360,7 +1368,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(mActivity.getDrawable(R.drawable.ic_play_circle_36dp));
+ ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@@ -1385,7 +1393,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(mActivity.getDrawable(R.drawable.ic_play_circle_36dp));
+ ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@@ -1410,7 +1418,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(mActivity.getDrawable(R.drawable.ic_link_post_type_indicator));
+ ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@@ -1445,7 +1453,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(mActivity.getDrawable(R.drawable.ic_gallery_reverse_color_24dp));
+ ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_reverse_color_24dp));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@@ -2786,12 +2794,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
muteButton.setOnClickListener(view -> {
if (helper != null) {
if (helper.getVolume() != 0) {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp));
helper.setVolume(0f);
volume = 0f;
mFragment.videoAutoplayChangeMutingOption(true);
} else {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp));
helper.setVolume(1f);
volume = 1f;
mFragment.videoAutoplayChangeMutingOption(false);
@@ -2884,9 +2892,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
helper.setVolume(volume);
muteButton.setVisibility(View.VISIBLE);
if (volume != 0f) {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp));
} else {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp));
}
break;
}
@@ -4005,12 +4013,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
muteButton.setOnClickListener(view -> {
if (helper != null) {
if (helper.getVolume() != 0) {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp));
helper.setVolume(0f);
volume = 0f;
mFragment.videoAutoplayChangeMutingOption(true);
} else {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp));
helper.setVolume(1f);
volume = 1f;
mFragment.videoAutoplayChangeMutingOption(false);
@@ -4103,9 +4111,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
helper.setVolume(volume);
muteButton.setVisibility(View.VISIBLE);
if (volume != 0f) {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp));
} else {
- muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_24dp));
+ muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp));
}
break;
}