From 91e1ba27755d2a8ff2fa08ef802a124b1e43e16e Mon Sep 17 00:00:00 2001 From: lliioollzh Date: Sun, 8 Oct 2023 19:42:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8[=E6=9C=80=E8=BF=91=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1]=E7=95=8C=E9=9D=A2=E4=B8=AD=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E6=9C=AC=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/li/songe/gkd/ui/SettingsPage.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt b/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt index 2b640f8..fdb1044 100644 --- a/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt +++ b/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt @@ -1,5 +1,7 @@ package li.songe.gkd.ui +import android.app.ActivityManager +import android.content.Context import android.content.Intent import android.net.Uri import android.provider.Settings @@ -53,6 +55,7 @@ import com.blankj.utilcode.util.ZipUtils import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import li.songe.gkd.MainActivity +import li.songe.gkd.app import li.songe.gkd.appScope import li.songe.gkd.ui.component.SettingItem import li.songe.gkd.ui.component.TextSwitch @@ -115,6 +118,12 @@ fun SettingsPage() { desc = "在[最近任务]界面中隐藏本应用", checked = store.excludeFromRecents, onCheckedChange = { + + (app.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).let { manager -> + manager.appTasks.forEach { task -> + task?.setExcludeFromRecents(it) + } + } updateStorage( storeFlow, store.copy( excludeFromRecents = it