aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-10-15 12:28:37 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-10-15 12:28:37 +0000
commit3b0ba561b2c8d66c6785618ffa876313166a2e31 (patch)
treed3beeb1867b7b08aa377bdf212b8a7e178b4bad6 /app/src/main/java/ml
parent2fd0e2e0e5af5f61cc8af54f0f96a12affda0d6d (diff)
downloadinfinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.tar
infinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.tar.gz
infinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.tar.bz2
infinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.tar.lz
infinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.tar.xz
infinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.tar.zst
infinity-for-reddit-3b0ba561b2c8d66c6785618ffa876313166a2e31.zip
Fix some issues related to media indicator icon and themeing.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java29
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java35
3 files changed, 31 insertions, 35 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java
index d6c5e68f..b5ac9689 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java
@@ -2,8 +2,10 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
+import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
@@ -265,7 +267,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
contentTextView.setVisibility(View.VISIBLE);
contentTextView.setText(post.getUrl());
- } else if (post.getPostType() == Post.GIF_TYPE || post.getPostType() == Post.GALLERY_TYPE || post.getPostType() == Post.IMAGE_TYPE) {
+ } else {
Post.Preview preview = getPreview(post);
if (preview != null) {
frameLayout.setVisibility(View.VISIBLE);
@@ -280,23 +282,14 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
}
});
- }
- } else if (post.getPostType() == Post.VIDEO_TYPE) {
- Post.Preview preview = getPreview(post);
- if (preview != null) {
- frameLayout.setVisibility(View.VISIBLE);
- mGlide.asBitmap().load(preview.getPreviewUrl()).into(new CustomTarget<Bitmap>() {
- @Override
- public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
- imageView.setImage(ImageSource.bitmap(resource));
- }
-
- @Override
- public void onLoadCleared(@Nullable Drawable placeholder) {
- }
- });
- playButton.setVisibility(View.VISIBLE);
+ if (post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE) {
+ playButton.setVisibility(View.VISIBLE);
+ playButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_play_circle_36dp));
+ } else if (post.getPostType() == Post.GALLERY_TYPE) {
+ playButton.setVisibility(View.VISIBLE);
+ playButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_gallery_24dp));
+ }
}
}
@@ -423,6 +416,8 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
titleEditText.setHintTextColor(secondaryTextColor);
contentTextView.setTextColor(primaryTextColor);
contentTextView.setHintTextColor(secondaryTextColor);
+ playButton.setColorFilter(mCustomThemeWrapper.getMediaIndicatorIconColor(), PorterDuff.Mode.SRC_IN);
+ playButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getMediaIndicatorBackgroundColor()));
}
private void displaySubredditIcon() {
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 064ede1d..d083a0bc 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -780,7 +780,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
if (!mHidePostType) {
((PostDetailNoPreviewViewHolder) holder).mTypeTextView.setText(R.string.gallery);
}
- ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostDetailNoPreviewViewHolder) holder).mNoPreviewPostTypeImageView.setImageResource(R.drawable.ic_gallery_24dp);
break;
}
}
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 b35eadaf..7556cba0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -11,7 +11,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -44,9 +43,7 @@ import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
-import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.source.TrackGroupArray;
-import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.PlayerView;
@@ -55,7 +52,6 @@ import com.libRG.CustomTextView;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
-import java.util.List;
import java.util.Locale;
import java.util.concurrent.Executor;
@@ -744,7 +740,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} 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));
+ ((PostWithPreviewTypeViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp));
}
if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
@@ -762,7 +758,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} else if (post.getPostType() == Post.LINK_TYPE) {
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_link);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
- ((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
} else if (mDataSavingMode && mOnlyDisablePreviewInVideoAndGifPosts && (post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE)) {
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setVisibility(View.VISIBLE);
@@ -794,7 +790,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} else if (post.getPostType() == Post.LINK_TYPE) {
((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_link);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
- ((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostWithPreviewTypeViewHolder) holder).noPreviewLinkImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
}
}
@@ -876,7 +872,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} 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));
+ ((PostCard2WithPreviewViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp));
}
if (post.getPostType() != Post.NO_PREVIEW_LINK_TYPE) {
@@ -895,7 +891,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} else if (post.getPostType() == Post.LINK_TYPE) {
((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_link);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
- ((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
} else if (mDataSavingMode && mOnlyDisablePreviewInVideoAndGifPosts && (post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE)) {
((PostCard2WithPreviewViewHolder) holder).progressBar.setVisibility(View.GONE);
@@ -929,7 +925,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} else if (post.getPostType() == Post.LINK_TYPE) {
((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_link);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
- ((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostCard2WithPreviewViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
}
}
@@ -1155,7 +1151,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).relativeLayout.setVisibility(View.VISIBLE);
if (post.getPostType() == Post.GALLERY_TYPE && post.getPreviews() != null && post.getPreviews().isEmpty()) {
((PostCompactBaseViewHolder) holder).noPreviewPostImageFrameLayout.setVisibility(View.VISIBLE);
- ((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
ArrayList<Post.Preview> previews = post.getPreviews();
if (previews != null && !previews.isEmpty()) {
@@ -1217,8 +1213,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_image_24dp);
} else {
((PostCompactBaseViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
+ ((PostCompactBaseViewHolder) holder).playButtonImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
}
-
break;
case Post.VIDEO_TYPE:
((PostCompactBaseViewHolder) holder).typeTextView.setText(R.string.video);
@@ -1227,8 +1223,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_outline_video_24dp);
} else {
((PostCompactBaseViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
+ ((PostCompactBaseViewHolder) holder).playButtonImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_play_circle_36dp));
}
-
break;
case Post.NO_PREVIEW_LINK_TYPE:
((PostCompactBaseViewHolder) holder).typeTextView.setText(R.string.link);
@@ -1244,7 +1240,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((PostCompactBaseViewHolder) holder).typeTextView.setText(R.string.gallery);
if (mDataSavingMode && mDisableImagePreview) {
((PostCompactBaseViewHolder) holder).noPreviewPostImageFrameLayout.setVisibility(View.VISIBLE);
- ((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostCompactBaseViewHolder) holder).noPreviewPostImageView.setImageResource(R.drawable.ic_gallery_24dp);
+ } else {
+ ((PostCompactBaseViewHolder) holder).playButtonImageView.setVisibility(View.VISIBLE);
+ ((PostCompactBaseViewHolder) holder).playButtonImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp));
}
break;
case Post.TEXT_TYPE:
@@ -1304,7 +1303,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
} else if (post.getPostType() == Post.LINK_TYPE) {
((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_link);
} else if (post.getPostType() == Post.GALLERY_TYPE) {
- ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_image_24dp);
}
@@ -1399,7 +1398,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
((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_gallery_reverse_color_24dp));
+ ((PostGalleryViewHolder) holder).videoOrGifIndicatorImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_gallery_24dp));
Post.Preview preview = getSuitablePreview(post.getPreviews());
if (preview != null) {
@@ -1416,7 +1415,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
loadImage(holder, post, preview);
} else {
((PostGalleryViewHolder) holder).noPreviewImageView.setVisibility(View.VISIBLE);
- ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_reverse_color_24dp);
+ ((PostGalleryViewHolder) holder).noPreviewImageView.setImageResource(R.drawable.ic_gallery_24dp);
}
break;
}
@@ -3159,6 +3158,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
lockedImageView.setColorFilter(mLockedIconTint, PorterDuff.Mode.SRC_IN);
crosspostImageView.setColorFilter(mCrosspostIconTint, PorterDuff.Mode.SRC_IN);
linkTextView.setTextColor(mSecondaryTextColor);
+ playButtonImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN);
+ playButtonImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor));
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor);
noPreviewLinkImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);