From 6408450b31871afff33c9afc30516caa4741a858 Mon Sep 17 00:00:00 2001 From: Mygod Date: Tue, 19 Dec 2017 13:39:13 -0800 Subject: [PATCH] Disable unavailable configurations for proxy mode This prevents user confusion. --- .../java/com/github/shadowsocks/ProfileConfigFragment.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt b/mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt index fe6fe695..ea511abe 100644 --- a/mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt +++ b/mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt @@ -33,7 +33,6 @@ import android.support.v7.preference.PreferenceDataStore import android.support.v7.widget.Toolbar import android.view.MenuItem import com.github.shadowsocks.App.Companion.app -import com.github.shadowsocks.bg.BaseService import com.github.shadowsocks.database.Profile import com.github.shadowsocks.database.ProfileManager import com.github.shadowsocks.plugin.PluginConfiguration @@ -78,15 +77,18 @@ class ProfileConfigFragment : PreferenceFragmentCompatDividers(), Toolbar.OnMenu findPreference(Key.remotePort).summary = "1337" findPreference(Key.password).summary = "\u2022".repeat(32) } + val serviceMode = DataStore.serviceMode + findPreference(Key.remoteDns).isEnabled = serviceMode != Key.modeProxy isProxyApps = findPreference(Key.proxyApps) as SwitchPreference if (Build.VERSION.SDK_INT < 21) isProxyApps.parent!!.removePreference(isProxyApps) else { - isProxyApps.isEnabled = BaseService.usingVpnMode + isProxyApps.isEnabled = serviceMode == Key.modeVpn isProxyApps.setOnPreferenceClickListener { startActivity(Intent(activity, AppManager::class.java)) isProxyApps.isChecked = true false } } + findPreference(Key.udpdns).isEnabled = serviceMode != Key.modeProxy plugin = findPreference(Key.plugin) as IconListPreference pluginConfigure = findPreference(Key.pluginConfigure) as EditTextPreference plugin.unknownValueSummary = getString(R.string.plugin_unknown)