commit 22bcfbc1f14fb08c0122412ea0f74673dbcf788f
parent 7dd4241be0c2b1e0d4e108a9148134aeaa9c6270
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Sat, 16 Dec 2023 18:27:28 +0100
fix(core/ui_tweaks): friend card frame dimension
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
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
@@ -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
+ }
}
}
}