diff --git a/.gitignore b/.gitignore index a169a396..7aeb9514 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ gradle-app.setting !/core/src/foss/golang/.idea/codeStyles /core/src/premium/golang/.idea/* !/core/src/premium/golang/.idea/codeStyles +/core/src/main/cpp/version.h # Ignore builtin geofiles app/src/main/assets diff --git a/app/src/main/java/com/github/kr328/clash/MainActivity.kt b/app/src/main/java/com/github/kr328/clash/MainActivity.kt index dac30176..bfe256c4 100644 --- a/app/src/main/java/com/github/kr328/clash/MainActivity.kt +++ b/app/src/main/java/com/github/kr328/clash/MainActivity.kt @@ -1,22 +1,38 @@ package com.github.kr328.clash +import android.app.ActivityManager +import android.os.Bundle import androidx.activity.result.contract.ActivityResultContracts +import androidx.lifecycle.lifecycleScope import com.github.kr328.clash.common.util.intent import com.github.kr328.clash.common.util.ticker +import com.github.kr328.clash.core.bridge.Bridge import com.github.kr328.clash.design.MainDesign import com.github.kr328.clash.design.ui.ToastDuration import com.github.kr328.clash.util.startClashService import com.github.kr328.clash.util.stopClashService import com.github.kr328.clash.util.withClash import com.github.kr328.clash.util.withProfile -import com.github.kr328.clash.core.bridge.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch import kotlinx.coroutines.selects.select import kotlinx.coroutines.withContext import java.util.concurrent.TimeUnit class MainActivity : BaseActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + lifecycleScope.launch { + (getSystemService(ACTIVITY_SERVICE) as ActivityManager).let { manager -> + manager.appTasks.forEach { task -> + task?.setExcludeFromRecents(uiStore.excludeFromRecents) + } + } + } + } + override suspend fun main() { val design = MainDesign(this) diff --git a/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt index ad296de5..aa8e597e 100644 --- a/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt +++ b/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt @@ -65,6 +65,13 @@ class AppSettingsDesign( } } + switch( + value = uiStore::excludeFromRecents, + icon = R.drawable.eye_off, + title = R.string.exclude_from_recents, + summary = R.string.exclude_from_recents_summary, + ) + category(R.string.service) switch( diff --git a/design/src/main/java/com/github/kr328/clash/design/store/UiStore.kt b/design/src/main/java/com/github/kr328/clash/design/store/UiStore.kt index f0202a64..87ee7e62 100644 --- a/design/src/main/java/com/github/kr328/clash/design/store/UiStore.kt +++ b/design/src/main/java/com/github/kr328/clash/design/store/UiStore.kt @@ -62,6 +62,11 @@ class UiStore(context: Context) { defaultValue = false, ) + var excludeFromRecents: Boolean by store.boolean( + key = "exclude_from_recents", + defaultValue = false + ) + companion object { private const val PREFERENCE_NAME = "ui" } diff --git a/design/src/main/res/drawable/eye_off.xml b/design/src/main/res/drawable/eye_off.xml new file mode 100644 index 00000000..13f8c682 --- /dev/null +++ b/design/src/main/res/drawable/eye_off.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/design/src/main/res/values-vi/strings.xml b/design/src/main/res/values-vi/strings.xml index 2ff4f708..6c446b5a 100644 --- a/design/src/main/res/values-vi/strings.xml +++ b/design/src/main/res/values-vi/strings.xml @@ -11,13 +11,9 @@ Mixed Chế độ xếp chồng dữ liệu Hệ thống - Clash Meta - Clash Meta Clash Meta Core Clash Meta Clash Meta Wiki - Clash Meta - Clash Meta Mới Thông tin Chỉ chấp nhận http(s) diff --git a/design/src/main/res/values-zh/strings.xml b/design/src/main/res/values-zh/strings.xml index cf60e1e1..926889ad 100644 --- a/design/src/main/res/values-zh/strings.xml +++ b/design/src/main/res/values-zh/strings.xml @@ -56,6 +56,8 @@ 参数 代理 近期 + 后台隐藏 + 在[最近任务]中隐藏本应用 自动路由系统流量 通过 VpnService 自动路由所有系统流量 规则模式 diff --git a/design/src/main/res/values/strings.xml b/design/src/main/res/values/strings.xml index 622adbb9..5616ec65 100644 --- a/design/src/main/res/values/strings.xml +++ b/design/src/main/res/values/strings.xml @@ -1,8 +1,8 @@ - Clash Meta - Clash Meta Alpha - Clash Meta for Android - Clash Meta for Android Alpha + Clash Meta + Clash Meta Alpha + Clash Meta for Android + Clash Meta for Android Alpha Stopped Tap to start @@ -112,6 +112,9 @@ Auto Restart Allow clash auto restart + Exclude From Recents + Hide this app in Recent Tasks + Route System Traffic Auto routing all system traffic via VpnService diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 50955b7f..c5eedd51 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -4,5 +4,4 @@ distributionSha256Sum=fe696c020f241a5f69c30f763c5a7f38eec54b490db19cd2b0962dda42 distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionSha256Sum=fe696c020f241a5f69c30f763c5a7f38eec54b490db19cd2b0962dda420d7d12 \ No newline at end of file +zipStorePath=wrapper/dists \ No newline at end of file