This commit is contained in:
乌堆小透明
2022-02-27 17:30:44 +08:00
parent 50a05de9d8
commit 588c424cb3
3 changed files with 20 additions and 8 deletions

View File

@@ -56,6 +56,7 @@ android {
}
dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
//API
compileOnly("de.robv.android.xposed:api:82")
//UI

View File

@@ -49,6 +49,12 @@ class SystemUI : IXposedHookLoadPackage {
StatusBarNetworkSpeedRefreshSpeed().handleLoadPackage(lpparam)
//状态栏时钟自定义
StatusBarTimeCustomization().handleLoadPackage(lpparam)
//TODO:状态栏天气
NotificationWeather().handleLoadPackage(lpparam)
//TODO状态栏电流
//StatusBarCurrent().handleLoadPackage(lpparam)
}
}

View File

@@ -1,8 +1,8 @@
package com.lt2333.simplicitytools.hook.app.systemui
import android.view.ViewGroup
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedHelpers
@@ -17,20 +17,25 @@ class NotificationWeather :IXposedHookLoadPackage {
XposedHelpers.findAndHookMethod(classIfExists, "onFinishInflate", object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
val viewGroup = param.thisObject as ViewGroup
val layoutParams = RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT
val layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.WRAP_CONTENT,
).also {
it.addRule(RelativeLayout.ABOVE)
it.addRule(RelativeLayout.START_OF)
it.addRule(RelativeLayout.END_OF)
it.bottomToTop = viewGroup.context.resources.getIdentifier("date_time","id",viewGroup.context.packageName)
it.startToEnd = viewGroup.context.resources.getIdentifier("big_time","id",viewGroup.context.packageName)
it.marginStart = viewGroup.context.resources.getIdentifier("notification_panel_time_date_space","dimen",viewGroup.context.packageName)
}
val textView = TextView(viewGroup.context).also {
it.setTextAppearance(viewGroup.context.resources.getIdentifier("TextAppearance.QSControl.Date","style",viewGroup.context.packageName))
it.text = "This is a TextView"
it.textSize=18F
//TODO:状态栏天气定位异常
it.layoutParams = layoutParams
}
viewGroup.addView(textView)
}
})
}