Fix large image attachments not showing (#1043)
* fix for too large image attachments not fitting into GL texture * Don't use context!!
This commit is contained in:
parent
1805caaef7
commit
fcc67c6918
4 changed files with 35 additions and 1 deletions
|
|
@ -284,6 +284,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
|
||||
final int n = Math.min(attachments.size(), Status.MAX_MEDIA_ATTACHMENTS);
|
||||
|
||||
final int maxW = context.getResources().getInteger(R.integer.media_max_width);
|
||||
final int maxH = context.getResources().getInteger(R.integer.media_max_height);
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
String previewUrl = attachments.get(i).getPreviewUrl();
|
||||
String description = attachments.get(i).getDescription();
|
||||
|
|
@ -299,6 +302,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
if (TextUtils.isEmpty(previewUrl)) {
|
||||
Picasso.with(context)
|
||||
.load(mediaPreviewUnloadedId)
|
||||
.resize(maxW, maxH)
|
||||
.onlyScaleDown()
|
||||
.centerInside()
|
||||
.into(mediaPreviews[i]);
|
||||
} else {
|
||||
MetaData meta = attachments.get(i).getMeta();
|
||||
|
|
@ -310,6 +316,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
Picasso.with(context)
|
||||
.load(previewUrl)
|
||||
.placeholder(mediaPreviewUnloadedId)
|
||||
.resize(maxW, maxH)
|
||||
.onlyScaleDown()
|
||||
.centerInside()
|
||||
// Also pass the mediaPreview as a callback to ensure it is called
|
||||
// initially when the image gets loaded:
|
||||
.into(mediaPreviews[i], mediaPreviews[i]);
|
||||
|
|
@ -319,6 +328,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
Picasso.with(context)
|
||||
.load(previewUrl)
|
||||
.placeholder(mediaPreviewUnloadedId)
|
||||
.resize(maxW, maxH)
|
||||
.onlyScaleDown()
|
||||
.centerInside()
|
||||
.into(mediaPreviews[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue