-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package moe.qwq.miko.hooks | ||
|
||
import android.content.Context | ||
import android.widget.CheckBox | ||
import de.robv.android.xposed.XC_MethodHook | ||
import de.robv.android.xposed.XposedBridge | ||
import moe.fuqiuluo.processor.HookAction | ||
import moe.qwq.miko.actions.IAction | ||
import moe.qwq.miko.ext.beforeHook | ||
import moe.qwq.miko.ext.hookMethod | ||
import moe.qwq.miko.internals.setting.QwQSetting | ||
|
||
@HookAction(desc = "默认勾选复选框") | ||
class CheckBoxHook: IAction { | ||
override fun onRun(ctx: Context) { | ||
XposedBridge.hookAllConstructors(CheckBox::class.java, object : XC_MethodHook() { | ||
override fun afterHookedMethod(param: MethodHookParam) { | ||
val checkBox = param.thisObject as CheckBox | ||
checkBox.post { checkBox.isChecked = true } | ||
} | ||
}) | ||
val hook = beforeHook { | ||
it.args[0] = true | ||
} | ||
CheckBox::class.java.hookMethod("setChecked", hook) | ||
} | ||
|
||
override val name: String = QwQSetting.CHECK_BOX_HOOK | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters