aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-12-06 15:11:45 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-12-06 15:11:45 +0000
commit0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9 (patch)
treeba4c15fe124b63fa715b543f33bed4f8285a2718 /app
parent03ac342884fe864593f451d1cfbe1ca4b0065a3c (diff)
downloadinfinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.tar
infinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.tar.gz
infinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.tar.bz2
infinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.tar.lz
infinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.tar.xz
infinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.tar.zst
infinity-for-reddit-0ba9cbafbe79cc9da5f84cca12b97cdc245c5ef9.zip
Fix very small flair icon.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java21
1 files changed, 4 insertions, 17 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java
index 28ba6dce..215e991c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java
@@ -24,25 +24,19 @@ import java.lang.ref.WeakReference;
public class GlideImageGetter implements Html.ImageGetter {
private WeakReference<TextView> container;
- private boolean matchParentWidth;
private boolean enlargeImage;
private HtmlImagesHandler imagesHandler;
private float density = 1.0f;
private float textSize;
public GlideImageGetter(TextView textView, boolean enlargeImage) {
- this(textView, false, false, null);
+ this(textView, false, null);
this.enlargeImage = enlargeImage;
}
- public GlideImageGetter(TextView textView, boolean matchParentWidth, HtmlImagesHandler imagesHandler) {
- this(textView, matchParentWidth, false, imagesHandler);
- }
-
- public GlideImageGetter(TextView textView, boolean matchParentWidth, boolean densityAware,
+ public GlideImageGetter(TextView textView, boolean densityAware,
@Nullable HtmlImagesHandler imagesHandler) {
this.container = new WeakReference<>(textView);
- this.matchParentWidth = matchParentWidth;
this.imagesHandler = imagesHandler;
if (densityAware) {
density = container.get().getResources().getDisplayMetrics().density;
@@ -97,15 +91,8 @@ public class GlideImageGetter implements Html.ImageGetter {
float ratio = (float) drawableWidth / (float) drawableHeight;
drawableHeight = enlargeImage ? (int) (textSize * 1.5) : (int) textSize;
drawableWidth = (int) (drawableHeight * ratio);
- int maxWidth = container.get().getMeasuredWidth();
- if ((maxWidth > 0 && (drawableWidth > maxWidth)) || matchParentWidth) {
- int calculatedHeight = maxWidth * drawableHeight / drawableWidth;
- drawable.setBounds(0, 0, maxWidth, calculatedHeight);
- setBounds(0, 0, maxWidth, calculatedHeight);
- } else {
- drawable.setBounds(0, 0, drawableWidth, drawableHeight);
- setBounds(0, 0, drawableWidth, drawableHeight);
- }
+ drawable.setBounds(0, 0, drawableWidth, drawableHeight);
+ setBounds(0, 0, drawableWidth, drawableHeight);
container.get().setText(container.get().getText());
}