forked from mirrors/Fedilab
Fix issue #469 - Crashes with pinned and Pixelfed
This commit is contained in:
parent
ba53e174ab
commit
a946ea49d1
2 changed files with 31 additions and 24 deletions
|
@ -32,12 +32,14 @@ public class Tag implements Serializable {
|
|||
|
||||
public int getWeight() {
|
||||
int weight = 0;
|
||||
if (history != null && history.size() > 0) {
|
||||
for (History h : history) {
|
||||
try {
|
||||
weight += Integer.parseInt(h.accounts);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2161,6 +2161,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
@Override
|
||||
public void onGlobalLayout() {
|
||||
holder.bindingArt.artMedia.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
if (status.art_attachment.meta != null) {
|
||||
float viewWidth = holder.bindingArt.artMedia.getWidth();
|
||||
ConstraintLayout.LayoutParams lp;
|
||||
float mediaH = status.art_attachment.meta.small.height;
|
||||
|
@ -2173,7 +2174,10 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
holder.bindingArt.artMedia.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
holder.bindingArt.artMedia.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (status.art_attachment.meta != null) {
|
||||
float viewWidth = holder.bindingArt.artMedia.getWidth();
|
||||
ConstraintLayout.LayoutParams lp;
|
||||
float mediaH = status.art_attachment.meta.small.height;
|
||||
|
@ -2185,6 +2189,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
lp = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, (int) (mediaH * ratio));
|
||||
holder.bindingArt.artMedia.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
holder.bindingArt.artMedia.setLayoutParams(lp);
|
||||
}
|
||||
Glide.with(holder.bindingArt.artMedia.getContext())
|
||||
.load(status.art_attachment.preview_url)
|
||||
.apply(new RequestOptions().transform(new RoundedCorners((int) Helper.convertDpToPixel(3, context))))
|
||||
|
|
Loading…
Reference in a new issue