mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
Disable aspect ratio logic when it is negative (#1296)
Gallery can set aspect ratio to -1 which would result in negative measured height. It seem that Android treats dimensions as unsigned numbers, so negative numbers actually become huge positive numbers resulting in "infinite" height. It should be noted that this change allows to disable aspect ratio logic even when some dimension is set to `wrap_content`.
This commit is contained in:
parent
aaa55a6af9
commit
c42f183696
@ -44,6 +44,7 @@ public class AspectRatioGifImageView extends GifImageView {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
if (this.ratio > 0) {
|
||||
int width = this.getMeasuredWidth();
|
||||
int height = this.getMeasuredHeight();
|
||||
if (width != 0 || height != 0) {
|
||||
@ -56,6 +57,7 @@ public class AspectRatioGifImageView extends GifImageView {
|
||||
this.setMeasuredDimension(width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
|
Loading…
Reference in New Issue
Block a user