From 1eda4c47a4abba26f4669967f2c00a1ffca1452e Mon Sep 17 00:00:00 2001 From: Mygod Date: Tue, 24 Nov 2015 21:41:09 +0800 Subject: [PATCH] Removed the switch for now --- src/main/res/values-zh/strings.xml | 1 - src/main/res/values/strings.xml | 1 - src/main/res/xml/pref_all.xml | 2 -- .../com/github/shadowsocks/Shadowsocks.scala | 1 - .../shadowsocks/ShadowsocksApplication.scala | 2 -- .../shadowsocks/ShadowsocksNotification.scala | 22 ++++++++----------- .../github/shadowsocks/utils/Constants.scala | 1 - 7 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/main/res/values-zh/strings.xml b/src/main/res/values-zh/strings.xml index da978fdb..9015716b 100755 --- a/src/main/res/values-zh/strings.xml +++ b/src/main/res/values-zh/strings.xml @@ -32,7 +32,6 @@ 启用该选项,以使所选应用程序的流量不经过代理 自动连接 随系统启动后台服务 - 在通知内显示当前上下行速率 后台服务已开始运行。 影梭 → %s 无法连接远程服务器 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 0524eb80..422a0b3f 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -13,7 +13,6 @@ Use NAT mode instead of VPN mode NAT mode is disabled without root Network Traffic - Show traffic in notification Sent: \t\t\t\t\t%3$s\t↑\t%1$s/s\nReceived: \t%4$s\t↓\t%2$s/s \n%1$s↑\t%2$s↓ %1$s/s↑\t%2$s/s↓ diff --git a/src/main/res/xml/pref_all.xml b/src/main/res/xml/pref_all.xml index 8ab4e23f..2390e8e3 100644 --- a/src/main/res/xml/pref_all.xml +++ b/src/main/res/xml/pref_all.xml @@ -82,8 +82,6 @@ android:key="isAutoConnect" android:summary="@string/auto_connect_summary" android:title="@string/auto_connect"/> - update(intent.getAction) - val screenFilter = new IntentFilter() - screenFilter.addAction(Intent.ACTION_SCREEN_ON) - screenFilter.addAction(Intent.ACTION_SCREEN_OFF) - screenFilter.addAction(Intent.ACTION_USER_PRESENT) - service.registerReceiver(lockReceiver, screenFilter) - } else setVisible(visible).show() + update() + lockReceiver = (context: Context, intent: Intent) => update(intent.getAction) + val screenFilter = new IntentFilter() + screenFilter.addAction(Intent.ACTION_SCREEN_ON) + screenFilter.addAction(Intent.ACTION_SCREEN_OFF) + if (showOnUnlock) screenFilter.addAction(Intent.ACTION_USER_PRESENT) + service.registerReceiver(lockReceiver, screenFilter) def update(action: String = Intent.ACTION_SCREEN_ON) = if (service.getState == State.CONNECTED) { if (action == Intent.ACTION_SCREEN_OFF) { if (showOnUnlock) setVisible(false) unregisterCallback // unregister callback to save battery } else if (action == Intent.ACTION_SCREEN_ON) { - if (ShadowsocksApplication.notificationTraffic) { - service.binder.registerCallback(callback) - callbackRegistered = true - } else unregisterCallback + service.binder.registerCallback(callback) + callbackRegistered = true if (!keyGuard.inKeyguardRestrictedInputMode) setVisible(showOnUnlock) } else if (action == Intent.ACTION_USER_PRESENT) setVisible(showOnUnlock) show() diff --git a/src/main/scala/com/github/shadowsocks/utils/Constants.scala b/src/main/scala/com/github/shadowsocks/utils/Constants.scala index 97bf71b0..cfc405c9 100644 --- a/src/main/scala/com/github/shadowsocks/utils/Constants.scala +++ b/src/main/scala/com/github/shadowsocks/utils/Constants.scala @@ -68,7 +68,6 @@ object Key { val profiles = "profiles" val isNAT = "isNAT" val route = "route" - val notificationTraffic = "notificationTraffic" val stat = "stat" val isRunning = "isRunning"