Compare commits

...

7 Commits
1.7.0 ... 1.7.2

Author SHA1 Message Date
2dust
c633a267ff Merge pull request #1393 from yuhan6665/master
Update readme and sync project
2022-02-27 08:55:34 +08:00
yuhan6665
c8e5bf4f9f Update project 2022-02-26 12:15:46 -05:00
2dust
bb91b3baa9 onModeHelpClicked 2022-02-26 12:05:02 -05:00
2dust
35dc8d661c Update AndroidManifest.xml 2022-02-26 12:05:02 -05:00
2dust
f61f30fdc4 change sdk version 2022-02-26 12:05:02 -05:00
2dust
a54c327a07 Merge pull request #1374 from Kaitul/patch-1
Update strings.xml
2022-02-26 19:21:22 +08:00
人工知能
87d2854fb2 Update strings.xml 2022-02-15 12:48:44 +08:00
32 changed files with 235 additions and 183 deletions

View File

@@ -2,8 +2,8 @@
A V2Ray client for Android, support [Xray core](https://github.com/XTLS/Xray-core) and [v2fly core](https://github.com/v2fly/v2ray-core)
[![API](https://img.shields.io/badge/API-17%2B-yellow.svg?style=flat)](https://developer.android.com/about/versions/jelly-bean#android-4.2)
[![Kotlin Version](https://img.shields.io/badge/Kotlin-1.5.10-blue.svg)](https://kotlinlang.org)
[![API](https://img.shields.io/badge/API-21%2B-yellow.svg?style=flat)](https://developer.android.com/about/versions/lollipop)
[![Kotlin Version](https://img.shields.io/badge/Kotlin-1.6.10-blue.svg)](https://kotlinlang.org)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/2dust/v2rayNG)](https://github.com/2dust/v2rayNG/commits/master)
[![CodeFactor](https://www.codefactor.io/repository/github/2dust/v2rayng/badge)](https://www.codefactor.io/repository/github/2dust/v2rayng)
[![GitHub Releases](https://img.shields.io/github/downloads/2dust/v2rayNG/latest/total?logo=github)](https://github.com/2dust/v2rayNG/releases)
@@ -16,15 +16,12 @@ A V2Ray client for Android, support [Xray core](https://github.com/XTLS/Xray-cor
### Usage
#### Geoip and Geosite
v2rayNG release already embedded domain file `geoip.dat` and `geosite.dat`. However it is (probably) not the latest and not the most complete list.
For power user, the embedded files can be easily replaced with the following steps:
1. Launch v2rayNG (v1.4.9+)
2. Find existing geoip.dat and geosite.dat in `Android/data/com.v2ray.ang/files/assets` (path may differ on some Android device)
3. Replace them with the latest [domain list](https://github.com/v2fly/domain-list-community) and [ip list](https://github.com/v2fly/geoip)
4. Enhanced version can be found in this [repo](https://github.com/Loyalsoldier/v2ray-rules-dat) (recommend to use `geosite:geolocation-!cn` for proxy dns and routing)
5. It is also possible to use third party dat file in the same folder, like [h2y](https://guide.v2fly.org/routing/sitedata.html#%E5%A4%96%E7%BD%AE%E7%9A%84%E5%9F%9F%E5%90%8D%E6%96%87%E4%BB%B6)
- geoip.dat and geosite.dat files are in `Android/data/com.v2ray.ang/files/assets` (path may differ on some Android device)
- download feature will get enhanced version in this [repo](https://github.com/Loyalsoldier/v2ray-rules-dat) (Note it need a working proxy)
- latest official [domain list](https://github.com/v2fly/domain-list-community) and [ip list](https://github.com/v2fly/geoip) can be imported manually
- possible to use third party dat file in the same folder, like [h2y](https://guide.v2fly.org/routing/sitedata.html#%E5%A4%96%E7%BD%AE%E7%9A%84%E5%9F%9F%E5%90%8D%E6%96%87%E4%BB%B6)
#### See more in our [wiki](https://github.com/2dust/v2rayNG/wiki)
### More in our [wiki](https://github.com/2dust/v2rayNG/wiki)
### Development guide
@@ -32,4 +29,4 @@ Android project under V2rayNG folder can be compiled directly in Android Studio,
The aar can be compiled from the Golang project under AndroidLibV2rayLite folder. For a quick start, read guide for [Go Mobile](https://github.com/golang/go/wiki/Mobile)
and [Makefiles for Go Developers](https://tutorialedge.net/golang/makefiles-for-go-developers/)
v2rayNG can run on Android Emulators, with minimum Android 5.0
v2rayNG can run on Android Emulators. But VPN mode will not work if system don't support it, like Windows 11 WSA

View File

@@ -13,7 +13,7 @@ android {
defaultConfig {
applicationId "com.v2ray.ang"
minSdkVersion 17
minSdkVersion 21
targetSdkVersion Integer.parseInt("$targetSdkVer")
multiDexEnabled true
versionCode 212
@@ -59,7 +59,9 @@ android {
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
output.outputFileName = "v2rayNG_" + variant.versionName + "_" + output.getFilter(com.android.build.OutputFile.ABI) + ".apk"
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) *
1000000 + android.defaultConfig.versionCode
}
@@ -72,13 +74,13 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
// Androidx
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.3.0"
implementation "com.google.android.material:material:1.4.0"
implementation "androidx.appcompat:appcompat:1.4.1"
implementation "com.google.android.material:material:1.5.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.preference:preference:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.2.1"
@@ -86,17 +88,16 @@ dependencies {
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
// Androidx ktx
implementation 'androidx.activity:activity-ktx:1.2.4'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation 'com.tencent:mmkv-static:1.2.7'
implementation 'com.tencent:mmkv-static:1.2.12'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.reactivex:rxjava:1.3.4'
implementation 'io.reactivex:rxandroid:1.2.1'
@@ -105,15 +106,18 @@ dependencies {
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation 'com.blacksquircle.ui:editorkit:2.0.0'
implementation 'com.blacksquircle.ui:language-json:2.0.0'
implementation 'com.blacksquircle.ui:editorkit:2.1.1'
implementation 'com.blacksquircle.ui:language-base:2.1.1'
implementation 'com.blacksquircle.ui:language-json:2.1.1'
}
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion"

View File

@@ -28,17 +28,17 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
<uses-sdk tools:overrideLibrary="com.blacksquircle.ui.editorkit, com.blacksquircle.ui.language.json, com.blacksquircle.ui.language.base"/>
<application
android:name=".AngApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:extractNativeLibs="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="m">
<activity
android:exported="true"
android:name=".ui.MainActivity"
android:theme="@style/AppTheme.NoActionBar"
android:launchMode="singleTask">
@@ -59,24 +59,40 @@
android:resource="@xml/shortcuts" />
</activity>
<activity
android:exported="false"
android:name=".ui.ServerActivity"
android:windowSoftInputMode="stateUnchanged" />
<activity
android:exported="false"
android:name=".ui.ServerCustomConfigActivity"
android:windowSoftInputMode="stateUnchanged" />
<activity android:name=".ui.SettingsActivity" />
<activity android:name=".ui.PerAppProxyActivity" />
<activity android:name=".ui.ScannerActivity" />
<!-- <activity android:name=".InappBuyActivity" />-->
<activity android:name=".ui.LogcatActivity" />
<activity
android:exported="false"
android:name=".ui.SettingsActivity" />
<activity
android:exported="false"
android:name=".ui.PerAppProxyActivity" />
<activity
android:exported="false"
android:name=".ui.ScannerActivity" />
<activity
android:exported="false"
android:name=".ui.LogcatActivity" />
<activity
android:exported="false"
android:name=".ui.RoutingSettingsActivity"
android:windowSoftInputMode="stateUnchanged" />
<activity android:name=".ui.SubSettingActivity" />
<activity android:name=".ui.SubEditActivity" />
<activity android:name=".ui.ScScannerActivity" />
<activity
android:exported="false"
android:name=".ui.SubSettingActivity" />
<activity
android:exported="false"
android:name=".ui.SubEditActivity" />
<activity
android:exported="false"
android:name=".ui.ScScannerActivity" />
<activity
android:exported="false"
android:name=".ui.ScSwitchActivity"
android:excludeFromRecents="true"
android:process=":RunSoLibV2RayDaemon"
@@ -103,7 +119,9 @@
android:process=":RunSoLibV2RayDaemon">
</service>
<receiver android:name=".receiver.WidgetProvider"
<receiver
android:exported="false"
android:name=".receiver.WidgetProvider"
android:process=":RunSoLibV2RayDaemon">
<meta-data
android:name="android.appwidget.provider"
@@ -116,6 +134,7 @@
</receiver>
<service
android:exported="true"
android:name=".service.QSTileService"
android:icon="@drawable/ic_v"
android:label="@string/app_tile_name"
@@ -127,6 +146,7 @@
</service>
<!-- =====================Tasker===================== -->
<activity
android:exported="true"
android:name=".ui.TaskerActivity"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
@@ -135,7 +155,9 @@
</intent-filter>
</activity>
<receiver android:name=".receiver.TaskerReceiver"
<receiver
android:exported="true"
android:name=".receiver.TaskerReceiver"
android:process=":RunSoLibV2RayDaemon">
<intent-filter>
<action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING" />

View File

@@ -15,13 +15,13 @@ import java.net.URLConnection
val Context.v2RayApplication: AngApplication
get() = applicationContext as AngApplication
inline fun Context.toast(message: Int): Toast = ToastCompat
fun Context.toast(message: Int): Toast = ToastCompat
.makeText(this, message, Toast.LENGTH_SHORT)
.apply {
show()
}
inline fun Context.toast(message: CharSequence): Toast = ToastCompat
fun Context.toast(message: CharSequence): Toast = ToastCompat
.makeText(this, message, Toast.LENGTH_SHORT)
.apply {
show()

View File

@@ -6,6 +6,7 @@ import android.appwidget.AppWidgetProvider
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.os.Build
import android.widget.RemoteViews
import com.v2ray.ang.R
import com.v2ray.ang.AppConfig
@@ -21,16 +22,33 @@ class WidgetProvider : AppWidgetProvider() {
updateWidgetBackground(context, appWidgetManager, appWidgetIds, V2RayServiceManager.v2rayPoint.isRunning)
}
private fun updateWidgetBackground(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray, isRunning: Boolean) {
val remoteViews = RemoteViews(context.packageName, R.layout.widget_switch)
val intent = Intent(context, WidgetProvider::class.java)
intent.action = AppConfig.BROADCAST_ACTION_WIDGET_CLICK
val pendingIntent = PendingIntent.getBroadcast(context, R.id.layout_switch, intent, PendingIntent.FLAG_UPDATE_CURRENT)
val pendingIntent = PendingIntent.getBroadcast(
context,
R.id.layout_switch,
intent,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
} else {
PendingIntent.FLAG_UPDATE_CURRENT
})
remoteViews.setOnClickPendingIntent(R.id.layout_switch, pendingIntent)
if (isRunning) {
remoteViews.setInt(R.id.layout_switch, "setBackgroundResource", R.drawable.ic_rounded_corner_theme)
remoteViews.setInt(
R.id.layout_switch,
"setBackgroundResource",
R.drawable.ic_rounded_corner_theme
)
} else {
remoteViews.setInt(R.id.layout_switch, "setBackgroundResource", R.drawable.ic_rounded_corner_grey)
remoteViews.setInt(
R.id.layout_switch,
"setBackgroundResource",
R.drawable.ic_rounded_corner_grey
)
}
for (appWidgetId in appWidgetIds) {

View File

@@ -237,7 +237,11 @@ object V2RayServiceManager {
val startMainIntent = Intent(service, MainActivity::class.java)
val contentPendingIntent = PendingIntent.getActivity(service,
NOTIFICATION_PENDING_INTENT_CONTENT, startMainIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
} else {
PendingIntent.FLAG_UPDATE_CURRENT
})
val stopV2RayIntent = Intent(AppConfig.BROADCAST_ACTION_SERVICE)
stopV2RayIntent.`package` = ANG_PACKAGE
@@ -245,7 +249,11 @@ object V2RayServiceManager {
val stopV2RayPendingIntent = PendingIntent.getBroadcast(service,
NOTIFICATION_PENDING_INTENT_STOP_V2RAY, stopV2RayIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
} else {
PendingIntent.FLAG_UPDATE_CURRENT
})
val channelId =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

View File

@@ -132,8 +132,7 @@ class V2RayVpnService : VpnService(), ServiceControl {
builder.setSession(V2RayServiceManager.currentConfig?.remarks.orEmpty())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
settingsStorage?.decodeBool(AppConfig.PREF_PER_APP_PROXY) == true) {
if (settingsStorage?.decodeBool(AppConfig.PREF_PER_APP_PROXY) == true) {
val apps = settingsStorage?.decodeStringSet(AppConfig.PREF_PER_APP_PROXY_SET)
val bypassApps = settingsStorage?.decodeBool(AppConfig.PREF_BYPASS_APPS) ?: false
apps?.forEach {

View File

@@ -70,7 +70,7 @@ class LogcatActivity : BaseActivity() {
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_logcat, menu)
return super.onCreateOptionsMenu(menu)
}

View File

@@ -169,7 +169,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
super.onPause()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_main, menu)
return true
}

View File

@@ -188,7 +188,7 @@ class PerAppProxyActivity : BaseActivity() {
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_bypass_list, menu)
return super.onCreateOptionsMenu(menu)
}

View File

@@ -4,33 +4,38 @@ import android.Manifest
import android.app.Activity.RESULT_OK
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import androidx.fragment.app.Fragment
import androidx.preference.PreferenceManager
import android.view.*
import com.v2ray.ang.R
import com.v2ray.ang.util.Utils
import kotlinx.android.synthetic.main.fragment_routing_settings.*
import android.view.MenuInflater
import androidx.activity.result.contract.ActivityResultContracts
import com.tbruyelle.rxpermissions.RxPermissions
import com.v2ray.ang.AppConfig
import com.v2ray.ang.R
import com.v2ray.ang.databinding.FragmentRoutingSettingsBinding
import com.v2ray.ang.extension.toast
import com.v2ray.ang.extension.v2RayApplication
import com.v2ray.ang.util.Utils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import java.net.URL
class RoutingSettingsFragment : Fragment() {
private lateinit var binding: FragmentRoutingSettingsBinding
companion object {
private const val routing_arg = "routing_arg"
}
val defaultSharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(context) }
val defaultSharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(requireContext()) }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_routing_settings, container, false)
binding = FragmentRoutingSettingsBinding.inflate(layoutInflater)
return binding.root// inflater.inflate(R.layout.fragment_routing_settings, container, false)
}
fun newInstance(arg: String): Fragment {
@@ -45,7 +50,7 @@ class RoutingSettingsFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
val content = defaultSharedPreferences.getString(requireArguments().getString(routing_arg), "")
et_routing_content.text = Utils.getEditable(content!!)
binding.etRoutingContent.text = Utils.getEditable(content!!)
setHasOptionsMenu(true)
}
@@ -63,7 +68,7 @@ class RoutingSettingsFragment : Fragment() {
true
}
R.id.del_routing -> {
et_routing_content.text = null
binding.etRoutingContent.text = null
true
}
R.id.scan_replace -> {
@@ -81,6 +86,12 @@ class RoutingSettingsFragment : Fragment() {
else -> super.onOptionsItemSelected(item)
}
private fun saveRouting() {
val content = binding.etRoutingContent.text.toString()
defaultSharedPreferences.edit().putString(requireArguments().getString(routing_arg), content).apply()
activity?.toast(R.string.toast_success)
}
fun scanQRcode(forReplace: Boolean): Boolean {
// try {
// startActivityForResult(Intent("com.google.zxing.client.android.SCAN")
@@ -105,14 +116,14 @@ class RoutingSettingsFragment : Fragment() {
private val scanQRCodeForReplace = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
if (it.resultCode == RESULT_OK) {
val content = it.data?.getStringExtra("SCAN_RESULT")
et_routing_content.text = Utils.getEditable(content!!)
binding.etRoutingContent.text = Utils.getEditable(content!!)
}
}
private val scanQRCodeForAppend = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
if (it.resultCode == RESULT_OK) {
val content = it.data?.getStringExtra("SCAN_RESULT")
et_routing_content.text = Utils.getEditable("${et_routing_content.text},$content")
binding.etRoutingContent.text = Utils.getEditable("${binding.etRoutingContent.text},$content")
}
}
@@ -139,8 +150,14 @@ class RoutingSettingsFragment : Fragment() {
""
}
launch(Dispatchers.Main) {
et_routing_content.text = Utils.getEditable(content)
activity?.toast(R.string.toast_success)
val routingList = if (TextUtils.isEmpty(content)) {
Utils.readTextFromAssets(activity?.v2RayApplication!!, "custom_routing_$tag")
} else {
content
}
binding.etRoutingContent.text = Utils.getEditable(routingList)
saveRouting()
//toast(R.string.toast_success)
}
}
return true

View File

@@ -63,7 +63,7 @@ class ScannerActivity : BaseActivity(), ZXingScannerView.ResultHandler {
finish()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_scanner, menu)
return true
}

View File

@@ -315,10 +315,10 @@ class ServerActivity : BaseActivity() {
return true
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.action_server, menu)
val delButton = menu?.findItem(R.id.del_config)
val saveButton = menu?.findItem(R.id.save_config)
val delButton = menu.findItem(R.id.del_config)
val saveButton = menu.findItem(R.id.save_config)
if (editGuid.isNotEmpty()) {
if (isRunning) {

View File

@@ -113,10 +113,10 @@ class ServerCustomConfigActivity : BaseActivity() {
return true
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.action_server, menu)
val delButton = menu?.findItem(R.id.del_config)
val saveButton = menu?.findItem(R.id.save_config)
val delButton = menu.findItem(R.id.del_config)
val saveButton = menu.findItem(R.id.save_config)
if (editGuid.isNotEmpty()) {
if (isRunning) {

View File

@@ -203,7 +203,7 @@ class SettingsActivity : BaseActivity() {
override fun onStart() {
super.onStart()
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity)
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity())
updateMode(defaultSharedPreferences.getString(AppConfig.PREF_MODE, "VPN"))
var remoteDnsString = defaultSharedPreferences.getString(AppConfig.PREF_REMOTE_DNS, "")
domesticDns.summary = defaultSharedPreferences.getString(AppConfig.PREF_DOMESTIC_DNS, "")
@@ -222,10 +222,10 @@ class SettingsActivity : BaseActivity() {
}
private fun updateMode(mode: String?) {
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity)
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity())
val vpn = mode == "VPN"
perAppProxy.isEnabled = vpn
perAppProxy.isChecked = PreferenceManager.getDefaultSharedPreferences(activity)
perAppProxy.isChecked = PreferenceManager.getDefaultSharedPreferences(requireActivity())
.getBoolean(AppConfig.PREF_PER_APP_PROXY, false)
localDns?.isEnabled = vpn
fakeDns?.isEnabled = vpn

View File

@@ -106,10 +106,10 @@ class SubEditActivity : BaseActivity() {
return true
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.action_server, menu)
del_config = menu?.findItem(R.id.del_config)
save_config = menu?.findItem(R.id.save_config)
del_config = menu.findItem(R.id.del_config)
save_config = menu.findItem(R.id.save_config)
if (editSubId.isEmpty()) {
del_config?.isVisible = false

View File

@@ -37,10 +37,10 @@ class SubSettingActivity : BaseActivity() {
adapter.notifyDataSetChanged()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.action_sub_setting, menu)
menu?.findItem(R.id.del_config)?.isVisible = false
menu?.findItem(R.id.save_config)?.isVisible = false
menu.findItem(R.id.del_config)?.isVisible = false
menu.findItem(R.id.save_config)?.isVisible = false
return super.onCreateOptionsMenu(menu)
}

View File

@@ -95,9 +95,9 @@ class TaskerActivity : BaseActivity() {
finish()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.action_server, menu)
val del_config = menu?.findItem(R.id.del_config)
val del_config = menu.findItem(R.id.del_config)
del_config?.isVisible = false
return super.onCreateOptionsMenu(menu)
}

View File

@@ -167,7 +167,7 @@ object AngConfigManager {
}
//maybe sub
if (str.startsWith(HTTP_PROTOCOL) || str.startsWith(HTTPS_PROTOCOL)) {
if (TextUtils.isEmpty(subid) && (str.startsWith(HTTP_PROTOCOL) || str.startsWith(HTTPS_PROTOCOL))) {
MmkvManager.importUrlAsSubscription(str)
return 0
}

View File

@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="onModeHelpClicked"
android:text="@string/title_mode_help"
android:textAlignment="textStart"
android:textStyle="italic" />
android:textStyle="italic"
tools:ignore="UsingOnClickInXml" />

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="summary_pref_per_app_proxy">Set proxy for selected apps</string>
</resources>

View File

@@ -1,8 +0,0 @@
<resources>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="summary_pref_per_app_proxy">为应用程序分别设置代理</string>
</resources>

View File

@@ -78,7 +78,7 @@
<string name="title_advanced">进阶设置</string>
<string name="title_vpn_settings">VPN 设置</string>
<string name="title_pref_per_app_proxy">分应用代理</string>
<string name="summary_pref_per_app_proxy">分应用代理仅支持 Android 5.0 Lollipop 及更高</string>
<string name="summary_pref_per_app_proxy">常规:勾选的App被代理,未勾选的直连;\n绕行模式:勾选的App直连,未勾选的被代理.\n不明白者在菜单中选择自动选中需代理应用</string>
<string name="title_pref_mux_enabled">启用Mux多路复用</string>
<string name="summary_pref_mux_enabled">开启可能会加速,关闭可能会减少断流</string>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="summary_pref_per_app_proxy">為選擇的應用程式設定 Proxy</string>
</resources>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">v2rayNG</string>
<string name="app_widget_name">切換</string>
<string name="app_tile_name">切換</string>
<string name="app_widget_name">開關</string>
<string name="app_tile_name">開關</string>
<string name="app_tile_first_use">首次使用此功能,請使用此應用程式新增組態</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="migration_success">數據遷移成功!</string>
<string name="migration_fail">數據遷移失敗啦!</string>
<string name="migration_success">資料遷移成功</string>
<string name="migration_fail">資料遷移失敗</string>
<!-- Notifications -->
<string name="notification_action_stop_v2ray">停止</string>
@@ -23,11 +23,11 @@
<string name="menu_item_add_config">新增組態</string>
<string name="menu_item_save_config">儲存組態</string>
<string name="menu_item_del_config">刪除組態</string>
<string name="menu_item_import_config_qrcode">自 QR 匯入組態</string>
<string name="menu_item_import_config_qrcode">自 QR Code 匯入組態</string>
<string name="menu_item_import_config_clipboard">自剪貼簿匯入組態</string>
<string name="menu_item_import_config_manually_vmess">手動鍵入[Vmess]</string>
<string name="menu_item_import_config_manually_ss">手動鍵入[Shadowsocks]</string>
<string name="menu_item_import_config_manually_socks">手動鍵入[Socks]</string>
<string name="menu_item_import_config_manually_vmess">手動鍵入 [Vmess]</string>
<string name="menu_item_import_config_manually_ss">手動鍵入 [Shadowsocks]</string>
<string name="menu_item_import_config_manually_socks">手動鍵入 [Socks]</string>
<string name="menu_item_import_config_custom">自訂組態</string>
<string name="menu_item_import_config_custom_clipboard">自剪貼簿匯入自訂組態</string>
<string name="menu_item_import_config_custom_local">自本機匯入自訂組態</string>
@@ -37,16 +37,16 @@
<string name="server_lab_remarks">備註</string>
<string name="server_lab_address">位址</string>
<string name="server_lab_port"></string>
<string name="server_lab_id">使用者識別碼</string>
<string name="server_lab_id">使用者 ID</string>
<string name="server_lab_security">安全性</string>
<string name="server_lab_network">網路</string>
<string name="server_lab_more_function">更多功能</string>
<string name="server_lab_head_type">標頭類型</string>
<string name="server_lab_mode_type">gRPC 傳輸模式 (mode)</string>
<string name="server_lab_request_host">要求主機(host)(host/ws host/h2 host)/QUIC加密方式</string>
<string name="server_lab_path">path(ws path/h2 path)/QUIC加密鑰/kcp seed/gRPC serviceName</string>
<string name="server_lab_stream_security">傳輸層安全性(tls)</string>
<string name="server_lab_allow_insecure">跳過證驗證(allowInsecure)</string>
<string name="server_lab_request_host">要求主機 (host)(host/ws host/h2 host)/QUIC 加密方式</string>
<string name="server_lab_path">path(ws path/h2 path)/QUIC 加密鑰/kcp seed/gRPC serviceName</string>
<string name="server_lab_stream_security">傳輸層安全性 (tls)</string>
<string name="server_lab_allow_insecure">跳過證驗證 (allowInsecure)</string>
<string name="server_lab_address3">伺服器位址</string>
<string name="server_lab_port3">伺服器埠</string>
<string name="server_lab_id3">密碼</string>
@@ -63,121 +63,121 @@
<string name="server_lab_content">內容</string>
<string name="toast_none_data_clipboard">剪貼簿內無資料</string>
<string name="toast_invalid_url">網址無效</string>
<string name="server_lab_need_inbound">確保inboundsocks=10808,http=10809</string>
<string name="server_lab_need_inbound">​​確保 inboundsocks=10808,http=10809</string>
<!-- PerAppProxyActivity -->
<string name="msg_dialog_progress">載入</string>
<string name="menu_item_select_all">全選</string>
<string name="msg_enter_keywords">輸入關鍵字</string>
<string name="switch_bypass_apps_mode">略過模式</string>
<string name="menu_item_select_proxy_app">自動選中需代理應用</string>
<string name="menu_item_select_proxy_app">自動選中需要 Proxy 的應用</string>
<string name="msg_downloading_content">正在下載內容</string>
<!-- Preferences -->
<string name="title_settings">設定</string>
<string name="title_advanced">進階設定</string>
<string name="title_advanced">進階</string>
<string name="title_vpn_settings">VPN 設定</string>
<string name="title_pref_per_app_proxy">Proxy 個別應用程式</string>
<string name="summary_pref_per_app_proxy">Proxy 個別應用程式模式只支援 Android 5.0 (Lollipop) 或更高</string>
<string name="summary_pref_per_app_proxy">常規:勾選的App被代理,未勾選的直連;\n繞行模式:勾選的App直連,未勾選的被代理.\n不明白者在菜單中選擇自動選中需代理應用</string>
<string name="title_pref_mux_enabled">啟用 Mux</string>
<string name="summary_pref_mux_enabled">啟用或許會加快網路速度,切換或許會閃爍</string>
<string name="summary_pref_mux_enabled">啟用或許會加快網路速度,關閉或許會閃爍</string>
<string name="title_pref_speed_enabled">啟用速度顯示</string>
<string name="summary_pref_speed_enabled">在通知中顯示當前速度\n小圖顯示流量的路由情況</string>
<string name="summary_pref_speed_enabled">在通知中顯示當前速度\n小圖顯示流量的轉送情況</string>
<string name="title_pref_sniffing_enabled">啟用流量探</string>
<string name="summary_pref_sniffing_enabled">流量中探測域名 (默認啟用)</string>
<string name="title_pref_sniffing_enabled">啟用網路監</string>
<string name="summary_pref_sniffing_enabled">封包中監測網域 (預設啟用)</string>
<string name="title_pref_local_dns_enabled">啟用本地DNS</string>
<string name="summary_pref_local_dns_enabled">DNS 請求入 core 由 DNS 模塊處理(推薦啟用 如果需要路由略過局域網及中國大陸</string>
<string name="title_pref_local_dns_enabled">啟用本地 DNS</string>
<string name="summary_pref_local_dns_enabled">DNS 請求入 core 由 DNS 模塊處理 (建議啟用,可能需要轉送略過局域網及中國大陸)</string>
<string name="title_pref_fake_dns_enabled">啟用虛擬DNS</string>
<string name="summary_pref_fake_dns_enabled">本地返回虛構解析結果 (減低延時 但個別應用可能無法使用)</string>
<string name="title_pref_fake_dns_enabled">啟用DNS</string>
<string name="summary_pref_fake_dns_enabled">本地返回偽造解析結果 (減低延時但個別應用可能無法使用)</string>
<string name="title_pref_forward_ipv6">IPv6 路由</string>
<string name="summary_pref_forward_ipv6">向遠端重新導向 IPv6 流量測試</string>
<string name="summary_pref_forward_ipv6">向遠端重新導向 IPv6 流量 (測試)</string>
<string name="title_pref_routing">路由設置</string>
<string name="title_pref_routing_domain_strategy">策略</string>
<string name="title_pref_routing_mode">路由模式</string>
<string name="title_pref_routing_custom">自訂路由</string>
<string name="title_pref_routing">轉送設定</string>
<string name="title_pref_routing_domain_strategy">域策略</string>
<string name="title_pref_routing_mode">轉送模式</string>
<string name="title_pref_routing_custom">自訂轉送</string>
<string name="title_pref_donate"></string>
<string name="summary_pref_donate">向開發人員捐</string>
<string name="title_pref_donate"></string>
<string name="summary_pref_donate">向開發人員捐</string>
<string name="donate_detail">新增一些實驗性進階功能</string>
<string name="title_pref_remote_dns">遠端DNS (可選)</string>
<string name="title_pref_remote_dns">遠端 DNS (可選)</string>
<string name="summary_pref_remote_dns">DNS</string>
<string name="title_pref_vpn_dns">VPN DNS (僅支 IPv4/v6)</string>
<string name="title_pref_vpn_dns">VPN DNS (僅支 IPv4/v6)</string>
<string name="title_pref_domestic_dns">境内DNS (可選)</string>
<string name="title_pref_domestic_dns">境内 DNS (可選)</string>
<string name="summary_pref_domestic_dns">DNS</string>
<string name="title_pref_socks_port">SOCKS5代理連接</string>
<string name="summary_pref_socks_port">SOCKS5代理連接</string>
<string name="title_pref_socks_port">SOCKS5 Proxy </string>
<string name="summary_pref_socks_port">SOCKS5 Proxy </string>
<string name="title_pref_http_port">HTTP代理連接</string>
<string name="summary_pref_http_port">HTTP代理連接</string>
<string name="title_pref_http_port">HTTP Proxy </string>
<string name="summary_pref_http_port">HTTP Proxy </string>
<string name="title_pref_local_dns_port">本地DNS端口</string>
<string name="summary_pref_local_dns_port">本地DNS端口</string>
<string name="title_pref_local_dns_port">本地 DNS</string>
<string name="summary_pref_local_dns_port">本地 DNS</string>
<string name="title_pref_feedback">回饋</string>
<string name="summary_pref_feedback">回饋提升或前往 GitHub 回報 Bug</string>
<string name="summary_pref_tg_group">加入Telegram Group</string>
<string name="toast_tg_app_not_found">未找到Telegram app</string>
<string name="title_pref_feedback">意見回饋</string>
<string name="summary_pref_feedback">前往 GitHub 回報錯誤</string>
<string name="summary_pref_tg_group">加入 Telegram 群組</string>
<string name="toast_tg_app_not_found">未找到 Telegram 應用程式</string>
<string name="title_pref_promotion">推廣</string>
<string name="summary_pref_promotion">一些推廣,點擊查看詳情(捐可去除)</string>
<string name="summary_pref_promotion">一些推廣,輕觸以檢視 (捐可去除)</string>
<string name="title_mode">模式</string>
<string name="title_mode_help">點此查看更多幫助</string>
<string name="donate_error_setup">錯誤設定:</string>
<string name="donate_error_inventory">Error querying inventory</string>
<string name="donate_error_purchase1">購買錯誤:</string>
<string name="donate_error_setup">錯誤設定</string>
<string name="donate_error_inventory">未查詢到庫存</string>
<string name="donate_error_purchase1">購買錯誤</string>
<string name="donate_error_purchase2">購買錯誤,真實性驗證失敗。</string>
<string name="donate_success_purchase">感謝您的捐</string>
<string name="donate_item_click"></string>
<string name="donate_success_purchase">感謝您的捐</string>
<string name="donate_item_click"></string>
<string name="donate_item_paypal">Paypal</string>
<string name="title_logcat">Logcat</string>
<string name="logcat_copy">複製</string>
<string name="logcat_delete">刪除</string>
<string name="title_export_all">匯出全部(非自訂)配置至剪貼簿</string>
<string name="title_export_all">匯出全部 (非自訂) 組態至剪貼簿</string>
<string name="title_sub_setting">訂閱設定</string>
<string name="sub_setting_remarks">備註</string>
<string name="sub_setting_url">位址(url)</string>
<string name="sub_setting_url">位址 (url)</string>
<string name="title_sub_update">更新訂閱</string>
<string name="title_ping_all_server">測試所有配置延遲(Tcping)</string>
<string name="title_ping_all_server">測試所有組態延遲 (Tcping)</string>
<string name="tasker_start_service">啟動服務</string>
<string name="tasker_setting_confirm">確定</string>
<string name="routing_settings_title">路由設定</string>
<string name="routing_settings_tips">英文逗號「,」分隔,記得儲存唷</string>
<string name="routing_settings_title">轉送設定</string>
<string name="routing_settings_tips">半形逗號「,」分隔,記得儲存唷</string>
<string name="routing_settings_save">儲存</string>
<string name="routing_settings_delete">清除</string>
<string name="routing_settings_scan_replace">掃描並取代</string>
<string name="routing_settings_scan_append">掃描並附加</string>
<string name="routing_settings_default_rules">預設路由規則</string>
<string name="routing_settings_default_rules">預設轉送規則</string>
<string name="connection_test_pending">"檢查連線能力"</string>
<string name="connection_test_testing">"測試中……"</string>
<string name="connection_test_available">"成功: %d 毫秒延遲"</string>
<string name="connection_test_error">"偵測出網際網路連線失敗: %s"</string>
<string name="connection_test_available">"成功 %d 毫秒延遲"</string>
<string name="connection_test_error">"偵測出網際網路連線失敗%s"</string>
<string name="connection_test_fail">"無法使用網際網路"</string>
<string name="connection_test_error_status_code">"錯誤碼: #%d"</string>
<string name="connection_test_error_status_code">"錯誤碼(#%d)"</string>
<string name="connection_connected">"已連線,輕觸以檢查連線能力"</string>
<string name="connection_not_connected">"未連線"</string>
<string-array name="share_method">
<item>QR </item>
<item>QR Code</item>
<item>匯出至剪貼簿</item>
<item>匯出完整配置至剪貼簿</item>
<item>匯出完整組態至剪貼簿</item>
</string-array>
<string-array name="routing_tag">
@@ -187,20 +187,20 @@
</string-array>
<string-array name="routing_mode">
<item></item>
<item></item>
<item>略過區域網路</item>
<item>略過中國大陸</item>
<item>略過區域網路及中國大陸</item>
</string-array>
<string name="title_pref_proxy_sharing_enabled">代理共享</string>
<string name="summary_pref_proxy_sharing_enabled">綁定代理入口ip到0.0.0.0</string>
<string name="toast_warning_pref_proxysharing">其他設備可以使用socks/http協定通過您的IP地址連接到代理\nHttp 代理: http://您的ip:10809\nSocks 代理: socks(4/5)://您的ip:10808\n僅在受信任的網路中啟用以避免未經授權的連</string>
<string name="toast_warning_pref_proxysharing_short">代理共享已啟用,請確保處於受信網路</string>
<string name="toast_malformed_josn">配置格式錯誤</string>
<string name="title_pref_proxy_sharing_enabled">Proxy 共用</string>
<string name="summary_pref_proxy_sharing_enabled">綁定 Proxy 入口 IP 到 0.0.0.0</string>
<string name="toast_warning_pref_proxysharing">其他裝置可以使用 socks/http 協定通過您的 IP 位址連線到 Proxy \nHttp Proxyhttp://您的ip:10809\nSocks Proxysocks(4/5)://您的ip:10808\n僅在受信任的網路中啟用以避免未經授權的連</string>
<string name="toast_warning_pref_proxysharing_short">Proxy 共用已啟用,請確保處於受信網路</string>
<string name="toast_malformed_josn">組態格式錯誤</string>
<string-array name="mode_entries">
<item>VPN</item>
<item>代理</item>
<item> Proxy</item>
</string-array>
</resources>

View File

@@ -79,7 +79,7 @@
<string name="title_advanced">Advanced Settings</string>
<string name="title_vpn_settings">VPN Settings</string>
<string name="title_pref_per_app_proxy">Per-app proxy</string>
<string name="summary_pref_per_app_proxy">Per-app proxy mode only support Android 5.0 Lollipop or higher</string>
<string name="summary_pref_per_app_proxy">General: Checked App is proxy, unchecked direct connection; \nbypass mode: checked app directly connected, unchecked proxy. \nThe option to automatically select the proxy application in the menu</string>
<string name="title_pref_mux_enabled">Enable Mux</string>
<string name="summary_pref_mux_enabled">Enable maybe speed up network and switch network maybe flash</string>

View File

@@ -11,6 +11,7 @@
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
<style name="AppTheme.NoActionBar.Translucent">

View File

@@ -3,11 +3,13 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
@@ -18,8 +20,10 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
jcenter()
}
}

View File

@@ -13,10 +13,10 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Fri Jun 02 14:08:42 CST 2017
kotlinVersion=1.5.10
buildToolsVer=30.0.2
compileSdkVer=30
targetSdkVer=30
kotlinVersion=1.6.10
buildToolsVer=31.0.0
compileSdkVer=31
targetSdkVer=31
kotlin.incremental=true
android.useAndroidX=true
android.enableJetifier=true

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip