fix a crash on devices without tun.ko

This commit is contained in:
Max Lv
2013-05-21 20:22:07 +08:00
parent 4a51f6e42e
commit 234caa1569
3 changed files with 30 additions and 4 deletions
@@ -471,16 +471,24 @@ class Shadowsocks
switchButton.setChecked(false)
Crouton.cancelAllCroutons()
}
val msg = settings.getString("vpnError", null)
if (msg != null) {
Crouton.cancelAllCroutons()
val style = new Style.Builder()
.setBackgroundColorValue(Style.holoRedLight)
.setDuration(Style.DURATION_INFINITE)
.build()
Crouton.makeText(this, getString(R.string.vpn_error).format(msg), style).show()
}
}
}
if (key == "isConnecting") {
if (settings.getBoolean("isConnecting", false)) {
Log.d(Shadowsocks.TAG, "Connecting start")
if (progressDialog == null) {
progressDialog = ProgressDialog.show(this, "", getString(R.string.connecting), true, true)
}
} else {
Log.d(Shadowsocks.TAG, "Connecting finish")
if (progressDialog != null) {
progressDialog.dismiss()
progressDialog = null
@@ -661,4 +669,4 @@ class Shadowsocks
val alert: AlertDialog = builder.create
alert.show()
}
}
}