Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/src/main/java/com/github/kr328/clash/BaseActivity.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.github.kr328.clash

import android.app.ActivityManager
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.activity.result.contract.ActivityResultContract
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.getSystemService
import com.github.kr328.clash.common.compat.isAllowForceDarkCompat
import com.github.kr328.clash.common.compat.isLightNavigationBarCompat
import com.github.kr328.clash.common.compat.isLightStatusBarsCompat
Expand Down Expand Up @@ -88,6 +90,11 @@ abstract class BaseActivity<D : Design<*>> : AppCompatActivity(),
super.onCreate(savedInstanceState)
applyDayNight()

// Apply excludeFromRecents setting to all app tasks.
checkNotNull(getSystemService<ActivityManager>()).appTasks.forEach { task ->
task.setExcludeFromRecents(uiStore.hideFromRecents)
}

launch {
main()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ class AppSettingsDesign(
}
}

switch(
value = uiStore::hideFromRecents,
icon = R.drawable.ic_baseline_stack,
title = R.string.hide_from_recents_title,
summary = R.string.hide_from_recents_desc,
) {
listener = OnChangedListener {
requests.trySend(Request.ReCreateAllActivities)
}
}

category(R.string.service)

switch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class UiStore(context: Context) {
defaultValue = false
)

var hideFromRecents: Boolean by store.boolean(
key = "hide_from_recents",
defaultValue = false,
)

var proxyExcludeNotSelectable by store.boolean(
key = "proxy_exclude_not_selectable",
defaultValue = false,
Expand Down
10 changes: 10 additions & 0 deletions design/src/main/res/drawable/ic_baseline_stack.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@android:color/white"
android:pathData="M1024,320 L512,64 0,320l512,256L1024,320zM512,149 L854,320 512,491 170,320 512,149zM921.4,460.7 L1024,512 512,768 0,512 102.6,460.7 512,665.4ZM921.4,652.7 L1024,704 512,960 0,704 102.6,652.7 512,857.4Z" />
</vector>
2 changes: 2 additions & 0 deletions design/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<string name="global_mode">全局模式</string>
<string name="hide_app_icon_title">隐藏应用图标</string>
<string name="hide_app_icon_desc">可以在拨号盘输入 *#*#252746382#*#* 打开应用</string>
<string name="hide_from_recents_title">从最近任务隐藏</string>
<string name="hide_from_recents_desc">在最近任务中隐藏应用</string>
<string name="history">历史</string>
<string name="import_from_file">从文件导入</string>
<string name="import_from_url">从 URL 导入</string>
Expand Down
2 changes: 2 additions & 0 deletions design/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@

<string name="hide_app_icon_title">Hide App Icon</string>
<string name="hide_app_icon_desc">You can dial *#*#252746382#*#* to open this App</string>
<string name="hide_from_recents_title">Hide from Recents</string>
<string name="hide_from_recents_desc">Hide app from the Recent apps screen</string>
<string name="import_from_qr_no_permission">Camera access is restricted. Please enable it in Settings.</string>
<string name="import_from_qr_exception">An unhandled system exception occurred.</string>
</resources>
Loading