use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class FeedSearchResultAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull Holder holder, int position) {
final Feed podcast = data.get(position);
holder.imageView.setContentDescription(podcast.getTitle());
holder.imageView.setOnClickListener(v -> mainActivityRef.get().loadChildFragment(FeedItemlistFragment.newInstance(podcast.getId())));
Glide.with(mainActivityRef.get()).load(podcast.getImageUrl()).apply(new RequestOptions().placeholder(R.color.light_gray).fitCenter().dontAnimate()).into(holder.imageView);
}
use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class NavListAdapter method bindFeedView.
private void bindFeedView(NavDrawerData.FeedDrawerItem drawerItem, FeedHolder holder) {
Feed feed = drawerItem.feed;
Activity context = activity.get();
if (context == null) {
return;
}
Glide.with(context).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(holder.image);
if (feed.hasLastUpdateFailed()) {
RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) holder.title.getLayoutParams();
p.addRule(RelativeLayout.LEFT_OF, R.id.itxtvFailure);
holder.failure.setVisibility(View.VISIBLE);
} else {
RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) holder.title.getLayoutParams();
p.addRule(RelativeLayout.LEFT_OF, R.id.txtvCount);
holder.failure.setVisibility(View.GONE);
}
}
use of com.bumptech.glide.request.RequestOptions in project AntennaPod by AntennaPod.
the class StatisticsListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder h, int position) {
if (getItemViewType(position) == TYPE_HEADER) {
HeaderHolder holder = (HeaderHolder) h;
holder.pieChart.setData(pieChartData);
holder.totalTime.setText(getHeaderValue());
} else {
StatisticsHolder holder = (StatisticsHolder) h;
StatisticsItem statsItem = statisticsData.get(position - 1);
Glide.with(context).load(statsItem.feed.getImageUrl()).apply(new RequestOptions().placeholder(R.color.light_gray).error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate()).into(holder.image);
holder.title.setText(statsItem.feed.getTitle());
holder.chip.setTextColor(pieChartData.getColorOfItem(position - 1));
onBindFeedViewHolder(holder, statsItem);
}
}
use of com.bumptech.glide.request.RequestOptions in project MaterialViewPager by florent37.
the class MaterialViewPagerImageHelper method setImageUrl.
/**
* change the image with a fade
*
* @param urlImage
* @param fadeDuration TODO : remove Picasso
*/
public static void setImageUrl(final ImageView imageView, final String urlImage, final int fadeDuration) {
final float alpha = ViewCompat.getAlpha(imageView);
final ImageView viewToAnimate = imageView;
// fade to alpha=0
fadeOut(viewToAnimate, fadeDuration, new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
super.onAnimationEnd(view);
// change the image when alpha=0
Glide.with(imageView.getContext()).load(urlImage).apply(new RequestOptions().centerCrop()).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
// then fade to alpha=1
new Handler(Looper.getMainLooper()) {
}.post(new Runnable() {
@Override
public void run() {
fadeIn(viewToAnimate, alpha, fadeDuration, new ViewPropertyAnimatorListenerAdapter());
if (imageLoadListener != null) {
imageLoadListener.OnImageLoad(imageView, ((BitmapDrawable) imageView.getDrawable()).getBitmap());
}
}
});
return false;
}
}).into(viewToAnimate);
}
});
}
use of com.bumptech.glide.request.RequestOptions in project GestureViews by alexvasilkov.
the class GlideHelper method loadThumb.
/**
* Loads thumbnail.
*/
public static void loadThumb(ImageView image, int thumbId) {
// We don't want Glide to crop or resize our image
final RequestOptions options = new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE).override(Target.SIZE_ORIGINAL).dontTransform();
Glide.with(image).load(thumbId).apply(options).into(image);
}
Aggregations