diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt index 310d3af77..86e648fea 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt @@ -228,7 +228,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter() { +class SubSettingRecyclerAdapter(val activity: SubSettingActivity) : + RecyclerView.Adapter() { private var mActivity: SubSettingActivity = activity private val subStorage by lazy { MMKV.mmkvWithID(MmkvManager.ID_SUB, MMKV.MULTI_PROCESS_MODE) } + private val share_method: Array by lazy { + mActivity.resources.getStringArray(R.array.share_sub_method) + } + override fun getItemCount() = mActivity.subscriptions.size override fun onBindViewHolder(holder: MainViewHolder, position: Int) { @@ -31,7 +45,8 @@ class SubSettingRecyclerAdapter(val activity: SubSettingActivity) : RecyclerView holder.itemView.setBackgroundColor(Color.TRANSPARENT) holder.itemSubSettingBinding.layoutEdit.setOnClickListener { - mActivity.startActivity(Intent(mActivity, SubEditActivity::class.java) + mActivity.startActivity( + Intent(mActivity, SubEditActivity::class.java) .putExtra("subId", subId) ) } @@ -40,11 +55,51 @@ class SubSettingRecyclerAdapter(val activity: SubSettingActivity) : RecyclerView subStorage?.encode(subId, Gson().toJson(subItem)) notifyItemChanged(position) } + + if (TextUtils.isEmpty(subItem.url)) { + holder.itemSubSettingBinding.layoutShare.visibility = View.INVISIBLE + } else { + holder.itemSubSettingBinding.layoutShare.setOnClickListener { + AlertDialog.Builder(mActivity) + .setItems(share_method.asList().toTypedArray()) { _, i -> + try { + when (i) { + 0 -> { + val ivBinding = + ItemQrcodeBinding.inflate(LayoutInflater.from(mActivity)) + ivBinding.ivQcode.setImageBitmap( + QRCodeDecoder.createQRCode( + subItem.url + + ) + ) + AlertDialog.Builder(mActivity).setView(ivBinding.root).show() + } + + 1 -> { + Utils.setClipboard(mActivity, subItem.url) + } + + else -> mActivity.toast("else") + } + } catch (e: Exception) { + e.printStackTrace() + } + }.show() + } + } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MainViewHolder { - return MainViewHolder(ItemRecyclerSubSettingBinding.inflate(LayoutInflater.from(parent.context), parent, false)) + return MainViewHolder( + ItemRecyclerSubSettingBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + ) } - class MainViewHolder(val itemSubSettingBinding: ItemRecyclerSubSettingBinding) : RecyclerView.ViewHolder(itemSubSettingBinding.root) + class MainViewHolder(val itemSubSettingBinding: ItemRecyclerSubSettingBinding) : + RecyclerView.ViewHolder(itemSubSettingBinding.root) } diff --git a/V2rayNG/app/src/main/res/layout/activity_main.xml b/V2rayNG/app/src/main/res/layout/activity_main.xml index 5f3c9e952..e056a8cbd 100644 --- a/V2rayNG/app/src/main/res/layout/activity_main.xml +++ b/V2rayNG/app/src/main/res/layout/activity_main.xml @@ -50,7 +50,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/connection_test_height" android:background="?attr/colorPrimary" - android:gravity="center|left" + android:gravity="center|start" android:nextFocusRight="@+id/fab" android:clickable="true" android:focusable="true" diff --git a/V2rayNG/app/src/main/res/layout/activity_sub_setting.xml b/V2rayNG/app/src/main/res/layout/activity_sub_setting.xml index bb87f3872..ccc6adeb4 100644 --- a/V2rayNG/app/src/main/res/layout/activity_sub_setting.xml +++ b/V2rayNG/app/src/main/res/layout/activity_sub_setting.xml @@ -16,7 +16,8 @@ + android:layout_height="match_parent" + tools:listitem="@layout/item_recycler_sub_setting"/> \ No newline at end of file diff --git a/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml b/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml index a4467e272..568a4e82a 100644 --- a/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml +++ b/V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml @@ -73,12 +73,13 @@ android:gravity="center" android:orientation="vertical" android:padding="@dimen/layout_margin_spacing" - android:visibility="invisible"> + > + android:src="@drawable/ic_share_black_24dp" + app:tint="?attr/colorMainText"/> diff --git a/V2rayNG/app/src/main/res/values-fa/strings.xml b/V2rayNG/app/src/main/res/values-fa/strings.xml index 30accc69b..d59ad51bb 100644 --- a/V2rayNG/app/src/main/res/values-fa/strings.xml +++ b/V2rayNG/app/src/main/res/values-fa/strings.xml @@ -147,29 +147,29 @@ تایید حذف پرونده پیکربندی آیا برای حذف پرونده پیکربندی نیاز به تایید دوم توسط کاربر است - Start scanning immediately - Open the camera to scan immediately at startup, otherwise you can choose to scan the code or select a photo in the toolbar + فورا اسکن را شروع کن + دوربین را برای اسکن بلافاصله در هنگام راه اندازی باز کنید، در غیر این صورت می توانید کد را اسکن کنید یا عکسی را در نوار ابزار انتخاب کنید. بازخورد بهبودهای بازخورد یا اشکالات در گیت‌هاب عضویت در گروه تلگرام برنامه تلگرام پیدا نشد - تبلیغات، + تبلیغات تبلیغات، برای جزئیات بیشتر کلیک کنید (کمک مالی کنید تا حذف شود) سطح گزارشات حالت برای راهنمایی بیشتر روی این متن، کلیک کنید زبان - UI settings + تنظیمات رابط کاربری گزارشات کپی پاک کردن راه‌اندازی مجدد خدمات - حذف تمام پیکربندی - Delete duplicate config + حذف تمام پیکربندی ها + حذف پیکربندی های تکراری تنظیمات نامعتبر را حذف کنید (ابتدا آزمایش کنید) خروجی گرفتن پیکربندی‌های غیرسفارشی در کلیپ‌بورد تنظیمات گروه‌ی اشتراک @@ -181,7 +181,7 @@ تاخیر واقعی همه پیکربندی پرونده‌های دارایی جغرافیا مرتب‌سازی بر اساس نتایج آزمایش - فیلتر پرونده پیکربندی + فیلتر پرونده پیکربندی ها همه گروه‌های اشتراک Delete %d duplicate configurations @@ -211,6 +211,11 @@ خروجی گرفتن پیکربندی کامل در کلیپ‌بورد + + QRcode + خروجی گرفتن در کلیپ‌بورد + + نشانی اینترنتی یا آی‌پی پروکسی نشانی اینترنتی یا آی‌پی مستقیم diff --git a/V2rayNG/app/src/main/res/values-night/styles.xml b/V2rayNG/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..0db2387c4 --- /dev/null +++ b/V2rayNG/app/src/main/res/values-night/styles.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/V2rayNG/app/src/main/res/values-ru/strings.xml b/V2rayNG/app/src/main/res/values-ru/strings.xml index 1eb03fde0..416639511 100644 --- a/V2rayNG/app/src/main/res/values-ru/strings.xml +++ b/V2rayNG/app/src/main/res/values-ru/strings.xml @@ -216,6 +216,11 @@ Экспорт всего профиля в буфер обмена + + QR-код + Экспорт в буфер обмена + + Проксируемые Прямые diff --git a/V2rayNG/app/src/main/res/values-vi/strings.xml b/V2rayNG/app/src/main/res/values-vi/strings.xml index ebe9e3a9a..1fbd3d1be 100644 --- a/V2rayNG/app/src/main/res/values-vi/strings.xml +++ b/V2rayNG/app/src/main/res/values-vi/strings.xml @@ -210,6 +210,11 @@ Sao chép thành cấu hình tùy chỉnh + + Xuất ra mã QR (Chụp màn hình để lưu) + Sao chép cấu hình này + + Proxy URL hoặc IP Direct URL hoặc IP diff --git a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml index fa47d25ba..738ace608 100644 --- a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml @@ -209,6 +209,12 @@ 导出至剪贴板 导出完整配置至剪贴板 + + + 二维码 + 导出至剪贴板 + + share_method 代理的网址或IP diff --git a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml index 9970045fc..07296e201 100644 --- a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml @@ -210,6 +210,11 @@ 匯出完整組態至剪貼簿 + + QR Code + 匯出至剪貼簿 + + Proxy URL 或 IP 直接連線 URL 或 IP diff --git a/V2rayNG/app/src/main/res/values/strings.xml b/V2rayNG/app/src/main/res/values/strings.xml index 42c0dddcb..6a5390456 100644 --- a/V2rayNG/app/src/main/res/values/strings.xml +++ b/V2rayNG/app/src/main/res/values/strings.xml @@ -218,6 +218,11 @@ Export full configuration to clipboard + + QRcode + Export to clipboard + + proxy URL or IP direct URL or IP diff --git a/V2rayNG/app/src/main/res/values/styles.xml b/V2rayNG/app/src/main/res/values/styles.xml index 2a1579149..20e87b896 100644 --- a/V2rayNG/app/src/main/res/values/styles.xml +++ b/V2rayNG/app/src/main/res/values/styles.xml @@ -6,6 +6,8 @@ @color/colorAccent @color/colorBg @color/colorText + @color/colorPrimary + @color/colorPrimary