refine refreshing

This commit is contained in:
Max Lv
2013-10-28 20:48:42 +08:00
parent 8172befb65
commit 93a269698a
4 changed files with 11 additions and 3 deletions
@@ -366,6 +366,8 @@ class ShadowVpnService extends VpnService {
override def onCreate() {
super.onCreate()
Config.refresh(this)
EasyTracker
.getInstance(this)
.send(MapBuilder
@@ -739,11 +739,10 @@ class Shadowsocks
}
}
val container = getApplication.asInstanceOf[ShadowsocksApplication].tagContainer
if (container != null) container.refresh();
switchButton.setOnCheckedChangeListener(this)
Config.refresh(this)
}
private def setPreferenceEnabled(enabled: Boolean) {
@@ -388,6 +388,8 @@ class ShadowsocksService extends Service {
override def onCreate() {
super.onCreate()
Config.refresh(this)
EasyTracker
.getInstance(this)
.send(MapBuilder
@@ -111,6 +111,11 @@ object Config {
}
}
def refresh(context: Context) {
val container = context.getApplicationContext.asInstanceOf[ShadowsocksApplication].tagContainer
if (container != null) container.refresh()
}
def getPublicConfig(container: Container, config: Config): Config = {
val list = container.getString("proxy_list")
val proxies = util.Random.shuffle(list.split('|').toSeq).toSeq