diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt
index 1a1dcebe..7c614210 100644
--- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt
+++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt
@@ -40,6 +40,7 @@ class V2RayVpnService : VpnService() {
const val NOTIFICATION_ID = 1
const val NOTIFICATION_PENDING_INTENT_CONTENT = 0
const val NOTIFICATION_PENDING_INTENT_STOP_V2RAY = 1
+ const val NOTIFICATION_ICON_THRESHOLD = 3000
fun startV2Ray(context: Context) {
val intent = Intent(context.applicationContext, V2RayVpnService::class.java)
@@ -359,8 +360,15 @@ class V2RayVpnService : VpnService() {
mSubscription = null
}
- private fun updateNotification(contentText: String) {
+ private fun updateNotification(contentText: String, proxyTraffic: Long, directTraffic: Long) {
if (mBuilder != null) {
+ if (proxyTraffic < NOTIFICATION_ICON_THRESHOLD && directTraffic < NOTIFICATION_ICON_THRESHOLD) {
+ mBuilder?.setSmallIcon(R.drawable.ic_v)
+ } else if (proxyTraffic > directTraffic) {
+ mBuilder?.setSmallIcon(R.drawable.ic_stat_proxy)
+ } else {
+ mBuilder?.setSmallIcon(R.drawable.ic_stat_direct)
+ }
mBuilder?.setStyle(NotificationCompat.BigTextStyle().bigText(contentText))
getNotificationManager().notify(NOTIFICATION_ID, mBuilder?.build())
}
@@ -393,7 +401,8 @@ class V2RayVpnService : VpnService() {
updateNotification("proxy\t• ${(proxyUplink / sinceLastQueryInSeconds).toLong().toSpeedString()}↑ " +
"${(proxyDownlink / sinceLastQueryInSeconds).toLong().toSpeedString()}↓\n" +
"direct\t• ${(directUplink / sinceLastQueryInSeconds).toLong().toSpeedString()}↑ " +
- "${(directDownlink / sinceLastQueryInSeconds).toLong().toSpeedString()}↓")
+ "${(directDownlink / sinceLastQueryInSeconds).toLong().toSpeedString()}↓",
+ proxyDownlink + proxyUplink, directDownlink + directUplink)
}
last_zero_speed = zero_speed
lastQueryTime = queryTime
@@ -408,7 +417,7 @@ class V2RayVpnService : VpnService() {
mSubscription = null
val cf_name = defaultDPreference.getPrefString(AppConfig.PREF_CURR_CONFIG_NAME, "")
- updateNotification(cf_name)
+ updateNotification(cf_name, 0, 0)
}
}
diff --git a/V2rayNG/app/src/main/res/drawable/ic_stat_direct.png b/V2rayNG/app/src/main/res/drawable/ic_stat_direct.png
new file mode 100644
index 00000000..406a0c76
Binary files /dev/null and b/V2rayNG/app/src/main/res/drawable/ic_stat_direct.png differ
diff --git a/V2rayNG/app/src/main/res/drawable/ic_stat_proxy.png b/V2rayNG/app/src/main/res/drawable/ic_stat_proxy.png
new file mode 100644
index 00000000..daef5970
Binary files /dev/null and b/V2rayNG/app/src/main/res/drawable/ic_stat_proxy.png differ
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 535748f3..3b0079fb 100644
--- a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml
+++ b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml
@@ -83,7 +83,7 @@
开启可能会加速,关闭可能会减少断流
启用速度显示
- 在通知中显示当前速度
+ 在通知中显示当前速度\n小图标显示流量的路由情况
启用流量探测
流量探测
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 fde2fb1e..452be54d 100644
--- a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml
+++ b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml
@@ -84,7 +84,7 @@
啟用或許會加快網路速度,切換或許會閃爍
啟用速度顯示
- 在通知中顯示當前速度
+ 在通知中顯示當前速度\n小圖標顯示流量的路由情況
啟用流量探測
流量探測
diff --git a/V2rayNG/app/src/main/res/values/strings.xml b/V2rayNG/app/src/main/res/values/strings.xml
index 6865872a..76a6e653 100644
--- a/V2rayNG/app/src/main/res/values/strings.xml
+++ b/V2rayNG/app/src/main/res/values/strings.xml
@@ -84,7 +84,8 @@
Enable maybe speed up network and switch network maybe flash
Enable speed display
- Display current speed in the notification
+ Display current speed in the notification.\nNotification icon would change based on
+ usage.
Enable Sniffing
Sniffing