新增去除打开应用弹窗

This commit is contained in:
乌堆小透明
2022-03-14 17:31:35 +08:00
parent b483ce52c8
commit e608c504fe
4 changed files with 49 additions and 5 deletions

View File

@@ -1019,6 +1019,15 @@ class SettingsActivity : MIUIActivity() {
SwitchV("skip_waiting_time") SwitchV("skip_waiting_time")
) )
) )
add(
TextSummaryWithSwitchV(
TextSummaryV(
textId = R.string.remove_open_app_confirmation_popup,
tipsId = R.string.remove_open_app_confirmation_popup_summary
),
SwitchV("remove_open_app_confirmation_popup")
)
)
add( add(
TextSummaryWithSwitchV( TextSummaryWithSwitchV(
TextSummaryV( TextSummaryV(

View File

@@ -1,9 +1,6 @@
package com.lt2333.simplicitytools.hook.app package com.lt2333.simplicitytools.hook.app
import com.lt2333.simplicitytools.hook.app.securitycenter.LockOneHundred import com.lt2333.simplicitytools.hook.app.securitycenter.*
import com.lt2333.simplicitytools.hook.app.securitycenter.RemoveMacroBlacklist
import com.lt2333.simplicitytools.hook.app.securitycenter.ShowBatteryTemperature
import com.lt2333.simplicitytools.hook.app.securitycenter.SkipWaitingTime
import de.robv.android.xposed.IXposedHookLoadPackage import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XposedBridge import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
@@ -20,5 +17,7 @@ class SecurityCenter : IXposedHookLoadPackage {
RemoveMacroBlacklist().handleLoadPackage(lpparam) RemoveMacroBlacklist().handleLoadPackage(lpparam)
//显示电池温度 //显示电池温度
ShowBatteryTemperature().handleLoadPackage(lpparam) ShowBatteryTemperature().handleLoadPackage(lpparam)
//去除打开应用弹窗
RemoveOpenAppConfirmationPopup().handleLoadPackage(lpparam)
} }
} }

View File

@@ -0,0 +1,34 @@
package com.lt2333.simplicitytools.hook.app.securitycenter
import android.widget.TextView
import com.lt2333.simplicitytools.util.XSPUtils
import com.lt2333.simplicitytools.util.findClass
import com.lt2333.simplicitytools.util.hookAfterMethod
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.callbacks.XC_LoadPackage
class RemoveOpenAppConfirmationPopup : IXposedHookLoadPackage {
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
val textViewClass = "android.widget.TextView".findClass(lpparam.classLoader)
textViewClass.hookAfterMethod(
"setText",
CharSequence::class.java
) {
if (XSPUtils.getBoolean("remove_open_app_confirmation_popup", false)) {
val textView = it.thisObject as TextView
if (it.args.isNotEmpty() && it.args[0]?.toString().equals(
textView.context.resources.getString(
textView.context.resources.getIdentifier(
"button_text_accept",
"string",
textView.context.packageName
)
)
)
) {
textView.performClick()
}
}
}
}
}

View File

@@ -158,4 +158,6 @@
<string name="participate_in_translation_summary">Help us translate the app into your language</string> <string name="participate_in_translation_summary">Help us translate the app into your language</string>
<string name="lock_screen_charging_current">Display current information during charging</string> <string name="lock_screen_charging_current">Display current information during charging</string>
<string name="current_current">Current</string> <string name="current_current">Current</string>
<string name="remove_open_app_confirmation_popup">remove open app popup</string>
<string name="remove_open_app_confirmation_popup_summary">remove \"Allow XXX to open XXX\" Chain start popup</string>
</resources> </resources>