disable gif animation in thumbnails

This commit is contained in:
Akinwale Ariwodola 2020-05-27 00:56:07 +01:00
parent cbf2aa2311
commit 59ae6340e1
6 changed files with 9 additions and 7 deletions

View file

@ -97,7 +97,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
vh.titleView.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle()); vh.titleView.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
String thumbnailUrl = claim.getThumbnailUrl(); String thumbnailUrl = claim.getThumbnailUrl();
if (!Helper.isNullOrEmpty(thumbnailUrl) && context != null) { if (!Helper.isNullOrEmpty(thumbnailUrl) && context != null) {
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView); Glide.with(context.getApplicationContext()).asBitmap().load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
} }
vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE); vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE);
vh.thumbnailView.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.GONE : View.VISIBLE); vh.thumbnailView.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.GONE : View.VISIBLE);

View file

@ -8,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -419,6 +418,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
long duration = item.getDuration(); long duration = item.getDuration();
if (!Helper.isNullOrEmpty(thumbnailUrl)) { if (!Helper.isNullOrEmpty(thumbnailUrl)) {
Glide.with(context.getApplicationContext()). Glide.with(context.getApplicationContext()).
asBitmap().
load(thumbnailUrl). load(thumbnailUrl).
centerCrop(). centerCrop().
placeholder(R.drawable.bg_thumbnail_placeholder). placeholder(R.drawable.bg_thumbnail_placeholder).

View file

@ -95,6 +95,7 @@ public class EditorsChoiceItemAdapter extends RecyclerView.Adapter<EditorsChoice
vh.descriptionView.setText(item.getDescription()); vh.descriptionView.setText(item.getDescription());
if (!Helper.isNullOrEmpty(item.getThumbnailUrl())) { if (!Helper.isNullOrEmpty(item.getThumbnailUrl())) {
Glide.with(context.getApplicationContext()). Glide.with(context.getApplicationContext()).
asBitmap().
load(item.getThumbnailUrl()). load(item.getThumbnailUrl()).
centerCrop(). centerCrop().
placeholder(R.drawable.bg_thumbnail_placeholder). placeholder(R.drawable.bg_thumbnail_placeholder).

View file

@ -97,7 +97,7 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
vh.alphaView.setText(claim.getName().substring(1, 2)); vh.alphaView.setText(claim.getName().substring(1, 2));
if (!Helper.isNullOrEmpty(thumbnailUrl)) { if (!Helper.isNullOrEmpty(thumbnailUrl)) {
vh.thumbnailView.setVisibility(View.VISIBLE); vh.thumbnailView.setVisibility(View.VISIBLE);
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView); Glide.with(context.getApplicationContext()).asBitmap().load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
} else { } else {
vh.thumbnailView.setVisibility(View.GONE); vh.thumbnailView.setVisibility(View.GONE);
} }

View file

@ -258,7 +258,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
} else { } else {
View root = getView(); View root = getView();
if (root != null) { if (root != null) {
Snackbar.make(root, R.string.channel_failed_delete, Toast.LENGTH_LONG). Snackbar.make(root, R.string.channel_failed_delete, Snackbar.LENGTH_LONG).
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show(); setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
} }
} }
@ -426,7 +426,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
Glide.with(context.getApplicationContext()).load(coverUrl).centerCrop().into(imageCover); Glide.with(context.getApplicationContext()).load(coverUrl).centerCrop().into(imageCover);
} }
if (context != null && !Helper.isNullOrEmpty(thumbnailUrl)) { if (context != null && !Helper.isNullOrEmpty(thumbnailUrl)) {
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(imageThumbnail); Glide.with(context.getApplicationContext()).asBitmap().load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(imageThumbnail);
noThumbnailView.setVisibility(View.GONE); noThumbnailView.setVisibility(View.GONE);
} else { } else {
imageThumbnail.setVisibility(View.GONE); imageThumbnail.setVisibility(View.GONE);

View file

@ -9,6 +9,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
@ -30,10 +31,10 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.media.session.MediaButtonReceiver;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -1210,7 +1211,7 @@ public class FileViewFragment extends BaseFragment implements
@Override @Override
public void run() { public void run() {
if (claim != null && context != null && thumbnailView != null) { if (claim != null && context != null && thumbnailView != null) {
Glide.with(context.getApplicationContext()).load(claim.getThumbnailUrl()).centerCrop().into(thumbnailView); Glide.with(context.getApplicationContext()).asBitmap().load(claim.getThumbnailUrl()).centerCrop().into(thumbnailView);
} }
} }
}, 200); }, 200);