Skip to content

Commit

Permalink
Merge pull request #3020 from FranzKafkaYu/optimize-ui-logic
Browse files Browse the repository at this point in the history
style:optimize UI logic
  • Loading branch information
2dust committed Apr 18, 2024
2 parents ddb908f + 304c7ed commit 70e9320
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 1 deletion.
9 changes: 9 additions & 0 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt
Expand Up @@ -329,6 +329,9 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
MmkvManager.removeAllServer()
mainViewModel.reloadServerList()
}
.setNegativeButton(android.R.string.no) {_, _ ->
//do noting
}
.show()
true
}
Expand All @@ -337,6 +340,9 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
.setPositiveButton(android.R.string.ok) { _, _ ->
mainViewModel.removeDuplicateServer()
}
.setNegativeButton(android.R.string.no) {_, _ ->
//do noting
}
.show()
true
}
Expand All @@ -346,6 +352,9 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
MmkvManager.removeInvalidServer()
mainViewModel.reloadServerList()
}
.setNegativeButton(android.R.string.no) {_, _ ->
//do noting
}
.show()
true
}
Expand Down
Expand Up @@ -11,6 +11,7 @@ import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import com.google.gson.Gson
import com.tencent.mmkv.MMKV
import com.v2ray.ang.AngApplication.Companion.application
import com.v2ray.ang.AppConfig
import com.v2ray.ang.R
import com.v2ray.ang.databinding.ItemQrcodeBinding
Expand Down Expand Up @@ -144,10 +145,15 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
.setPositiveButton(android.R.string.ok) { _, _ ->
removeServer(guid, position)
}
.setNegativeButton(android.R.string.no) {_, _ ->
//do noting
}
.show()
} else {
removeServer(guid, position)
}
} else {
application.toast(R.string.toast_action_not_allowed)
}
}

Expand Down
Expand Up @@ -8,6 +8,7 @@ import android.view.View
import android.widget.*
import androidx.appcompat.app.AlertDialog
import com.tencent.mmkv.MMKV
import com.v2ray.ang.AngApplication
import com.v2ray.ang.AppConfig
import com.v2ray.ang.AppConfig.PREF_ALLOW_INSECURE
import com.v2ray.ang.AppConfig.WIREGUARD_LOCAL_ADDRESS_V4
Expand Down Expand Up @@ -209,7 +210,7 @@ class ServerActivity : BaseActivity() {
}

/**
* bingding seleced server config
* binding selected server config
*/
private fun bindingServer(config: ServerConfig): Boolean {
val outbound = config.getProxyOutbound() ?: return false
Expand Down Expand Up @@ -560,11 +561,16 @@ class ServerActivity : BaseActivity() {
MmkvManager.removeServer(editGuid)
finish()
}
.setNegativeButton(android.R.string.no) { _, _ ->
// do nothing
}
.show()
} else {
MmkvManager.removeServer(editGuid)
finish()
}
} else {
application.toast(R.string.toast_action_not_allowed)
}
}
return true
Expand Down
Expand Up @@ -111,6 +111,9 @@ class ServerCustomConfigActivity : BaseActivity() {
MmkvManager.removeServer(editGuid)
finish()
}
.setNegativeButton(android.R.string.no) {_, _ ->
// do nothing
}
.show()
}
return true
Expand Down
Expand Up @@ -111,6 +111,9 @@ class SubEditActivity : BaseActivity() {
MmkvManager.removeSubscription(editSubId)
finish()
}
.setNegativeButton(android.R.string.no) {_, _ ->
// do nothing
}
.show()
}
return true
Expand Down
Expand Up @@ -114,6 +114,9 @@ class UserAssetUrlActivity : BaseActivity() {
MmkvManager.removeAssetUrl(editAssetId)
finish()
}
.setNegativeButton(android.R.string.no) {_, _ ->
// do nothing
}
.show()
}
return true
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values-ar/strings.xml
Expand Up @@ -78,6 +78,7 @@
<string name="toast_asset_copy_failed">فشل نسخ الملف، يرجى استخدام مدير الملفات</string>
<string name="menu_item_add_file">إضافة ملفات</string>
<string name="menu_item_download_file">تحميل الملفات</string>
<string name="toast_action_not_allowed">هذا الإجراء محظور</string>
<!-- PerAppProxyActivity -->
<string name="title_user_asset_add_url">أضف عنوان URL للأصل</string>
<string name="msg_file_not_found">لم يتم العثور على الملف</string>
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values-fa/strings.xml
Expand Up @@ -80,6 +80,7 @@
<string name="toast_asset_copy_failed">کپی فایل انجام نشد، لطفا از برنامه مدیریت فایل استفاده کنید</string>
<string name="menu_item_add_file">افزودن فایل‌ها</string>
<string name="menu_item_download_file">دانلود فایل‌ها</string>
<string name="toast_action_not_allowed">این عمل ممنوع است</string>

<!-- PerAppProxyActivity -->
<string name="title_user_asset_add_url">URL را اضافه کنید</string>
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values-ru/strings.xml
Expand Up @@ -85,6 +85,7 @@
<string name="title_user_asset_add_url">Добавить URL ресурса</string>
<string name="msg_file_not_found">Файл не найден</string>
<string name="msg_remark_is_duplicate">Описание уже существует</string>
<string name="toast_action_not_allowed">Это действие запрещено</string>

<!-- PerAppProxyActivity -->
<string name="msg_dialog_progress">Загрузка…</string>
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values-vi/strings.xml
Expand Up @@ -80,6 +80,7 @@
<string name="toast_asset_copy_failed">Không thể sao chép tệp tin, hãy dùng trình quản lý tệp!</string>
<string name="menu_item_add_file">Thêm tệp</string>
<string name="menu_item_download_file">Tải xuống tệp tin</string>
<string name="toast_action_not_allowed">Hành động này bị cấm</string>

<!-- PerAppProxyActivity -->
<string name="title_user_asset_add_url">Thêm URL nội dung</string>
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values-zh-rCN/strings.xml
Expand Up @@ -80,6 +80,7 @@
<string name="toast_asset_copy_failed">失败, 请使用文件管理器</string>
<string name="menu_item_add_file">添加文件</string>
<string name="menu_item_download_file">下载文件</string>
<string name="toast_action_not_allowed">禁止此项操作</string>


<!-- PerAppProxyActivity -->
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values-zh-rTW/strings.xml
Expand Up @@ -80,6 +80,7 @@
<string name="toast_asset_copy_failed">失敗,請使用檔案總管</string>
<string name="menu_item_add_file">新增檔案</string>
<string name="menu_item_download_file">下載檔案</string>
<string name="toast_action_not_allowed">禁止此項操作</string>

<!-- PerAppProxyActivity -->
<string name="title_user_asset_add_url">新增資產網址</string>
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values/strings.xml
Expand Up @@ -93,6 +93,7 @@
<string name="title_user_asset_add_url">Add asset URL</string>
<string name="msg_file_not_found">File not found</string>
<string name="msg_remark_is_duplicate">The remarks already exists</string>
<string name="toast_action_not_allowed">Action not allowed</string>


<!-- PerAppProxyActivity -->
Expand Down

0 comments on commit 70e9320

Please sign in to comment.