use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class ApGlideModule method applyOptions.
@Override
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
@SuppressLint("UsableSpace") long spaceAvailable = context.getCacheDir().getUsableSpace();
long imageCacheSize = (spaceAvailable > 2 * GIGABYTES) ? (250 * MEGABYTES) : (50 * MEGABYTES);
Log.d(TAG, "Free space on cache dir: " + spaceAvailable + ", using image cache size: " + imageCacheSize);
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, imageCacheSize));
}
use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class FeedInfoFragment method showFeed.
private void showFeed() {
Log.d(TAG, "Language is " + feed.getLanguage());
Log.d(TAG, "Author is " + feed.getAuthor());
Log.d(TAG, "URL is " + feed.getDownload_url());
Glide.with(getContext()).load(feed.getImageUrl()).apply(new RequestOptions().placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate()).into(imgvCover);
Glide.with(getContext()).load(feed.getImageUrl()).apply(new RequestOptions().placeholder(R.color.image_readability_tint).error(R.color.image_readability_tint).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).transform(new FastBlurTransformation()).dontAnimate()).into(imgvBackground);
txtvTitle.setText(feed.getTitle());
txtvTitle.setMaxLines(6);
String description = HtmlToPlainText.getPlainText(feed.getDescription());
txtvDescription.setText(description);
if (!TextUtils.isEmpty(feed.getAuthor())) {
txtvAuthorHeader.setText(feed.getAuthor());
}
txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}");
if (feed.getPaymentLinks() == null || feed.getPaymentLinks().size() == 0) {
lblSupport.setVisibility(View.GONE);
txtvFundingUrl.setVisibility(View.GONE);
} else {
lblSupport.setVisibility(View.VISIBLE);
ArrayList<FeedFunding> fundingList = feed.getPaymentLinks();
StringBuilder str = new StringBuilder();
HashSet<String> seen = new HashSet<String>();
for (FeedFunding funding : fundingList) {
if (seen.contains(funding.url)) {
continue;
}
seen.add(funding.url);
str.append(funding.content.isEmpty() ? getContext().getResources().getString(R.string.support_podcast) : funding.content).append(" ").append(funding.url);
str.append("\n");
}
str = new StringBuilder(StringUtils.trim(str.toString()));
txtvFundingUrl.setText(str.toString());
}
Iconify.addIcons(txtvUrl);
refreshToolbarState();
}
use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class FeedItemlistFragment method loadFeedImage.
private void loadFeedImage() {
Glide.with(getActivity()).load(feed.getImageUrl()).apply(new RequestOptions().placeholder(R.color.image_readability_tint).error(R.color.image_readability_tint).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).transform(new FastBlurTransformation()).dontAnimate()).into(imgvBackground);
Glide.with(getActivity()).load(feed.getImageUrl()).apply(new RequestOptions().placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate()).into(imgvCover);
}
use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class PodcastListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
GpodnetPodcast podcast = getItem(position);
// Inflate Layout
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.gpodnet_podcast_listitem, parent, false);
holder.image = convertView.findViewById(R.id.imgvCover);
holder.title = convertView.findViewById(R.id.txtvTitle);
holder.subscribers = convertView.findViewById(R.id.txtvSubscribers);
holder.author = convertView.findViewById(R.id.txtvAuthor);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
if (StringUtils.isNotBlank(podcast.getLogoUrl())) {
Glide.with(convertView.getContext()).load(podcast.getLogoUrl()).apply(new RequestOptions().placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).transforms(new FitCenter(), new RoundedCorners((int) (4 * convertView.getContext().getResources().getDisplayMetrics().density))).dontAnimate()).into(holder.image);
}
holder.title.setText(podcast.getTitle());
holder.subscribers.setText(String.valueOf(podcast.getSubscribers()));
holder.author.setText(podcast.getAuthor());
return convertView;
}
use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class ItunesAdapter method getView.
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
// Current podcast
PodcastSearchResult podcast = data.get(position);
// ViewHolder
PodcastViewHolder viewHolder;
// Resulting view
View view;
// Handle view holder stuff
if (convertView == null) {
view = ((MainActivity) context).getLayoutInflater().inflate(R.layout.itunes_podcast_listitem, parent, false);
viewHolder = new PodcastViewHolder(view);
view.setTag(viewHolder);
} else {
view = convertView;
viewHolder = (PodcastViewHolder) view.getTag();
}
// Set the title
viewHolder.titleView.setText(podcast.title);
if (podcast.author != null && !podcast.author.trim().isEmpty()) {
viewHolder.authorView.setText(podcast.author);
viewHolder.authorView.setVisibility(View.VISIBLE);
} else if (podcast.feedUrl != null && !podcast.feedUrl.contains("itunes.apple.com")) {
viewHolder.authorView.setText(podcast.feedUrl);
viewHolder.authorView.setVisibility(View.VISIBLE);
} else {
viewHolder.authorView.setVisibility(View.GONE);
}
// Update the empty imageView with the image from the feed
Glide.with(context).load(podcast.imageUrl).apply(new RequestOptions().placeholder(R.color.light_gray).diskCacheStrategy(DiskCacheStrategy.NONE).transforms(new FitCenter(), new RoundedCorners((int) (4 * context.getResources().getDisplayMetrics().density))).dontAnimate()).into(viewHolder.coverView);
// Feed the grid view
return view;
}
Aggregations