aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java
index 5097849f..ebc64f54 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/AspectRatioGifImageView.java
@@ -44,16 +44,18 @@ public class AspectRatioGifImageView extends GifImageView {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- int width = this.getMeasuredWidth();
- int height = this.getMeasuredHeight();
- if (width != 0 || height != 0) {
- if (width > 0) {
- height = (int) ((float) width * this.ratio);
- } else {
- width = (int) ((float) height / this.ratio);
- }
+ if (this.ratio > 0) {
+ int width = this.getMeasuredWidth();
+ int height = this.getMeasuredHeight();
+ if (width != 0 || height != 0) {
+ if (width > 0) {
+ height = (int) ((float) width * this.ratio);
+ } else {
+ width = (int) ((float) height / this.ratio);
+ }
- this.setMeasuredDimension(width, height);
+ this.setMeasuredDimension(width, height);
+ }
}
}