update Crouton
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
<string name="forward_stop">Shadowsocks stopped.</string>
|
||||
<string name="service_failed">Please check your network status and try again.</string>
|
||||
<string name="stop">Stop the service</string>
|
||||
<string name="vpn_status">You can only disable the VPN service through the notification bar.</string>
|
||||
|
||||
<!-- alert category -->
|
||||
<string name="ok_iknow">OK</string>
|
||||
|
||||
@@ -252,16 +252,16 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
|
||||
checked match {
|
||||
case true => {
|
||||
if (isVpnEnabled) {
|
||||
if (!serviceStart) {
|
||||
switchButton.setChecked(false)
|
||||
}
|
||||
} else {
|
||||
val intent = VpnService.prepare(this)
|
||||
if (intent != null) {
|
||||
startActivityForResult(intent, Shadowsocks.REQUEST_CONNECT)
|
||||
} else {
|
||||
onActivityResult(Shadowsocks.REQUEST_CONNECT, Activity.RESULT_OK, null)
|
||||
}
|
||||
} else {
|
||||
if (!serviceStart) {
|
||||
switchButton.setChecked(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
case false => {
|
||||
@@ -364,6 +364,14 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
|
||||
val settings: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
if (isServiceStarted) {
|
||||
switchButton.setChecked(true)
|
||||
if (ShadowVpnService.isServiceStarted) {
|
||||
val style = new Style.Builder()
|
||||
.setBackgroundColorValue(Style.holoBlueLight)
|
||||
.setDuration(Style.DURATION_INFINITE)
|
||||
.build()
|
||||
switchButton.setEnabled(false)
|
||||
Crouton.makeText(Shadowsocks.this, R.string.vpn_status, style).show()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (settings.getBoolean("isRunning", false)) {
|
||||
@@ -448,6 +456,11 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
|
||||
}
|
||||
}
|
||||
|
||||
override def onDestroy() {
|
||||
super.onDestroy()
|
||||
Crouton.cancelAllCroutons()
|
||||
}
|
||||
|
||||
def reset() {
|
||||
crash_recovery()
|
||||
copyAssets("")
|
||||
@@ -538,13 +551,19 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
|
||||
}
|
||||
|
||||
if (isVpnEnabled) {
|
||||
if (ShadowsocksService.isServiceStarted) return false
|
||||
val it: Intent = new Intent(this, classOf[ShadowsocksService])
|
||||
startService(it)
|
||||
} else {
|
||||
if (ShadowVpnService.isServiceStarted) return false
|
||||
val it: Intent = new Intent(this, classOf[ShadowVpnService])
|
||||
startService(it)
|
||||
val style = new Style.Builder()
|
||||
.setBackgroundColorValue(Style.holoBlueLight)
|
||||
.setDuration(Style.DURATION_INFINITE)
|
||||
.build()
|
||||
Crouton.makeText(Shadowsocks.this, R.string.vpn_status, style).show()
|
||||
switchButton.setEnabled(false)
|
||||
} else {
|
||||
if (ShadowsocksService.isServiceStarted) return false
|
||||
val it: Intent = new Intent(this, classOf[ShadowsocksService])
|
||||
startService(it)
|
||||
}
|
||||
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user