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
15 changes: 15 additions & 0 deletions app/src/main/java/io/nekohasekai/sagernet/ui/GroupFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,18 @@ class GroupFragment :
.setNegativeButton(android.R.string.cancel, null)
.show()
}

R.id.action_delete_group -> {
MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.confirm)
.setMessage(R.string.delete_group_prompt)
.setPositiveButton(R.string.yes) { _, _ ->
runOnDefaultDispatcher {
GroupManager.deleteGroup(proxyGroup.id)
}
}
.setNegativeButton(android.R.string.cancel, null)
.show()
}
}

return true
Expand Down Expand Up @@ -414,6 +426,9 @@ class GroupFragment :
if (proxyGroup.type != GroupType.SUBSCRIPTION) {
popup.menu.removeItem(R.id.action_share_subscription)
}
if (proxyGroup.ungrouped || proxyGroup.id in GroupUpdater.updating) {
popup.menu.removeItem(R.id.action_delete_group)
}
popup.setOnMenuItemClickListener(this)
popup.show()
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/menu/group_action_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@
<item
android:id="@+id/action_clear"
android:title="@string/clear_profiles" />
<item
android:id="@+id/action_delete_group"
android:title="@string/delete" />
</menu>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing newline at end of file

The file is missing a trailing newline (the diff shows \ No newline at end of file). Most editors and POSIX tools expect files to end with a newline, and the rest of the menu XML files in this project include one. This can cause spurious diff noise in future changes.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Loading