mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 04:17:12 +01:00
Show an indicator in gallery post in PostRecyclerViewAdapter.
This commit is contained in:
parent
3498989203
commit
8415ace96a
@ -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;
|
||||
}
|
||||
|
@ -28,12 +28,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/video_or_gif_indicator_image_view_item_post_card_2_with_preview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="start"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/play_button_round_background"
|
||||
android:src="@drawable/ic_play_circle_36dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
|
@ -221,12 +221,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/video_or_gif_indicator_image_view_item_post_with_preview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="start"
|
||||
android:scaleType="center"
|
||||
android:background="@drawable/play_button_round_background"
|
||||
android:src="@drawable/ic_play_circle_36dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
|
Loading…
Reference in New Issue
Block a user