aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-30 10:08:48 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-30 10:08:48 +0000
commit028cd84cbae7e488da7cd55d080b92c00c9e95b3 (patch)
tree93084b0d8dad54c8e1926dc71934d471b10330ca /app
parent720aa0b6bde98c272878fd22a4f705f5b31183db (diff)
downloadinfinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.tar
infinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.tar.gz
infinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.tar.bz2
infinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.tar.lz
infinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.tar.xz
infinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.tar.zst
infinity-for-reddit-028cd84cbae7e488da7cd55d080b92c00c9e95b3.zip
Fix issues in PostCard2VideoAutoplayViewHolder.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java23
1 files changed, 15 insertions, 8 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 2ab23dca..9d08d880 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -1887,15 +1887,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostBaseViewHolder) holder).markPostRead(post, false);
}
}
- ((PostBaseViewHolder) holder).itemView.setVisibility(View.VISIBLE);
+ holder.itemView.setVisibility(View.VISIBLE);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams();
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
if (holder instanceof PostCard2VideoAutoplayViewHolder || holder instanceof PostCard2WithPreviewViewHolder) {
int paddingPixel = (int) Utils.convertDpToPixel(16, mActivity);
- ((PostBaseViewHolder) holder).itemView.setPadding(0, paddingPixel, 0, 0);
+ holder.itemView.setPadding(0, paddingPixel, 0, 0);
} else if (holder instanceof PostCard2TextTypeViewHolder) {
int paddingPixel = (int) Utils.convertDpToPixel(12, mActivity);
- ((PostBaseViewHolder) holder).itemView.setPadding(0, paddingPixel, 0, 0);
+ holder.itemView.setPadding(0, paddingPixel, 0, 0);
} else {
int marginPixel = (int) Utils.convertDpToPixel(8, mActivity);
params.topMargin = marginPixel;
@@ -1903,9 +1903,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
holder.itemView.setLayoutParams(params);
if (((PostBaseViewHolder) holder).itemViewIsNotCardView) {
- ((PostBaseViewHolder) holder).itemView.setBackgroundColor(mCardViewBackgroundColor);
+ holder.itemView.setBackgroundColor(mCardViewBackgroundColor);
} else {
- ((PostBaseViewHolder) holder).itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor));
+ holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor));
}
((PostBaseViewHolder) holder).titleTextView.setTextColor(mPostTitleColor);
if (holder instanceof PostVideoAutoplayViewHolder) {
@@ -1930,6 +1930,16 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostTextTypeViewHolder) holder).contentTextView.setText("");
((PostTextTypeViewHolder) holder).contentTextView.setTextColor(mPostContentColor);
((PostTextTypeViewHolder) holder).contentTextView.setVisibility(View.GONE);
+ } else if (holder instanceof PostCard2VideoAutoplayViewHolder) {
+ ((PostCard2VideoAutoplayViewHolder) holder).mediaUri = null;
+ if (((PostCard2VideoAutoplayViewHolder) holder).fetchGfycatOrRedgifsVideoLinks != null) {
+ ((PostCard2VideoAutoplayViewHolder) holder).fetchGfycatOrRedgifsVideoLinks.cancel();
+ }
+ ((PostCard2VideoAutoplayViewHolder) holder).errorLoadingGfycatImageView.setVisibility(View.GONE);
+ ((PostCard2VideoAutoplayViewHolder) holder).muteButton.setVisibility(View.GONE);
+ ((PostCard2VideoAutoplayViewHolder) holder).resetVolume();
+ mGlide.clear(((PostCard2VideoAutoplayViewHolder) holder).previewImageView);
+ ((PostCard2VideoAutoplayViewHolder) holder).previewImageView.setVisibility(View.GONE);
} else if (holder instanceof PostCard2WithPreviewViewHolder) {
mGlide.clear(((PostCard2WithPreviewViewHolder) holder).imageView);
((PostCard2WithPreviewViewHolder) holder).imageView.setVisibility(View.GONE);
@@ -4151,9 +4161,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public void play() {
if (helper != null && mediaUri != null) {
- if (mFragment.getMasterMutingOption() != null) {
- helper.setVolume(mFragment.getMasterMutingOption() ? 0f : 1f);
- }
helper.play();
}
}