aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java23
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java25
3 files changed, 9 insertions, 43 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
index 863d4484..288788eb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
@@ -848,10 +848,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
}
- if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostWithPreviewTypeViewHolder) holder).binding.progressBarItemPostWithPreview.setVisibility(View.VISIBLE);
- }
-
if (mDataSavingMode && mDisableImagePreview) {
((PostWithPreviewTypeViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostWithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
@@ -1029,12 +1025,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
}
- if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.VISIBLE);
- }
-
if (mDataSavingMode && mDisableImagePreview) {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_outline_video_24dp);
@@ -1046,7 +1037,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_link);
}
} else if (mDataSavingMode && mOnlyDisablePreviewInVideoAndGifPosts && (post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE)) {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setVisibility(View.VISIBLE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_outline_video_24dp);
((PostCard2WithPreviewViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostCard2WithPreview.setVisibility(View.GONE);
@@ -1076,7 +1066,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
});
} else {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_outline_video_24dp);
@@ -1420,7 +1409,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
int height = (int) (400 * mScale);
@@ -1460,7 +1448,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
@@ -1491,7 +1478,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
@@ -1521,7 +1507,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator));
@@ -1847,10 +1832,6 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
}
- if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostMaterial3CardWithPreviewViewHolder) holder).binding.progressBarItemPostCard3WithPreview.setVisibility(View.VISIBLE);
- }
-
if (mDataSavingMode && mDisableImagePreview) {
((PostMaterial3CardWithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard3WithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
@@ -1967,6 +1948,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
private void loadImage(final RecyclerView.ViewHolder holder) {
if (holder instanceof PostWithPreviewTypeViewHolder) {
+ ((PostWithPreviewTypeViewHolder) holder).binding.progressBarItemPostWithPreview.setVisibility(View.VISIBLE);
Post post = ((PostWithPreviewTypeViewHolder) holder).post;
Post.Preview preview = ((PostWithPreviewTypeViewHolder) holder).preview;
if (preview != null) {
@@ -2006,6 +1988,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
}
} else if (holder instanceof PostGalleryViewHolder) {
+ ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
Post post = ((PostGalleryViewHolder) holder).post;
Post.Preview preview = ((PostGalleryViewHolder) holder).preview;
if (preview != null) {
@@ -2026,6 +2009,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
}
} else if (holder instanceof PostCard2WithPreviewViewHolder) {
+ ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.VISIBLE);
Post post = ((PostCard2WithPreviewViewHolder) holder).post;
Post.Preview preview = ((PostCard2WithPreviewViewHolder) holder).preview;
if (preview != null) {
@@ -2046,6 +2030,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
}
}
} else if (holder instanceof PostMaterial3CardWithPreviewViewHolder) {
+ ((PostMaterial3CardWithPreviewViewHolder) holder).binding.progressBarItemPostCard3WithPreview.setVisibility(View.VISIBLE);
Post post = ((PostMaterial3CardWithPreviewViewHolder) holder).post;
Post.Preview preview = ((PostMaterial3CardWithPreviewViewHolder) holder).preview;
if (preview != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
index 959a4cd3..90696fcd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -1276,8 +1276,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mPost.getScore() + mPost.getVoteType()));
}
- mPostDetailRecyclerViewAdapterCallback.updatePost(mPost);
-
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingWithoutPositionListener() {
@Override
public void onVoteThingSuccess() {
@@ -1370,8 +1368,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mPost.getScore() + mPost.getVoteType()));
}
- mPostDetailRecyclerViewAdapterCallback.updatePost(mPost);
-
VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingWithoutPositionListener() {
@Override
public void onVoteThingSuccess() {
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 4f5dcdb7..14859bba 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -893,10 +893,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
- if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostWithPreviewTypeViewHolder) holder).binding.progressBarItemPostWithPreview.setVisibility(View.VISIBLE);
- }
-
if (mDataSavingMode && mDisableImagePreview) {
((PostWithPreviewTypeViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostWithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
@@ -1081,12 +1077,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCard2WithPreviewViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostCard2WithPreview.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp));
}
- if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.VISIBLE);
- }
-
if (mDataSavingMode && mDisableImagePreview) {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_outline_video_24dp);
@@ -1100,7 +1091,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_gallery_24dp);
}
} else if (mDataSavingMode && mOnlyDisablePreviewInVideoAndGifPosts && (post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE)) {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setVisibility(View.VISIBLE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_outline_video_24dp);
((PostCard2WithPreviewViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostCard2WithPreview.setVisibility(View.GONE);
@@ -1130,7 +1120,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
});
} else {
- ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.GONE);
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
((PostCard2WithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard2WithPreview.setImageResource(R.drawable.ic_outline_video_24dp);
@@ -1506,7 +1495,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
if (mFixedHeightPreviewInCard || (preview.getPreviewWidth() <= 0 || preview.getPreviewHeight() <= 0)) {
int height = (int) (400 * mScale);
@@ -1538,7 +1526,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
@@ -1569,7 +1556,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
@@ -1599,7 +1585,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostGalleryViewHolder) holder).preview = preview;
if (preview != null) {
((PostGalleryViewHolder) holder).imageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setVisibility(View.VISIBLE);
((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_link_post_type_indicator));
@@ -1924,7 +1909,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostMaterial3CardWithPreviewViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostCard3WithPreview.setVisibility(View.VISIBLE);
((PostMaterial3CardWithPreviewViewHolder) holder).binding.videoOrGifIndicatorImageViewItemPostCard3WithPreview.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
}
- }else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
+ } else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
((PostMaterial3CardWithPreviewViewHolder) holder).binding.linkTextViewItemPostCard3WithPreview.setVisibility(View.VISIBLE);
String domain = Uri.parse(post.getUrl()).getHost();
((PostMaterial3CardWithPreviewViewHolder) holder).binding.linkTextViewItemPostCard3WithPreview.setText(domain);
@@ -1934,10 +1919,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
- if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
- ((PostMaterial3CardWithPreviewViewHolder) holder).binding.progressBarItemPostCard3WithPreview.setVisibility(View.VISIBLE);
- }
-
if (mDataSavingMode && mDisableImagePreview) {
((PostMaterial3CardWithPreviewViewHolder) holder).binding.imageViewNoPreviewGalleryItemPostCard3WithPreview.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.VIDEO_TYPE) {
@@ -2057,6 +2038,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private void loadImage(final RecyclerView.ViewHolder holder) {
if (holder instanceof PostWithPreviewTypeViewHolder) {
+ ((PostWithPreviewTypeViewHolder) holder).binding.progressBarItemPostWithPreview.setVisibility(View.VISIBLE);
Post post = ((PostWithPreviewTypeViewHolder) holder).post;
Post.Preview preview = ((PostWithPreviewTypeViewHolder) holder).preview;
if (preview != null) {
@@ -2096,6 +2078,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
} else if (holder instanceof PostGalleryViewHolder) {
+ ((PostGalleryViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
Post post = ((PostGalleryViewHolder) holder).post;
Post.Preview preview = ((PostGalleryViewHolder) holder).preview;
if (preview != null) {
@@ -2116,6 +2099,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
} else if (holder instanceof PostCard2WithPreviewViewHolder) {
+ ((PostCard2WithPreviewViewHolder) holder).binding.progressBarItemPostCard2WithPreview.setVisibility(View.VISIBLE);
Post post = ((PostCard2WithPreviewViewHolder) holder).post;
Post.Preview preview = ((PostCard2WithPreviewViewHolder) holder).preview;
if (preview != null) {
@@ -2136,6 +2120,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
} else if (holder instanceof PostMaterial3CardWithPreviewViewHolder) {
+ ((PostMaterial3CardWithPreviewViewHolder) holder).binding.progressBarItemPostCard3WithPreview.setVisibility(View.VISIBLE);
Post post = ((PostMaterial3CardWithPreviewViewHolder) holder).post;
Post.Preview preview = ((PostMaterial3CardWithPreviewViewHolder) holder).preview;
if (preview != null) {