Continue adding Gallery Layout.

This commit is contained in:
Alex Ning 2021-02-16 18:31:42 +08:00
parent 538827f11e
commit 9efeeb88ac
6 changed files with 32 additions and 21 deletions

View File

@ -1095,6 +1095,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));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@ -1119,6 +1120,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));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@ -1142,6 +1144,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
case Post.LINK_TYPE: {
((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.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@ -1175,6 +1179,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
case Post.GALLERY_TYPE: {
((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_24dp));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {

View File

@ -1711,9 +1711,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
int halfOffset = mItemOffset / 2;
if (spanIndex == 0) {
outRect.set(halfOffset, 0, halfOffset, 0);
outRect.set(halfOffset, 0, halfOffset / 2, 0);
} else {
outRect.set(halfOffset, 0, halfOffset, 0);
outRect.set(halfOffset / 2, 0, halfOffset, 0);
}
}
}

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,4v12L8,16L8,4h12m0,-2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM11.5,11.67l1.69,2.26 2.48,-3.1L19,15L9,15zM2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6L2,6z"/>
</vector>

View File

@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:fillColor="#000000"
android:pathData="M17,7h-4v2h4c1.65,0 3,1.35 3,3s-1.35,3 -3,3h-4v2h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5zM11,15L7,15c-1.65,0 -3,-1.35 -3,-3s1.35,-3 3,-3h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-2zM8,11h8v2L8,13z"/>
</vector>

View File

@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:fillColor="#FFFFFF"
android:pathData="M17,7h-4v2h4c1.65,0 3,1.35 3,3s-1.35,3 -3,3h-4v2h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5zM11,15L7,15c-1.65,0 -3,-1.35 -3,-3s1.35,-3 3,-3h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-2zM8,11h8v2L8,13z"/>
</vector>

View File

@ -19,14 +19,28 @@
android:layout_gravity="center"
android:visibility="gone" />
<ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView
android:id="@+id/image_view_item_post_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<ImageView
android:id="@+id/image_view_no_preview_item_post_gallery"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="center"
android:background="@drawable/thumbnail_compact_layout_rounded_edge"
android:visibility="gone" />
<ImageView
android:id="@+id/video_or_gif_indicator_image_view_item_post_gallery"
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" />
<RelativeLayout
@ -49,20 +63,6 @@
</RelativeLayout>
<ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView
android:id="@+id/image_view_item_post_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<ImageView
android:id="@+id/image_view_no_preview_item_post_gallery"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="center"
android:background="@drawable/thumbnail_compact_layout_rounded_edge"
android:visibility="gone" />
<TextView
android:id="@+id/title_text_view_item_post_gallery"
android:layout_width="match_parent"