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 310d3af7..86e648fe 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 5f3c9e95..e056a8cb 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 bb87f387..ccc6adeb 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 a4467e27..568a4e82 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 14bc0896..f3779193 100644 --- a/V2rayNG/app/src/main/res/values-fa/strings.xml +++ b/V2rayNG/app/src/main/res/values-fa/strings.xml @@ -155,7 +155,7 @@ عضویت در گروه تلگرام برنامه تلگرام پیدا نشد - تبلیغات، + تبلیغات تبلیغات، برای جزئیات بیشتر کلیک کنید (کمک مالی کنید تا حذف شود) سطح گزارشات @@ -181,7 +181,7 @@ تاخیر واقعی همه پیکربندی پرونده‌های دارایی جغرافیا مرتب‌سازی بر اساس نتایج آزمایش - فیلتر پرونده پیکربندی + فیلتر پرونده پیکربندی ها همه گروه‌های اشتراک حذف %d کانفیگ تکراری @@ -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 00000000..0db2387c --- /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 1eb03fde..41663951 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 ebe9e3a9..1fbd3d1b 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 fa47d25b..738ace60 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 9970045f..07296e20 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 42c0dddc..6a539045 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 2a157914..20e87b89 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