diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-10-15 12:28:37 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-10-15 12:28:37 +0000 |
commit | 3b0ba561b2c8d66c6785618ffa876313166a2e31 (patch) | |
tree | d3beeb1867b7b08aa377bdf212b8a7e178b4bad6 | |
parent | 2fd0e2e0e5af5f61cc8af54f0f96a12affda0d6d (diff) | |
download | infinity-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.
11 files changed, 33 insertions, 57 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); diff --git a/app/src/main/res/drawable-night/ic_gallery_reverse_color_24dp.xml b/app/src/main/res/drawable-night/ic_gallery_reverse_color_24dp.xml deleted file mode 100644 index 74716ba7..00000000 --- a/app/src/main/res/drawable-night/ic_gallery_reverse_color_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ -<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> diff --git a/app/src/main/res/drawable-night/ic_play_circle_36dp.xml b/app/src/main/res/drawable-night/ic_play_circle_36dp.xml deleted file mode 100644 index 2471417e..00000000 --- a/app/src/main/res/drawable-night/ic_play_circle_36dp.xml +++ /dev/null @@ -1,4 +0,0 @@ -<vector android:height="36dp" android:viewportHeight="24" - android:viewportWidth="24" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android"> - <path android:fillColor="#FF000000" android:pathData="M10,16.5l6,-4.5 -6,-4.5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/> -</vector> diff --git a/app/src/main/res/drawable/ic_gallery_reverse_color_24dp.xml b/app/src/main/res/drawable/ic_gallery_reverse_color_24dp.xml deleted file mode 100644 index d54dba10..00000000 --- a/app/src/main/res/drawable/ic_gallery_reverse_color_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ -<vector android:height="24dp" android:tint="#FFFFFF" - 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> diff --git a/app/src/main/res/drawable/play_button_round_background.xml b/app/src/main/res/drawable/play_button_round_background.xml index f59e3ab5..816bfa2e 100644 --- a/app/src/main/res/drawable/play_button_round_background.xml +++ b/app/src/main/res/drawable/play_button_round_background.xml @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> - <shape android:shape="oval"> - <solid android:color="@color/playButtonBackgroundColor" /> - </shape> + <shape android:shape="oval" /> </item> - </layer-list>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_submit_crosspost.xml b/app/src/main/res/layout/activity_submit_crosspost.xml index b4e555d1..345de3ae 100644 --- a/app/src/main/res/layout/activity_submit_crosspost.xml +++ b/app/src/main/res/layout/activity_submit_crosspost.xml @@ -216,7 +216,6 @@ android:layout_margin="16dp" android:layout_gravity="start" android:background="@drawable/play_button_round_background" - android:src="@drawable/ic_play_circle_36dp" android:visibility="gone" /> </FrameLayout> diff --git a/app/src/main/res/layout/item_post_compact.xml b/app/src/main/res/layout/item_post_compact.xml index 06c00131..0371a939 100644 --- a/app/src/main/res/layout/item_post_compact.xml +++ b/app/src/main/res/layout/item_post_compact.xml @@ -234,7 +234,6 @@ android:layout_gravity="center" android:layout_margin="0dp" android:background="@drawable/play_button_round_background" - android:src="@drawable/ic_play_circle_36dp" android:visibility="gone" /> </FrameLayout> diff --git a/app/src/main/res/layout/item_post_compact_right_thumbnail.xml b/app/src/main/res/layout/item_post_compact_right_thumbnail.xml index 6b1b7abf..f151c98d 100644 --- a/app/src/main/res/layout/item_post_compact_right_thumbnail.xml +++ b/app/src/main/res/layout/item_post_compact_right_thumbnail.xml @@ -103,7 +103,6 @@ android:layout_gravity="center" android:layout_margin="0dp" android:background="@drawable/play_button_round_background" - android:src="@drawable/ic_play_circle_36dp" android:visibility="gone" /> </FrameLayout> diff --git a/app/src/main/res/layout/item_post_detail_gallery.xml b/app/src/main/res/layout/item_post_detail_gallery.xml index 1a345dab..5a53410d 100644 --- a/app/src/main/res/layout/item_post_detail_gallery.xml +++ b/app/src/main/res/layout/item_post_detail_gallery.xml @@ -227,7 +227,7 @@ android:layout_gravity="start" android:scaleType="center" android:background="@drawable/play_button_round_background" - android:src="@drawable/ic_gallery_reverse_color_24dp" /> + android:src="@drawable/ic_gallery_24dp" /> </FrameLayout> |