diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index ff36da0a5f..26eb6ea9e2 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -145,7 +145,7 @@ public class OsmandApplication extends MultiDexApplication { appCustomization.setup(this); osmandSettings = appCustomization.getOsmandSettings(); appInitializer.initVariables(); - if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("enable_proxy", false)) { + if (osmandSettings.ENABLE_PROXY.get()) { NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get()); } if (appInitializer.isAppVersionChanged() && appInitializer.getPrevAppVersion() < AppInitializer.VERSION_2_3) { diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index c5ebb360f8..b108005448 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -999,6 +999,7 @@ public class OsmandSettings { public final CommonPreference INTERRUPT_MUSIC = new BooleanPreference("interrupt_music", false).makeProfile(); + public final CommonPreference ENABLE_PROXY = new BooleanPreference("enable_proxy", false).makeGlobal(); public final CommonPreference PROXY_HOST = new StringPreference("proxy_host", "127.0.0.1").makeGlobal(); public final CommonPreference PROXY_PORT = new IntPreference("proxy_port", 8118).makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index d9240e2249..e78b60fa8b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -342,6 +342,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR protected void enableProxy(boolean enable) { + settings.ENABLE_PROXY.set(enable); if (enable) { NetworkUtils.setProxy(settings.PROXY_HOST.get(), settings.PROXY_PORT.get()); } else { @@ -350,7 +351,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR } private void addProxyPrefs(PreferenceGroup proxy) { - CheckBoxPreference enableProxyPref = (CheckBoxPreference) proxy.findPreference("enable_proxy"); + CheckBoxPreference enableProxyPref = (CheckBoxPreference) proxy.findPreference(settings.ENABLE_PROXY.getId()); enableProxyPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) {