Commit 7c61df58 authored by Mygod's avatar Mygod

Fix NatSwitchPreference

parent fb6d2df3
......@@ -14,14 +14,13 @@ final class NatSwitchPreference(context: Context, attrs: AttributeSet) extends S
private var disabled = false
override def isEnabled = super.isEnabled && !disabled
override def setEnabled(b: Boolean) = super.setEnabled(b && !disabled)
override def onGetDefaultValue(a: TypedArray, index: Int) = {
val result = ShadowsocksApplication.isVpnEnabled
if (!ShadowsocksApplication.isRoot) {
disabled = true
setEnabled(false)
setSummary(R.string.nat_summary_no_root)
}
result.asInstanceOf[AnyRef]
if (!ShadowsocksApplication.isRoot) {
disabled = true
setEnabled(false)
setSummary(R.string.nat_summary_no_root)
}
override def onGetDefaultValue(a: TypedArray, index: Int) = ShadowsocksApplication.isVpnEnabled.asInstanceOf[AnyRef]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment