From 3b0ba561b2c8d66c6785618ffa876313166a2e31 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 15 Oct 2021 20:28:37 +0800 Subject: Fix some issues related to media indicator icon and themeing. --- .../activities/SubmitCrosspostActivity.java | 29 ++++++++---------- .../adapters/PostDetailRecyclerViewAdapter.java | 2 +- .../adapters/PostRecyclerViewAdapter.java | 35 +++++++++++----------- 3 files changed, 31 insertions(+), 35 deletions(-) (limited to 'app/src/main/java/ml/docilealligator') 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() { - @Override - public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition 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 previews = post.getPreviews(); if (previews != null && !previews.isEmpty()) { @@ -1217,8 +1213,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter