mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Fix some issues related to media indicator icon and themeing.
This commit is contained in:
parent
2fd0e2e0e5
commit
3b0ba561b2
@ -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() {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user