diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt index 1f0ed9cc..6cf578d9 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/UITweaks.kt @@ -4,8 +4,8 @@ import android.annotation.SuppressLint import android.content.Context import android.content.res.Resources import android.text.SpannableString +import android.util.Size import android.view.View -import android.view.ViewGroup import android.view.ViewGroup.MarginLayoutParams import android.widget.FrameLayout import me.rhunk.snapenhance.common.util.ktx.findFieldsToString @@ -75,6 +75,8 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE } } + var friendCardFrameSize: Size? = null + context.event.subscribe(BindViewEvent::class, { hideStorySections.contains("hide_suggested_friend_stories") }) { event -> if (event.view.id != friendCardFrame) return@subscribe @@ -83,12 +85,18 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE }.firstOrNull()?.get(event.prevModel) ?: return@subscribe event.view.layoutParams.apply { + if (friendCardFrameSize == null && width > 0 && height > 0) { + friendCardFrameSize = Size(width, height) + } + if (friendStoryData.toString().contains("isFriendOfFriend=true")) { width = 0 height = 0 } else { - width = ViewGroup.LayoutParams.WRAP_CONTENT - height = ViewGroup.LayoutParams.WRAP_CONTENT + friendCardFrameSize?.let { + width = it.width + height = it.height + } } } }