mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 13:47:47 +02:00
fix(core/ui_tweaks): friend card frame dimension
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user