use of org.thoughtcrime.securesms.giph.model.GiphyPaddedUrl in project Signal-Android by signalapp.
the class GiphyAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(GiphyViewHolder holder, int position) {
GiphyImage image = images.get(position);
holder.modelReady = false;
holder.image = image;
holder.thumbnail.setAspectRatio(image.getGifAspectRatio());
holder.gifProgress.setVisibility(View.GONE);
RequestBuilder<Drawable> thumbnailRequest = GlideApp.with(context).load(new GiphyPaddedUrl(image.getStillUrl(), image.getStillSize())).diskCacheStrategy(DiskCacheStrategy.ALL);
if (Util.isLowMemory(context)) {
glideRequests.load(new GiphyPaddedUrl(image.getStillUrl(), image.getStillSize())).placeholder(new ColorDrawable(Util.getRandomElement(MaterialColor.values()).toConversationColor(context))).diskCacheStrategy(DiskCacheStrategy.ALL).listener(holder).into(holder.thumbnail);
holder.setModelReady();
} else {
glideRequests.load(new GiphyPaddedUrl(image.getGifUrl(), image.getGifSize())).thumbnail(thumbnailRequest).placeholder(new ColorDrawable(Util.getRandomElement(MaterialColor.values()).toConversationColor(context))).diskCacheStrategy(DiskCacheStrategy.ALL).listener(holder).into(holder.thumbnail);
}
}
Aggregations