Use app.* instead of ShadowsocksApplication.*

Because typing ShadowsocksApplication is quite troublesome.
This commit is contained in:
Mygod
2016-05-24 11:37:33 +08:00
parent c695847403
commit 28ea9dd807
20 changed files with 132 additions and 113 deletions
@@ -44,6 +44,7 @@ import android.content.Intent
import android.net.VpnService
import android.os.{IBinder, Handler}
import com.github.shadowsocks.utils.ConfigUtils
import com.github.shadowsocks.ShadowsocksApplication.app
class ShadowsocksRunnerService extends Service with ServiceBoundContext {
val handler = new Handler()
@@ -57,15 +58,15 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
}
def startBackgroundService() {
if (ShadowsocksApplication.isVpnEnabled) {
if (app.isVpnEnabled) {
val intent = VpnService.prepare(ShadowsocksRunnerService.this)
if (intent == null) {
if (bgService != null) {
bgService.use(ConfigUtils.load(ShadowsocksApplication.settings))
bgService.use(ConfigUtils.load(app.settings))
}
}
} else {
bgService.use(ConfigUtils.load(ShadowsocksApplication.settings))
bgService.use(ConfigUtils.load(app.settings))
}
stopSelf()
}