Commit 4c1a817c authored by Mygod's avatar Mygod

Fix a crash on Android N preview

parent 390d79c9
...@@ -15,7 +15,7 @@ import android.webkit.{WebView, WebViewClient} ...@@ -15,7 +15,7 @@ import android.webkit.{WebView, WebViewClient}
import com.github.shadowsocks.database.Profile import com.github.shadowsocks.database.Profile
import com.github.shadowsocks.preferences._ import com.github.shadowsocks.preferences._
import com.github.shadowsocks.utils.CloseUtils._ import com.github.shadowsocks.utils.CloseUtils._
import com.github.shadowsocks.utils.{Key, Utils} import com.github.shadowsocks.utils.Key
object ShadowsocksSettings { object ShadowsocksSettings {
// Constants // Constants
...@@ -196,16 +196,10 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan ...@@ -196,16 +196,10 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
private var enabled = true private var enabled = true
def setEnabled(enabled: Boolean) { def setEnabled(enabled: Boolean) {
this.enabled = enabled this.enabled = enabled
findPreference(Key.isNAT).setEnabled(enabled) for (name <- Key.isNAT #:: PROXY_PREFS.toStream #::: FEATURE_PREFS.toStream) {
for (name <- PROXY_PREFS) {
val pref = findPreference(name) val pref = findPreference(name)
if (pref != null) pref.setEnabled(enabled) if (pref != null) pref.setEnabled(enabled)
} }
for (name <- FEATURE_PREFS) {
val pref = findPreference(name)
if (pref != null) pref.setEnabled(enabled &&
(name != Key.isProxyApps || Utils.isLollipopOrAbove || !ShadowsocksApplication.isVpnEnabled))
}
} }
def update(profile: Profile) { def update(profile: Profile) {
......
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