Skip to content

Commit 51adca8

Browse files
committed
Format code
1 parent f646eff commit 51adca8

File tree

103 files changed

+1149
-911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1149
-911
lines changed

V2rayNG/app/build.gradle.kts

+3-6
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,9 @@ android {
6868
"universal"
6969

7070
output.outputFileName = "v2rayNG_${variant.versionName}_${abi}.apk"
71-
if(versionCodes.containsKey(abi))
72-
{
71+
if (versionCodes.containsKey(abi)) {
7372
output.versionCodeOverride = (1000000 * versionCodes[abi]!!).plus(variant.versionCode)
74-
}
75-
else
76-
{
73+
} else {
7774
return@forEach
7875
}
7976
}
@@ -92,7 +89,7 @@ android {
9289
}
9390

9491
dependencies {
95-
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar","*.jar"))))
92+
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
9693
testImplementation(libs.junit)
9794

9895
implementation(libs.flexbox)

V2rayNG/app/src/main/AndroidManifest.xml

+54-38
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,29 @@
88
android:smallScreens="true"
99
android:normalScreens="true"
1010
android:largeScreens="true"
11-
android:xlargeScreens="true"/>
11+
android:xlargeScreens="true" />
1212

13-
<uses-sdk android:minSdkVersion="21" tools:overrideLibrary="com.blacksquircle.ui.editorkit"/>
13+
<uses-sdk
14+
android:minSdkVersion="21"
15+
tools:overrideLibrary="com.blacksquircle.ui.editorkit" />
1416

15-
<uses-feature android:name="android.hardware.camera" android:required="false"/>
16-
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
17-
<uses-feature android:name="android.software.leanback" android:required="false" />
18-
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
17+
<uses-feature
18+
android:name="android.hardware.camera"
19+
android:required="false" />
20+
<uses-feature
21+
android:name="android.hardware.camera.autofocus"
22+
android:required="false" />
23+
<uses-feature
24+
android:name="android.software.leanback"
25+
android:required="false" />
26+
<uses-feature
27+
android:name="android.hardware.touchscreen"
28+
android:required="false" />
1929

2030
<!-- https://developer.android.com/about/versions/11/privacy/package-visibility -->
21-
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
22-
tools:ignore="QueryAllPackagesPermission" />
31+
<uses-permission
32+
android:name="android.permission.QUERY_ALL_PACKAGES"
33+
tools:ignore="QueryAllPackagesPermission" />
2334
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2435
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
2536
<uses-permission android:name="android.permission.INTERNET" />
@@ -31,7 +42,7 @@
3142
android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"
3243
android:minSdkVersion="34" />
3344
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
34-
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
45+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
3546
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
3647

3748

@@ -53,12 +64,14 @@
5364
android:theme="@style/AppThemeDayNight.NoActionBar">
5465
<intent-filter>
5566
<action android:name="android.intent.action.MAIN" />
67+
5668
<category android:name="android.intent.category.LAUNCHER" />
57-
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
69+
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
5870
</intent-filter>
5971
<intent-filter>
6072
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
6173
</intent-filter>
74+
6275
<meta-data
6376
android:name="android.app.shortcuts"
6477
android:resource="@xml/shortcuts" />
@@ -119,12 +132,14 @@
119132
<data android:mimeType="text/plain" />
120133
</intent-filter>
121134
<intent-filter>
122-
<action android:name="android.intent.action.VIEW"/>
123-
<category android:name="android.intent.category.BROWSABLE"/>
124-
<category android:name="android.intent.category.DEFAULT"/>
125-
<data android:scheme="v2rayng"/>
126-
<data android:host="install-config"/>
127-
<data android:host="install-sub"/>
135+
<action android:name="android.intent.action.VIEW" />
136+
137+
<category android:name="android.intent.category.BROWSABLE" />
138+
<category android:name="android.intent.category.DEFAULT" />
139+
140+
<data android:scheme="v2rayng" />
141+
<data android:host="install-config" />
142+
<data android:host="install-sub" />
128143
</intent-filter>
129144
</activity>
130145
<activity
@@ -150,28 +165,29 @@
150165
android:value="vpn" />
151166
</service>
152167

153-
<service android:name=".service.V2RayProxyOnlyService"
154-
android:exported="false"
155-
android:label="@string/app_name"
156-
android:foregroundServiceType="specialUse"
157-
android:process=":RunSoLibV2RayDaemon">
168+
<service
169+
android:name=".service.V2RayProxyOnlyService"
170+
android:exported="false"
171+
android:label="@string/app_name"
172+
android:foregroundServiceType="specialUse"
173+
android:process=":RunSoLibV2RayDaemon">
158174
<property
159175
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
160176
android:value="proxy" />
161177
</service>
162178

163-
<service android:name=".service.V2RayTestService"
179+
<service
180+
android:name=".service.V2RayTestService"
164181
android:exported="false"
165-
android:process=":RunSoLibV2RayDaemon">
166-
</service>
182+
android:process=":RunSoLibV2RayDaemon"></service>
167183

168184
<receiver
169-
android:exported="true"
170-
android:name=".receiver.WidgetProvider"
171-
android:process=":RunSoLibV2RayDaemon">
185+
android:exported="true"
186+
android:name=".receiver.WidgetProvider"
187+
android:process=":RunSoLibV2RayDaemon">
172188
<meta-data
173-
android:name="android.appwidget.provider"
174-
android:resource="@xml/app_widget_provider" />
189+
android:name="android.appwidget.provider"
190+
android:resource="@xml/app_widget_provider" />
175191
<intent-filter>
176192
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
177193
<action android:name="com.v2ray.ang.action.widget.click" />
@@ -180,13 +196,13 @@
180196
</receiver>
181197

182198
<service
183-
android:exported="true"
184-
android:name=".service.QSTileService"
185-
android:icon="@drawable/ic_stat_name"
186-
android:label="@string/app_tile_name"
187-
android:foregroundServiceType="specialUse"
188-
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
189-
android:process=":RunSoLibV2RayDaemon">
199+
android:exported="true"
200+
android:name=".service.QSTileService"
201+
android:icon="@drawable/ic_stat_name"
202+
android:label="@string/app_tile_name"
203+
android:foregroundServiceType="specialUse"
204+
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
205+
android:process=":RunSoLibV2RayDaemon">
190206
<intent-filter>
191207
<action android:name="android.service.quicksettings.action.QS_TILE" />
192208
</intent-filter>
@@ -208,7 +224,7 @@
208224
<receiver
209225
android:exported="true"
210226
android:name=".receiver.TaskerReceiver"
211-
android:process=":RunSoLibV2RayDaemon">
227+
android:process=":RunSoLibV2RayDaemon">
212228
<intent-filter>
213229
<action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING" />
214230
</intent-filter>
@@ -234,7 +250,7 @@
234250
android:grantUriPermissions="true">
235251
<meta-data
236252
android:name="android.support.FILE_PROVIDER_PATHS"
237-
android:resource="@xml/cache_paths"/>
253+
android:resource="@xml/cache_paths" />
238254
</provider>
239255

240256
</application>

V2rayNG/app/src/main/java/com/v2ray/ang/helper/ItemTouchHelperAdapter.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package com.v2ray.ang.helper;
1818

19-
import androidx.recyclerview.widget.RecyclerView;
2019
import androidx.recyclerview.widget.ItemTouchHelper;
20+
import androidx.recyclerview.widget.RecyclerView;
2121

2222
/**
2323
* Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}.
@@ -36,7 +36,6 @@ public interface ItemTouchHelperAdapter {
3636
* @param fromPosition The start position of the moved item.
3737
* @param toPosition Then resolved position of the moved item.
3838
* @return True if the item was moved to the new adapter position.
39-
*
4039
* @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
4140
* @see RecyclerView.ViewHolder#getAdapterPosition()
4241
*/
@@ -52,7 +51,6 @@ public interface ItemTouchHelperAdapter {
5251
* adjusting the underlying data to reflect this removal.
5352
*
5453
* @param position The position of the item dismissed.
55-
*
5654
* @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
5755
* @see RecyclerView.ViewHolder#getAdapterPosition()
5856
*/

V2rayNG/app/src/main/java/com/v2ray/ang/helper/SimpleItemTouchHelperCallback.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
package com.v2ray.ang.helper;
1818

1919
import android.graphics.Canvas;
20+
2021
import androidx.recyclerview.widget.GridLayoutManager;
21-
import androidx.recyclerview.widget.RecyclerView;
2222
import androidx.recyclerview.widget.ItemTouchHelper;
23+
import androidx.recyclerview.widget.RecyclerView;
2324

2425
import org.jetbrains.annotations.NotNull;
2526

V2rayNG/app/src/main/kotlin/com/v2ray/ang/AngApplication.kt

+4-8
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ import androidx.work.WorkManager
77
import com.tencent.mmkv.MMKV
88
import com.v2ray.ang.util.Utils
99

10-
class AngApplication : MultiDexApplication()
11-
{
12-
companion object
13-
{
10+
class AngApplication : MultiDexApplication() {
11+
companion object {
1412
//const val PREF_LAST_VERSION = "pref_last_version"
1513
lateinit var application: AngApplication
1614
}
1715

18-
override fun attachBaseContext(base: Context?)
19-
{
16+
override fun attachBaseContext(base: Context?) {
2017
super.attachBaseContext(base)
2118
application = this
2219
}
@@ -25,8 +22,7 @@ class AngApplication : MultiDexApplication()
2522
.setDefaultProcessName("${BuildConfig.APPLICATION_ID}:bg")
2623
.build()
2724

28-
override fun onCreate()
29-
{
25+
override fun onCreate() {
3026
super.onCreate()
3127

3228
// LeakCanary.install(this)

V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ object AppConfig {
140140
const val RAY_NG_CHANNEL_NAME = "V2rayNG Background Service"
141141
const val SUBSCRIPTION_UPDATE_CHANNEL = "subscription_update_channel"
142142
const val SUBSCRIPTION_UPDATE_CHANNEL_NAME = "Subscription Update Service"
143+
143144
/** Protocols Scheme **/
144145
const val VMESS = "vmess://"
145146
const val CUSTOM = ""

V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/AppInfo.kt

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package com.v2ray.ang.dto
22

33
import android.graphics.drawable.Drawable
44

5-
data class AppInfo(val appName: String,
6-
val packageName: String,
7-
val appIcon: Drawable,
8-
val isSystemApp: Boolean,
9-
var isSelected: Int)
5+
data class AppInfo(
6+
val appName: String,
7+
val packageName: String,
8+
val appIcon: Drawable,
9+
val isSystemApp: Boolean,
10+
var isSelected: Int
11+
)

V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/EConfigType.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.v2ray.ang.AppConfig
66
enum class EConfigType(val value: Int, val protocolScheme: String) {
77
VMESS(1, AppConfig.VMESS),
88
CUSTOM(2, AppConfig.CUSTOM),
9-
SHADOWSOCKS(3,AppConfig.SHADOWSOCKS),
9+
SHADOWSOCKS(3, AppConfig.SHADOWSOCKS),
1010
SOCKS(4, AppConfig.SOCKS),
1111
VLESS(5, AppConfig.VLESS),
1212
TROJAN(6, AppConfig.TROJAN),

V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/ERoutingMode.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.v2ray.ang.dto
22

3-
enum class ERoutingMode(val value: String ) {
3+
enum class ERoutingMode(val value: String) {
44
GLOBAL_PROXY("0"),
55
BYPASS_LAN("1"),
66
BYPASS_MAINLAND("2"),

V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/ServerConfig.kt

+30-16
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,64 @@
11
package com.v2ray.ang.dto
22

3-
import com.v2ray.ang.AppConfig.TAG_PROXY
43
import com.v2ray.ang.AppConfig.TAG_BLOCKED
54
import com.v2ray.ang.AppConfig.TAG_DIRECT
5+
import com.v2ray.ang.AppConfig.TAG_PROXY
66
import com.v2ray.ang.util.Utils
77

88
data class ServerConfig(
9-
val configVersion: Int = 3,
10-
val configType: EConfigType,
11-
var subscriptionId: String = "",
12-
val addedTime: Long = System.currentTimeMillis(),
13-
var remarks: String = "",
14-
val outboundBean: V2rayConfig.OutboundBean? = null,
15-
var fullConfig: V2rayConfig? = null
9+
val configVersion: Int = 3,
10+
val configType: EConfigType,
11+
var subscriptionId: String = "",
12+
val addedTime: Long = System.currentTimeMillis(),
13+
var remarks: String = "",
14+
val outboundBean: V2rayConfig.OutboundBean? = null,
15+
var fullConfig: V2rayConfig? = null
1616
) {
1717
companion object {
1818
fun create(configType: EConfigType): ServerConfig {
19-
when(configType) {
19+
when (configType) {
2020
EConfigType.VMESS, EConfigType.VLESS ->
2121
return ServerConfig(
2222
configType = configType,
2323
outboundBean = V2rayConfig.OutboundBean(
2424
protocol = configType.name.lowercase(),
2525
settings = V2rayConfig.OutboundBean.OutSettingsBean(
26-
vnext = listOf(V2rayConfig.OutboundBean.OutSettingsBean.VnextBean(
27-
users = listOf(V2rayConfig.OutboundBean.OutSettingsBean.VnextBean.UsersBean())))),
28-
streamSettings = V2rayConfig.OutboundBean.StreamSettingsBean()))
26+
vnext = listOf(
27+
V2rayConfig.OutboundBean.OutSettingsBean.VnextBean(
28+
users = listOf(V2rayConfig.OutboundBean.OutSettingsBean.VnextBean.UsersBean())
29+
)
30+
)
31+
),
32+
streamSettings = V2rayConfig.OutboundBean.StreamSettingsBean()
33+
)
34+
)
35+
2936
EConfigType.CUSTOM ->
3037
return ServerConfig(configType = configType)
38+
3139
EConfigType.SHADOWSOCKS, EConfigType.SOCKS, EConfigType.TROJAN ->
3240
return ServerConfig(
3341
configType = configType,
3442
outboundBean = V2rayConfig.OutboundBean(
3543
protocol = configType.name.lowercase(),
3644
settings = V2rayConfig.OutboundBean.OutSettingsBean(
37-
servers = listOf(V2rayConfig.OutboundBean.OutSettingsBean.ServersBean())),
38-
streamSettings = V2rayConfig.OutboundBean.StreamSettingsBean()))
45+
servers = listOf(V2rayConfig.OutboundBean.OutSettingsBean.ServersBean())
46+
),
47+
streamSettings = V2rayConfig.OutboundBean.StreamSettingsBean()
48+
)
49+
)
50+
3951
EConfigType.WIREGUARD ->
4052
return ServerConfig(
4153
configType = configType,
42-
outboundBean = V2rayConfig.OutboundBean(
54+
outboundBean = V2rayConfig.OutboundBean(
4355
protocol = configType.name.lowercase(),
4456
settings = V2rayConfig.OutboundBean.OutSettingsBean(
4557
secretKey = "",
4658
peers = listOf(V2rayConfig.OutboundBean.OutSettingsBean.WireGuardBean())
47-
)))
59+
)
60+
)
61+
)
4862
}
4963
}
5064
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package com.v2ray.ang.dto
22

3-
data class ServersCache(val guid: String,
4-
val profile: ProfileItem)
3+
data class ServersCache(
4+
val guid: String,
5+
val profile: ProfileItem
6+
)

0 commit comments

Comments
 (0)