mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 03:32:38 +08:00
fix: 在[最近任务]界面中隐藏本应用
This commit is contained in:
parent
eeb7380abc
commit
91e1ba2775
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user