From f6b3fd99077428e1a8825b75ba25ad1737534bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 2 Feb 2024 17:52:57 +0800 Subject: [PATCH] Reformat code --- .../main/java/io/nekohasekai/sfa/bg/VPNService.kt | 13 +++++++------ .../io/nekohasekai/sfa/ui/main/DashboardFragment.kt | 2 ++ .../java/io/nekohasekai/sfa/utils/CommandClient.kt | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt b/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt index 2131773..12c4fc0 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt @@ -31,6 +31,7 @@ class VPNService : VpnService(), PlatformInterfaceWrapper { } return service.onBind(intent) } + override fun onDestroy() { service.onDestroy() } @@ -96,14 +97,14 @@ class VPNService : VpnService(), PlatformInterfaceWrapper { } val inet4RouteExcludeAddress = options.inet4RouteExcludeAddress - while (inet4RouteExcludeAddress.hasNext()) { - builder.excludeRoute(inet4RouteExcludeAddress.next().toIpPrefix()) - } + while (inet4RouteExcludeAddress.hasNext()) { + builder.excludeRoute(inet4RouteExcludeAddress.next().toIpPrefix()) + } val inet6RouteExcludeAddress = options.inet6RouteExcludeAddress - while (inet6RouteExcludeAddress.hasNext()) { - builder.excludeRoute(inet6RouteExcludeAddress.next().toIpPrefix()) - } + while (inet6RouteExcludeAddress.hasNext()) { + builder.excludeRoute(inet6RouteExcludeAddress.next().toIpPrefix()) + } } else { val inet4RouteAddress = options.inet4RouteRange if (inet4RouteAddress.hasNext()) { diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt b/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt index 376aef4..e63c55c 100644 --- a/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt +++ b/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt @@ -42,6 +42,7 @@ class DashboardFragment : Fragment(R.layout.fragment_dashboard) { Status.Stopped -> { disablePager() } + Status.Started -> { enablePager() } @@ -49,6 +50,7 @@ class DashboardFragment : Fragment(R.layout.fragment_dashboard) { Status.Stopping -> { disablePager() } + else -> {} } } diff --git a/app/src/main/java/io/nekohasekai/sfa/utils/CommandClient.kt b/app/src/main/java/io/nekohasekai/sfa/utils/CommandClient.kt index fa79d1f..1f8c2bc 100644 --- a/app/src/main/java/io/nekohasekai/sfa/utils/CommandClient.kt +++ b/app/src/main/java/io/nekohasekai/sfa/utils/CommandClient.kt @@ -108,7 +108,7 @@ open class CommandClient( } override fun clearLog() { - handler.clearLog() + handler.clearLog() } override fun writeLog(message: String?) {