mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
优化写法
This commit is contained in:
@@ -24,7 +24,7 @@ object DisableFlagSecureForAll : YukiBaseHooker() {
|
|||||||
method { name = "setSecure" }
|
method { name = "setSecure" }
|
||||||
beforeHook {
|
beforeHook {
|
||||||
hasEnable("disable_flag_secure") {
|
hasEnable("disable_flag_secure") {
|
||||||
this.args[0] = false
|
args[0] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,10 +32,10 @@ object DisableFlagSecureForAll : YukiBaseHooker() {
|
|||||||
allMembers(MembersType.CONSTRUCTOR)
|
allMembers(MembersType.CONSTRUCTOR)
|
||||||
beforeHook {
|
beforeHook {
|
||||||
hasEnable("disable_flag_secure") {
|
hasEnable("disable_flag_secure") {
|
||||||
var flags = this.args[2] as Int
|
var flags = args[2] as Int
|
||||||
val secureFlag = 128
|
val secureFlag = 128
|
||||||
flags = flags and secureFlag.inv()
|
flags = flags and secureFlag.inv()
|
||||||
this.args[2] = flags
|
args[2] = flags
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ import android.view.View
|
|||||||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
||||||
import com.highcapable.yukihookapi.hook.factory.current
|
import com.highcapable.yukihookapi.hook.factory.current
|
||||||
import com.highcapable.yukihookapi.hook.factory.field
|
import com.highcapable.yukihookapi.hook.factory.field
|
||||||
import com.highcapable.yukihookapi.hook.factory.toClass
|
|
||||||
import com.lt2333.simplicitytools.R
|
import com.lt2333.simplicitytools.R
|
||||||
import com.lt2333.simplicitytools.utils.hasEnable
|
import com.lt2333.simplicitytools.utils.hasEnable
|
||||||
import de.robv.android.xposed.XposedHelpers
|
|
||||||
|
|
||||||
object ShortcutAddSmallWindowForAll : YukiBaseHooker() {
|
object ShortcutAddSmallWindowForAll : YukiBaseHooker() {
|
||||||
override fun onHook() = hasEnable("miuihome_shortcut_add_small_window") {
|
override fun onHook() = hasEnable("miuihome_shortcut_add_small_window") {
|
||||||
@@ -51,8 +49,8 @@ object ShortcutAddSmallWindowForAll : YukiBaseHooker() {
|
|||||||
paramCount = 2
|
paramCount = 2
|
||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
val obj = this.args[0]
|
val obj = args[0]
|
||||||
val view: View = this.args[1] as View
|
val view: View = args[1] as View
|
||||||
val mShortTitle = obj?.current {
|
val mShortTitle = obj?.current {
|
||||||
method { name = "getShortTitle" }.invoke<CharSequence>()
|
method { name = "getShortTitle" }.invoke<CharSequence>()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ object HideSimIconForT:YukiBaseHooker() {
|
|||||||
param(MutableList::class.java)
|
param(MutableList::class.java)
|
||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
val list = this.args[0] as MutableList<*>
|
val list = args[0] as MutableList<*>
|
||||||
val size = list.size
|
val size = list.size
|
||||||
hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
|
hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
|
||||||
list.removeAt(1)
|
list.removeAt(1)
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ object HideStatusBarNetworkSpeedSecondForT : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
hasEnable("hide_status_bar_network_speed_second") {
|
hasEnable("hide_status_bar_network_speed_second") {
|
||||||
if (this.args[0] != null) {
|
if (args[0] != null) {
|
||||||
val mText = (this.args[0] as String)
|
val mText = (args[0] as String)
|
||||||
.replace("/", "")
|
.replace("/", "")
|
||||||
.replace("s", "")
|
.replace("s", "")
|
||||||
.replace("\'", "")
|
.replace("\'", "")
|
||||||
.replace("วิ", "")
|
.replace("วิ", "")
|
||||||
this.args[0] = mText
|
args[0] = mText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.lt2333.simplicitytools.hooks.rules.t.systemui
|
|||||||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
||||||
import com.highcapable.yukihookapi.hook.factory.current
|
import com.highcapable.yukihookapi.hook.factory.current
|
||||||
import com.lt2333.simplicitytools.utils.XSPUtils
|
import com.lt2333.simplicitytools.utils.XSPUtils
|
||||||
import java.lang.reflect.Method
|
|
||||||
|
|
||||||
object MaximumNumberOfNotificationIconsForT: YukiBaseHooker() {
|
object MaximumNumberOfNotificationIconsForT: YukiBaseHooker() {
|
||||||
override fun onHook() {
|
override fun onHook() {
|
||||||
@@ -16,7 +15,7 @@ object MaximumNumberOfNotificationIconsForT: YukiBaseHooker() {
|
|||||||
paramCount = 1
|
paramCount = 1
|
||||||
}
|
}
|
||||||
replaceUnit {
|
replaceUnit {
|
||||||
if (this.args[0] as Boolean) {
|
if (args[0] as Boolean) {
|
||||||
instance.current().field { name = "MAX_DOTS" }.set(dots)
|
instance.current().field { name = "MAX_DOTS" }.set(dots)
|
||||||
instance.current().field { name = "MAX_STATIC_ICONS" }.set(icons)
|
instance.current().field { name = "MAX_STATIC_ICONS" }.set(icons)
|
||||||
instance.current().field { name = "MAX_ICONS_ON_LOCKSCREEN" }.set(icons)
|
instance.current().field { name = "MAX_ICONS_ON_LOCKSCREEN" }.set(icons)
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ object NewControlCenterWeatherForT : YukiBaseHooker() {
|
|||||||
superClass(true)
|
superClass(true)
|
||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
val time = this.args[0]?.toString()
|
val time = args[0]?.toString()
|
||||||
val view = instance<TextView>()
|
val view = instance<TextView>()
|
||||||
if (view.id == clockId && time != null) {
|
if (view.id == clockId && time != null) {
|
||||||
this.args[0] = "${weather.weatherData}$time"
|
args[0] = "${weather.weatherData}$time"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ object NewControlCenterWeatherForT : YukiBaseHooker() {
|
|||||||
name = "getClassLoader"
|
name = "getClassLoader"
|
||||||
}
|
}
|
||||||
afterHook {
|
afterHook {
|
||||||
val appInfo = this.args[0] as ApplicationInfo
|
val appInfo = args[0] as ApplicationInfo
|
||||||
val classLoader = this.result as ClassLoader
|
val classLoader = this.result as ClassLoader
|
||||||
if (appInfo.packageName == "miui.systemui.plugin") {
|
if (appInfo.packageName == "miui.systemui.plugin") {
|
||||||
"miui.systemui.controlcenter.windowview.MainPanelHeaderController".hook {
|
"miui.systemui.controlcenter.windowview.MainPanelHeaderController".hook {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ object StatusBarNetworkSpeedRefreshSpeedForT : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
hasEnable("status_bar_network_speed_refresh_speed") {
|
hasEnable("status_bar_network_speed_refresh_speed") {
|
||||||
this.args[0] = 1000L
|
args[0] = 1000L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ object StatusBarTimeCustomizationForT : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
afterHook {
|
afterHook {
|
||||||
try {
|
try {
|
||||||
c = this.args[0] as Context
|
c = args[0] as Context
|
||||||
val textV = instance<TextView>()
|
val textV = instance<TextView>()
|
||||||
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@afterHook
|
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@afterHook
|
||||||
textV.isSingleLine = false
|
textV.isSingleLine = false
|
||||||
@@ -94,7 +94,7 @@ object StatusBarTimeCustomizationForT : YukiBaseHooker() {
|
|||||||
if (isCenterAlign) {
|
if (isCenterAlign) {
|
||||||
try {
|
try {
|
||||||
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
c = this.args[0] as Context
|
c = args[0] as Context
|
||||||
textV.gravity = Gravity.CENTER
|
textV.gravity = Gravity.CENTER
|
||||||
}
|
}
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
@@ -131,7 +131,7 @@ object StatusBarTimeCustomizationForT : YukiBaseHooker() {
|
|||||||
constructor { paramCount = 3 }
|
constructor { paramCount = 3 }
|
||||||
afterHook {
|
afterHook {
|
||||||
try {
|
try {
|
||||||
c = this.args[0] as Context
|
c = args[0] as Context
|
||||||
val textV = instance<TextView>()
|
val textV = instance<TextView>()
|
||||||
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@afterHook
|
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@afterHook
|
||||||
textV.isSingleLine = false
|
textV.isSingleLine = false
|
||||||
@@ -159,7 +159,7 @@ object StatusBarTimeCustomizationForT : YukiBaseHooker() {
|
|||||||
if (isGeekCenterAlign) {
|
if (isGeekCenterAlign) {
|
||||||
try {
|
try {
|
||||||
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
c = this.args[0] as Context
|
c = args[0] as Context
|
||||||
textV.gravity = Gravity.CENTER
|
textV.gravity = Gravity.CENTER
|
||||||
}
|
}
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
|||||||
Reference in New Issue
Block a user