From 38ce4db31164fece7f26c7b2a84cbc6f2091cacf Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 17 Sep 2020 21:18:03 +0800 Subject: Fix flairs contains only images not shown. --- .../ml/docilealligator/infinityforreddit/Activity/SearchActivity.java | 2 ++ .../ml/docilealligator/infinityforreddit/Utils/GlideImageGetter.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java index 3fd343f4..78ab544c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java @@ -78,6 +78,8 @@ public class SearchActivity extends BaseActivity { protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); + setImmersiveModeNotApplicable(); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); 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 fc8cfcf9..f3cef706 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/GlideImageGetter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/GlideImageGetter.java @@ -87,10 +87,10 @@ public class GlideImageGetter implements Html.ImageGetter { int drawableWidth = (int) (drawable.getIntrinsicWidth() * density); int drawableHeight = (int) (drawable.getIntrinsicHeight() * density); float ratio = (float) drawableWidth / (float) drawableHeight; - drawableHeight = (int) textSize; + drawableHeight = (int) (textSize * 1.5); drawableWidth = (int) (drawableHeight * ratio); int maxWidth = container.get().getMeasuredWidth(); - if ((drawableWidth > maxWidth) || matchParentWidth) { + if ((maxWidth > 0 && (drawableWidth > maxWidth)) || matchParentWidth) { int calculatedHeight = maxWidth * drawableHeight / drawableWidth; drawable.setBounds(0, 0, maxWidth, calculatedHeight); setBounds(0, 0, maxWidth, calculatedHeight); -- cgit v1.2.3