Update NotificationWeatherForT.kt

This commit is contained in:
LittleTurtle2333
2023-03-05 22:07:00 +08:00
parent ce5312494c
commit 8117809073

View File

@@ -10,9 +10,8 @@ import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout
import cn.fkj233.ui.activity.dp2px
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
import com.highcapable.yukihookapi.hook.factory.constructor
import com.highcapable.yukihookapi.hook.factory.buildOf
import com.highcapable.yukihookapi.hook.factory.current
import com.highcapable.yukihookapi.hook.factory.toClass
import com.lt2333.simplicitytools.utils.SystemProperties
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
@@ -123,18 +122,20 @@ object NotificationWeatherForT : YukiBaseHooker() {
(mWeatherView as WeatherView).layoutParams = mweatherviewLp
} else {
// 通过YukiHook的构造方法创建新实例指定类型 ViewGroup.MarginLayoutParams
val layoutParam = "androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams".toClass()
.constructor {
.buildOf<ViewGroup.MarginLayoutParams>(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) {
paramCount = 2
}.get().newInstance<ViewGroup.MarginLayoutParams>(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
}
layoutParam?.current()?.field { name = "bottomToTop" }?.set(context.resources.getIdentifier("date_time", "id", context.packageName))
layoutParam?.current()?.field { name = "startToEnd" }?.set(context.resources.getIdentifier("big_time", "id", context.packageName))
layoutParam?.current()?.field { name = "bottomToTop" }
?.set(context.resources.getIdentifier("date_time", "id", context.packageName))
layoutParam?.current()?.field { name = "startToEnd" }
?.set(context.resources.getIdentifier("big_time", "id", context.packageName))
layoutParam?.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(