mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-14 04:07:12 +01:00
Swipe to view images in a gallery in Card Layout 2.
This commit is contained in:
parent
2eaf8a8a01
commit
ef1b14cc6a
@ -243,11 +243,6 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleViewPagerSwipeLock(boolean lock) {
|
||||
binding.accountSavedThingViewPager2.setUserInputEnabled(!lock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postLayoutSelected(int postLayout) {
|
||||
if (sectionsPagerAdapter != null) {
|
||||
|
@ -400,8 +400,4 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo
|
||||
public void unlockSwipeRightToGoBack() {
|
||||
|
||||
}
|
||||
|
||||
public void toggleViewPagerSwipeLock(boolean lock) {
|
||||
|
||||
}
|
||||
}
|
@ -87,6 +87,7 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView;
|
||||
import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface;
|
||||
import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager;
|
||||
import ml.docilealligator.infinityforreddit.databinding.ItemPostCard2GalleryTypeBinding;
|
||||
import ml.docilealligator.infinityforreddit.databinding.ItemPostGalleryTypeBinding;
|
||||
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostDetailFragment;
|
||||
import ml.docilealligator.infinityforreddit.fragments.PostFragment;
|
||||
@ -120,7 +121,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
private static final int VIEW_TYPE_POST_GALLERY = 6;
|
||||
private static final int VIEW_TYPE_POST_CARD_2_VIDEO_AUTOPLAY_TYPE = 7;
|
||||
private static final int VIEW_TYPE_POST_CARD_2_WITH_PREVIEW_TYPE = 8;
|
||||
private static final int VIEW_TYPE_POST_CARD_2_TEXT_TYPE = 9;
|
||||
private static final int VIEW_TYPE_POST_CARD_2_GALLERY_TYPE = 9;
|
||||
private static final int VIEW_TYPE_POST_CARD_2_TEXT_TYPE = 10;
|
||||
|
||||
private static final DiffUtil.ItemCallback<Post> DIFF_CALLBACK = new DiffUtil.ItemCallback<Post>() {
|
||||
@Override
|
||||
@ -429,8 +431,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
return VIEW_TYPE_POST_CARD_2_WITH_PREVIEW_TYPE;
|
||||
case Post.GIF_TYPE:
|
||||
case Post.IMAGE_TYPE:
|
||||
case Post.GALLERY_TYPE:
|
||||
return VIEW_TYPE_POST_CARD_2_WITH_PREVIEW_TYPE;
|
||||
case Post.GALLERY_TYPE:
|
||||
return VIEW_TYPE_POST_CARD_2_GALLERY_TYPE;
|
||||
case Post.LINK_TYPE:
|
||||
case Post.NO_PREVIEW_LINK_TYPE:
|
||||
switch (mDefaultLinkPostLayout) {
|
||||
@ -479,6 +482,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
return new PostCard2VideoAutoplayViewHolder(LayoutInflater.from(parent.getContext()).inflate(mLegacyAutoplayVideoControllerUI ? R.layout.item_post_card_2_video_autoplay_legacy_controller : R.layout.item_post_card_2_video_autoplay, parent, false));
|
||||
} else if (viewType == VIEW_TYPE_POST_CARD_2_WITH_PREVIEW_TYPE) {
|
||||
return new PostCard2WithPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_card_2_with_preview, parent, false));
|
||||
} else if (viewType == VIEW_TYPE_POST_CARD_2_GALLERY_TYPE) {
|
||||
return new PostCard2GalleryTypeViewHolder(ItemPostCard2GalleryTypeBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
|
||||
} else {
|
||||
//VIEW_TYPE_POST_CARD_2_TEXT_TYPE
|
||||
return new PostCard2TextTypeViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_card_2_text, parent, false));
|
||||
@ -858,25 +863,25 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (holder instanceof PostGalleryTypeViewHolder) {
|
||||
} else if (holder instanceof PostBaseGalleryTypeViewHolder) {
|
||||
if (mDataSavingMode && mDisableImagePreview) {
|
||||
((PostGalleryTypeViewHolder) holder).binding.noPreviewImageViewItemPostGalleryType.setVisibility(View.VISIBLE);
|
||||
((PostGalleryTypeViewHolder) holder).binding.noPreviewImageViewItemPostGalleryType.setImageResource(R.drawable.ic_gallery_24dp);
|
||||
((PostBaseGalleryTypeViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE);
|
||||
((PostBaseGalleryTypeViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_24dp);
|
||||
} else {
|
||||
((PostGalleryTypeViewHolder) holder).binding.galleryFrameLayoutItemPostGalleryType.setVisibility(View.VISIBLE);
|
||||
((PostGalleryTypeViewHolder) holder).binding.imageIndexTextViewItemPostGalleryType.setText(mActivity.getString(R.string.image_index_in_gallery, 1, post.getGallery().size()));
|
||||
((PostBaseGalleryTypeViewHolder) holder).frameLayout.setVisibility(View.VISIBLE);
|
||||
((PostBaseGalleryTypeViewHolder) holder).imageIndexTextView.setText(mActivity.getString(R.string.image_index_in_gallery, 1, post.getGallery().size()));
|
||||
Post.Preview preview = getSuitablePreview(post.getPreviews());
|
||||
if (preview != null) {
|
||||
if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
|
||||
((PostGalleryTypeViewHolder) holder).adapter.setRatio(-1);
|
||||
((PostBaseGalleryTypeViewHolder) holder).adapter.setRatio(-1);
|
||||
} else {
|
||||
((PostGalleryTypeViewHolder) holder).adapter.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
||||
((PostBaseGalleryTypeViewHolder) holder).adapter.setRatio((float) preview.getPreviewHeight() / preview.getPreviewWidth());
|
||||
}
|
||||
} else {
|
||||
((PostGalleryTypeViewHolder) holder).adapter.setRatio(-1);
|
||||
((PostBaseGalleryTypeViewHolder) holder).adapter.setRatio(-1);
|
||||
}
|
||||
((PostGalleryTypeViewHolder) holder).adapter.setGalleryImages(post.getGallery());
|
||||
((PostGalleryTypeViewHolder) holder).adapter.setBlurImage(
|
||||
((PostBaseGalleryTypeViewHolder) holder).adapter.setGalleryImages(post.getGallery());
|
||||
((PostBaseGalleryTypeViewHolder) holder).adapter.setBlurImage(
|
||||
(post.isNSFW() && mNeedBlurNsfw && !(mDoNotBlurNsfwInNsfwSubreddits && mFragment != null && mFragment.getIsNsfwSubreddit())) || (post.isSpoiler() && mNeedBlurSpoiler));
|
||||
}
|
||||
} else if (holder instanceof PostTextTypeViewHolder) {
|
||||
@ -1890,9 +1895,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
((PostWithPreviewTypeViewHolder) holder).progressBar.setVisibility(View.GONE);
|
||||
((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.GONE);
|
||||
((PostWithPreviewTypeViewHolder) holder).linkTextView.setVisibility(View.GONE);
|
||||
} else if (holder instanceof PostGalleryTypeViewHolder) {
|
||||
((PostGalleryTypeViewHolder) holder).binding.galleryFrameLayoutItemPostGalleryType.setVisibility(View.GONE);
|
||||
((PostGalleryTypeViewHolder) holder).binding.noPreviewImageViewItemPostGalleryType.setVisibility(View.GONE);
|
||||
} else if (holder instanceof PostBaseGalleryTypeViewHolder) {
|
||||
((PostBaseGalleryTypeViewHolder) holder).frameLayout.setVisibility(View.GONE);
|
||||
((PostBaseGalleryTypeViewHolder) holder).noPreviewImageView.setVisibility(View.GONE);
|
||||
} else if (holder instanceof PostTextTypeViewHolder) {
|
||||
((PostTextTypeViewHolder) holder).contentTextView.setText("");
|
||||
((PostTextTypeViewHolder) holder).contentTextView.setTextColor(mPostContentColor);
|
||||
@ -3104,46 +3109,81 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
}
|
||||
|
||||
public class PostGalleryTypeViewHolder extends PostBaseViewHolder {
|
||||
ItemPostGalleryTypeBinding binding;
|
||||
public class PostBaseGalleryTypeViewHolder extends PostBaseViewHolder {
|
||||
FrameLayout frameLayout;
|
||||
RecyclerView galleryRecyclerView;
|
||||
CustomTextView imageIndexTextView;
|
||||
ImageView noPreviewImageView;
|
||||
|
||||
PostGalleryTypeImageRecyclerViewAdapter adapter;
|
||||
private boolean swipeLocked;
|
||||
|
||||
PostGalleryTypeViewHolder(ItemPostGalleryTypeBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
PostBaseGalleryTypeViewHolder(View rootView,
|
||||
AspectRatioGifImageView iconGifImageView,
|
||||
TextView subredditTextView,
|
||||
TextView userTextView,
|
||||
ImageView stickiedPostImageView,
|
||||
TextView postTimeTextView,
|
||||
TextView titleTextView,
|
||||
CustomTextView typeTextView,
|
||||
ImageView archivedImageView,
|
||||
ImageView lockedImageView,
|
||||
ImageView crosspostImageView,
|
||||
CustomTextView nsfwTextView,
|
||||
CustomTextView spoilerTextView,
|
||||
CustomTextView flairTextView,
|
||||
CustomTextView awardsTextView,
|
||||
FrameLayout frameLayout,
|
||||
RecyclerView galleryRecyclerView,
|
||||
CustomTextView imageIndexTextView,
|
||||
ImageView noPreviewImageView,
|
||||
ConstraintLayout bottomConstraintLayout,
|
||||
ImageView upvoteButton,
|
||||
TextView scoreTextView,
|
||||
ImageView downvoteButton,
|
||||
TextView commentsCountTextView,
|
||||
ImageView saveButton,
|
||||
ImageView shareButton,
|
||||
boolean itemViewIsNotCardView) {
|
||||
super(rootView);
|
||||
setBaseView(
|
||||
binding.iconGifImageViewItemPostGalleryType,
|
||||
binding.subredditNameTextViewItemPostGalleryType,
|
||||
binding.userTextViewItemPostGalleryType,
|
||||
binding.stickiedPostImageViewItemPostGalleryType,
|
||||
binding.postTimeTextViewItemPostGalleryType,
|
||||
binding.titleTextViewItemPostGalleryType,
|
||||
binding.typeTextViewItemPostGalleryType,
|
||||
binding.archivedImageViewItemPostGalleryType,
|
||||
binding.lockedImageViewItemPostGalleryType,
|
||||
binding.crosspostImageViewItemPostGalleryType,
|
||||
binding.nsfwTextViewItemPostGalleryType,
|
||||
binding.spoilerTextViewItemPostGalleryType,
|
||||
binding.flairTextViewItemPostGalleryType,
|
||||
binding.awardsTextViewItemPostGalleryType,
|
||||
binding.bottomConstraintLayoutItemPostGalleryType,
|
||||
binding.upvoteButtonItemPostGalleryType,
|
||||
binding.scoreTextViewItemPostGalleryType,
|
||||
binding.downvoteButtonItemPostGalleryType,
|
||||
binding.commentsCountTextViewItemPostGalleryType,
|
||||
binding.saveButtonItemPostGalleryType,
|
||||
binding.shareButtonItemPostGalleryType);
|
||||
iconGifImageView,
|
||||
subredditTextView,
|
||||
userTextView,
|
||||
stickiedPostImageView,
|
||||
postTimeTextView,
|
||||
titleTextView,
|
||||
typeTextView,
|
||||
archivedImageView,
|
||||
lockedImageView,
|
||||
crosspostImageView,
|
||||
nsfwTextView,
|
||||
spoilerTextView,
|
||||
flairTextView,
|
||||
awardsTextView,
|
||||
bottomConstraintLayout,
|
||||
upvoteButton,
|
||||
scoreTextView,
|
||||
downvoteButton,
|
||||
commentsCountTextView,
|
||||
saveButton,
|
||||
shareButton,
|
||||
itemViewIsNotCardView);
|
||||
|
||||
binding.imageIndexTextViewItemPostGalleryType.setTextColor(mMediaIndicatorIconTint);
|
||||
binding.imageIndexTextViewItemPostGalleryType.setBackgroundColor(mMediaIndicatorBackgroundColor);
|
||||
binding.imageIndexTextViewItemPostGalleryType.setBorderColor(mMediaIndicatorBackgroundColor);
|
||||
this.frameLayout = frameLayout;
|
||||
this.galleryRecyclerView = galleryRecyclerView;
|
||||
this.imageIndexTextView = imageIndexTextView;
|
||||
this.noPreviewImageView = noPreviewImageView;
|
||||
|
||||
imageIndexTextView.setTextColor(mMediaIndicatorIconTint);
|
||||
imageIndexTextView.setBackgroundColor(mMediaIndicatorBackgroundColor);
|
||||
imageIndexTextView.setBorderColor(mMediaIndicatorBackgroundColor);
|
||||
|
||||
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
|
||||
mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale);
|
||||
binding.galleryRecyclerViewItemPostGalleryType.setAdapter(adapter);
|
||||
new PagerSnapHelper().attachToRecyclerView(binding.galleryRecyclerViewItemPostGalleryType);
|
||||
binding.galleryRecyclerViewItemPostGalleryType.setRecycledViewPool(mGalleryRecycledViewPool);
|
||||
galleryRecyclerView.setAdapter(adapter);
|
||||
new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView);
|
||||
galleryRecyclerView.setRecycledViewPool(mGalleryRecycledViewPool);
|
||||
SwipeLockLinearLayoutManager layoutManager = new SwipeLockLinearLayoutManager(
|
||||
mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() {
|
||||
@Override
|
||||
@ -3160,12 +3200,11 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
|
||||
@Override
|
||||
public void setSwipeLocked(boolean swipeLocked) {
|
||||
PostGalleryTypeViewHolder.this.swipeLocked = swipeLocked;
|
||||
mActivity.toggleViewPagerSwipeLock(swipeLocked);
|
||||
PostBaseGalleryTypeViewHolder.this.swipeLocked = swipeLocked;
|
||||
}
|
||||
});
|
||||
binding.galleryRecyclerViewItemPostGalleryType.setLayoutManager(layoutManager);
|
||||
binding.galleryRecyclerViewItemPostGalleryType.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
galleryRecyclerView.setLayoutManager(layoutManager);
|
||||
galleryRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
@ -3174,10 +3213,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
binding.imageIndexTextViewItemPostGalleryType.setText(mActivity.getString(R.string.image_index_in_gallery, layoutManager.findFirstVisibleItemPosition() + 1, post.getGallery().size()));
|
||||
imageIndexTextView.setText(mActivity.getString(R.string.image_index_in_gallery, layoutManager.findFirstVisibleItemPosition() + 1, post.getGallery().size()));
|
||||
}
|
||||
});
|
||||
binding.galleryRecyclerViewItemPostGalleryType.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
|
||||
galleryRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
|
||||
private float downX;
|
||||
private float downY;
|
||||
private boolean dragged;
|
||||
@ -3197,7 +3236,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
if (!dragged) {
|
||||
int index = layoutManager.findFirstVisibleItemPosition();
|
||||
int position = getBindingAdapterPosition();
|
||||
@ -3227,16 +3265,16 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
});
|
||||
|
||||
binding.getRoot().setOnTouchListener((view, motionEvent) -> {
|
||||
rootView.setOnTouchListener((view, motionEvent) -> {
|
||||
swipeLocked = false;
|
||||
return false;
|
||||
});
|
||||
binding.bottomConstraintLayoutItemPostGalleryType.setOnTouchListener((view, motionEvent) -> {
|
||||
bottomConstraintLayout.setOnTouchListener((view, motionEvent) -> {
|
||||
swipeLocked = false;
|
||||
return false;
|
||||
});
|
||||
|
||||
binding.noPreviewImageViewItemPostGalleryType.setOnClickListener(view -> {
|
||||
noPreviewImageView.setOnClickListener(view -> {
|
||||
int position = getBindingAdapterPosition();
|
||||
if (position < 0) {
|
||||
return;
|
||||
@ -3253,6 +3291,39 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
}
|
||||
|
||||
public class PostGalleryTypeViewHolder extends PostBaseGalleryTypeViewHolder {
|
||||
|
||||
PostGalleryTypeViewHolder(ItemPostGalleryTypeBinding binding) {
|
||||
super(binding.getRoot(),
|
||||
binding.iconGifImageViewItemPostGalleryType,
|
||||
binding.subredditNameTextViewItemPostGalleryType,
|
||||
binding.userTextViewItemPostGalleryType,
|
||||
binding.stickiedPostImageViewItemPostGalleryType,
|
||||
binding.postTimeTextViewItemPostGalleryType,
|
||||
binding.titleTextViewItemPostGalleryType,
|
||||
binding.typeTextViewItemPostGalleryType,
|
||||
binding.archivedImageViewItemPostGalleryType,
|
||||
binding.lockedImageViewItemPostGalleryType,
|
||||
binding.crosspostImageViewItemPostGalleryType,
|
||||
binding.nsfwTextViewItemPostGalleryType,
|
||||
binding.spoilerTextViewItemPostGalleryType,
|
||||
binding.flairTextViewItemPostGalleryType,
|
||||
binding.awardsTextViewItemPostGalleryType,
|
||||
binding.galleryFrameLayoutItemPostGalleryType,
|
||||
binding.galleryRecyclerViewItemPostGalleryType,
|
||||
binding.imageIndexTextViewItemPostGalleryType,
|
||||
binding.noPreviewImageViewItemPostGalleryType,
|
||||
binding.bottomConstraintLayoutItemPostGalleryType,
|
||||
binding.upvoteButtonItemPostGalleryType,
|
||||
binding.scoreTextViewItemPostGalleryType,
|
||||
binding.downvoteButtonItemPostGalleryType,
|
||||
binding.commentsCountTextViewItemPostGalleryType,
|
||||
binding.saveButtonItemPostGalleryType,
|
||||
binding.shareButtonItemPostGalleryType,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
class PostTextTypeViewHolder extends PostBaseViewHolder {
|
||||
@BindView(R.id.icon_gif_image_view_item_post_text_type)
|
||||
AspectRatioGifImageView iconGifImageView;
|
||||
@ -4571,6 +4642,41 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
|
||||
}
|
||||
}
|
||||
|
||||
public class PostCard2GalleryTypeViewHolder extends PostBaseGalleryTypeViewHolder {
|
||||
|
||||
PostCard2GalleryTypeViewHolder(ItemPostCard2GalleryTypeBinding binding) {
|
||||
super(binding.getRoot(),
|
||||
binding.iconGifImageViewItemPostCard2GalleryType,
|
||||
binding.subredditNameTextViewItemPostCard2GalleryType,
|
||||
binding.userTextViewItemPostCard2GalleryType,
|
||||
binding.stickiedPostImageViewItemPostCard2GalleryType,
|
||||
binding.postTimeTextViewItemPostCard2GalleryType,
|
||||
binding.titleTextViewItemPostCard2GalleryType,
|
||||
binding.typeTextViewItemPostCard2GalleryType,
|
||||
binding.archivedImageViewItemPostCard2GalleryType,
|
||||
binding.lockedImageViewItemPostCard2GalleryType,
|
||||
binding.crosspostImageViewItemPostCard2GalleryType,
|
||||
binding.nsfwTextViewItemPostCard2GalleryType,
|
||||
binding.spoilerCustomTextViewItemPostCard2GalleryType,
|
||||
binding.flairCustomTextViewItemPostCard2GalleryType,
|
||||
binding.awardsTextViewItemPostCard2GalleryType,
|
||||
binding.galleryFrameLayoutItemPostCard2GalleryType,
|
||||
binding.galleryRecyclerViewItemPostCard2GalleryType,
|
||||
binding.imageIndexTextViewItemPostCard2GalleryType,
|
||||
binding.noPreviewImageViewItemPostCard2GalleryType,
|
||||
binding.bottomConstraintLayoutItemPostCard2GalleryType,
|
||||
binding.upvoteButtonItemPostCard2GalleryType,
|
||||
binding.scoreTextViewItemPostCard2GalleryType,
|
||||
binding.downvoteButtonItemPostCard2GalleryType,
|
||||
binding.commentsCountTextViewItemPostCard2GalleryType,
|
||||
binding.saveButtonItemPostCard2GalleryType,
|
||||
binding.shareButtonItemPostCard2GalleryType,
|
||||
true);
|
||||
|
||||
binding.dividerItemPostCard2GalleryType.setBackgroundColor(mDividerColor);
|
||||
}
|
||||
}
|
||||
|
||||
class PostCard2TextTypeViewHolder extends PostBaseViewHolder {
|
||||
@BindView(R.id.icon_gif_image_view_item_post_card_2_text)
|
||||
AspectRatioGifImageView iconGifImageView;
|
||||
|
@ -1058,8 +1058,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
if (!(viewHolder instanceof PostRecyclerViewAdapter.PostBaseViewHolder) &&
|
||||
!(viewHolder instanceof PostRecyclerViewAdapter.PostCompactBaseViewHolder)) {
|
||||
return makeMovementFlags(0, 0);
|
||||
} else if (viewHolder instanceof PostRecyclerViewAdapter.PostGalleryTypeViewHolder) {
|
||||
if (((PostRecyclerViewAdapter.PostGalleryTypeViewHolder) viewHolder).isSwipeLocked()) {
|
||||
} else if (viewHolder instanceof PostRecyclerViewAdapter.PostBaseGalleryTypeViewHolder) {
|
||||
if (((PostRecyclerViewAdapter.PostBaseGalleryTypeViewHolder) viewHolder).isSwipeLocked()) {
|
||||
return makeMovementFlags(0, 0);
|
||||
}
|
||||
|
||||
|
309
app/src/main/res/layout/item_post_card_2_gallery_type.xml
Normal file
309
app/src/main/res/layout/item_post_card_2_gallery_type.xml
Normal file
@ -0,0 +1,309 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingTop="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
style="?attr/materialCardViewElevatedStyle">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/gallery_frame_layout_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/gallery_recycler_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/image_index_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_preview_image_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:scaleType="center"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="?attr/title_font_18"
|
||||
android:fontFamily="?attr/title_font_family" />
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:flRowVerticalGravity="center"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/type_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/gallery"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/spoiler_custom_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/spoiler"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/nsfw_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:text="@string/nsfw"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/flair_custom_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<com.libRG.CustomTextView
|
||||
android:id="@+id/awards_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone"
|
||||
app:lib_setRadius="6dp"
|
||||
app:lib_setRoundedView="true"
|
||||
app:lib_setShape="rectangle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archived_image_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_archive_outline"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/locked_image_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_outline_lock_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crosspost_image_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/crosspost"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stickied_post_image_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/link_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_12"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/post_time_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<com.nex3z.flowlayout.FlowLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
app:flRowVerticalGravity="center"
|
||||
app:flChildSpacing="16dp"
|
||||
app:flChildSpacingForLastRow="align"
|
||||
app:flRowSpacing="8dp">
|
||||
|
||||
<ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView
|
||||
android:id="@+id/icon_gif_image_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family" />
|
||||
|
||||
</com.nex3z.flowlayout.FlowLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/bottom_constraint_layout_item_post_card_2_gallery_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/upvote_button_item_post_card_2_gallery_type"
|
||||
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_card_2_gallery_type"
|
||||
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/upvote_button_item_post_card_2_gallery_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/downvote_button_item_post_card_2_gallery_type"
|
||||
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_card_2_gallery_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comments_count_text_view_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:drawableStart="@drawable/ic_comment_grey_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/downvote_button_item_post_card_2_gallery_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button_item_post_card_2_gallery_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/comments_count_text_view_item_post_card_2_gallery_type"
|
||||
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_card_2_gallery_type" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_button_item_post_card_2_gallery_type"
|
||||
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:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_item_post_card_2_gallery_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:paddingBottom="8dp" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user