From 5685b91aa93258430565e7d00442065758755c76 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 17 Oct 2014 23:44:21 +0400 Subject: [PATCH] do not upscale images in headlines more than 2x --- org.fox.ttrss/src/main/AndroidManifest.xml | 4 ++-- .../java/org/fox/ttrss/util/EnlargingImageView.java | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index e266e712..0f7f55e2 100644 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="241" + android:versionName="1.42" > 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; }