diff options
author | Andrew Dolgov <[email protected]> | 2014-10-17 23:44:21 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-10-17 23:44:21 +0400 |
commit | 5685b91aa93258430565e7d00442065758755c76 (patch) | |
tree | 135457fd69860d7aa5d57111fe0a55d529eaffc4 /org.fox.ttrss/src/main/java/org | |
parent | bbf4c65fac74a7b6e2e61b20f77305b457d4e368 (diff) |
do not upscale images in headlines more than 2x
Diffstat (limited to 'org.fox.ttrss/src/main/java/org')
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/util/EnlargingImageView.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/EnlargingImageView.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/EnlargingImageView.java index e3f1e6f6..bf9d48d8 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/EnlargingImageView.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/EnlargingImageView.java @@ -20,6 +20,7 @@ import java.lang.reflect.Field; import android.content.Context; import android.util.AttributeSet; +import android.util.Log; import android.view.View; /** @@ -163,7 +164,11 @@ public class EnlargingImageView extends android.widget.ImageView { // Try adjusting width to be proportional to height if (resizeWidth) { int newWidth = (int) (desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright; - if (/*newWidth <= widthSize &&*/newWidth > 0) { + + if (newWidth > 0 && widthSize > 0 && newWidth / widthSize > 2) + newWidth = widthSize * 2; + + if (/*newWidth <= widthSize &&*/ newWidth > 0) { widthSize = Math.min(newWidth, mMaxWidthL); heightSize = (int) ((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom; } @@ -172,7 +177,11 @@ public class EnlargingImageView extends android.widget.ImageView { // Try adjusting height to be proportional to width if (resizeHeight) { int newHeight = (int) ((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom; - if (/*newHeight <= heightSize && */newHeight > 0) { + + if (newHeight > 0 && heightSize > 0 && newHeight / heightSize > 2) + newHeight = heightSize * 2; + + if (/* newHeight <= heightSize && */ newHeight > 0) { heightSize = Math.min(newHeight, mMaxHeightL); widthSize = (int) (desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright; } |