From c99fda9839f4d89a28c5654ce01c3b783975aea2 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 15 Jan 2026 11:11:16 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayNG/issues/5158 --- .../com/v2ray/ang/ui/MainRecyclerAdapter.kt | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainRecyclerAdapter.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainRecyclerAdapter.kt index f54b4d27..64c814e5 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainRecyclerAdapter.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainRecyclerAdapter.kt @@ -280,22 +280,22 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter - removeServerSub(guid, position) - } - .setNegativeButton(android.R.string.cancel) { _, _ -> - //do noting - } - .show() - } else { - removeServerSub(guid, position) - } - } else { + if (guid == MmkvManager.getSelectServer()) { application.toast(R.string.toast_action_not_allowed) } + + if (MmkvManager.decodeSettingsBool(AppConfig.PREF_CONFIRM_REMOVE)) { + AlertDialog.Builder(mActivity).setMessage(R.string.del_config_comfirm) + .setPositiveButton(android.R.string.ok) { _, _ -> + removeServerSub(guid, position) + } + .setNegativeButton(android.R.string.cancel) { _, _ -> + //do noting + } + .show() + } else { + removeServerSub(guid, position) + } } /** @@ -305,8 +305,12 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter= 0) { + data.removeAt(idx) + notifyItemRemoved(idx) + notifyItemRangeChanged(idx, data.size - idx) + } } /**