From e525812dc79a7c515b3c895d0f77363aaacf437a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 6 Aug 2023 08:06:50 +0800 Subject: [PATCH] Fixes --- .../nekohasekai/sfa/bg/ServiceNotification.kt | 7 ++---- .../sfa/ui/dashboard/GroupsFragment.kt | 20 ++++++++++-------- .../sfa/ui/main/ConfigurationFragment.kt | 3 --- app/src/main/res/drawable/ic_menu.png | Bin 0 -> 2108 bytes 4 files changed, 13 insertions(+), 17 deletions(-) create mode 100644 app/src/main/res/drawable/ic_menu.png diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/ServiceNotification.kt b/app/src/main/java/io/nekohasekai/sfa/bg/ServiceNotification.kt index 781b5a0..0c50003 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/ServiceNotification.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/ServiceNotification.kt @@ -24,10 +24,7 @@ class ServiceNotification(private val service: Service) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { return true } - if (Application.notification.areNotificationsEnabled()) { - return true - } - return false + return Application.notification.areNotificationsEnabled() } } @@ -36,7 +33,7 @@ class ServiceNotification(private val service: Service) { NotificationCompat.Builder(service, notificationChannel).setWhen(0) .setContentTitle("sing-box") .setContentText("service started").setOnlyAlertOnce(true) - .setSmallIcon(R.drawable.ic_launcher_foreground) + .setSmallIcon(R.drawable.ic_menu) .setCategory(NotificationCompat.CATEGORY_SERVICE) .setContentIntent( PendingIntent.getActivity( diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/dashboard/GroupsFragment.kt b/app/src/main/java/io/nekohasekai/sfa/ui/dashboard/GroupsFragment.kt index 0958ab2..b6399e7 100644 --- a/app/src/main/java/io/nekohasekai/sfa/ui/dashboard/GroupsFragment.kt +++ b/app/src/main/java/io/nekohasekai/sfa/ui/dashboard/GroupsFragment.kt @@ -274,15 +274,17 @@ class GroupsFragment : Fragment(), CommandClientHandler { RecyclerView.ViewHolder(binding.root) { fun bind(groupView: GroupView, group: OutboundGroup, item: OutboundGroupItem) { - binding.itemCard.setOnClickListener { - binding.selectedView.isVisible = true - groupView.updateSelected(group, item) - GlobalScope.launch { - runCatching { - Libbox.newStandaloneCommandClient().selectOutbound(group.tag, item.tag) - }.onFailure { - withContext(Dispatchers.Main) { - binding.root.context.errorDialogBuilder(it).show() + if (group.selectable) { + binding.itemCard.setOnClickListener { + binding.selectedView.isVisible = true + groupView.updateSelected(group, item) + GlobalScope.launch { + runCatching { + Libbox.newStandaloneCommandClient().selectOutbound(group.tag, item.tag) + }.onFailure { + withContext(Dispatchers.Main) { + binding.root.context.errorDialogBuilder(it).show() + } } } } diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/main/ConfigurationFragment.kt b/app/src/main/java/io/nekohasekai/sfa/ui/main/ConfigurationFragment.kt index e58e71d..1b3b9c4 100644 --- a/app/src/main/java/io/nekohasekai/sfa/ui/main/ConfigurationFragment.kt +++ b/app/src/main/java/io/nekohasekai/sfa/ui/main/ConfigurationFragment.kt @@ -169,9 +169,6 @@ class ConfigurationFragment : Fragment() { val popup = PopupMenu(button.context, button) popup.setForceShowIcon(true) popup.menuInflater.inflate(R.menu.profile_menu, popup.menu) - if (profile.typed.type != TypedProfile.Type.Remote) { - popup.menu.removeItem(R.id.action_share) - } popup.setOnMenuItemClickListener { when (it.itemId) { R.id.action_share -> { diff --git a/app/src/main/res/drawable/ic_menu.png b/app/src/main/res/drawable/ic_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..f61e73e540a6b311132383e01f46b9debb2f0f9a GIT binary patch literal 2108 zcmV-C2*dY@P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91L7)Qw1ONa40RR91N&o-=0ErpjdW~BsMabJ!GL0yTC?sZ#hN;99WXQ0>cg{LG@&Xb830|NOrTPo8TmMu(_lKBIP;d9t5liLo#G9KN^Xjo zpUZCkj)z5{Ug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