Move proxy setting code to startApplication

This commit is contained in:
PavelRatushny 2017-10-09 12:30:18 +03:00
parent 948dda9efb
commit 8b99f833dc

View file

@ -146,9 +146,6 @@ public class OsmandApplication extends MultiDexApplication {
appCustomization.setup(this); appCustomization.setup(this);
osmandSettings = appCustomization.getOsmandSettings(); osmandSettings = appCustomization.getOsmandSettings();
appInitializer.initVariables(); appInitializer.initVariables();
if (osmandSettings.ENABLE_PROXY.get()) {
NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get());
}
if (appInitializer.isAppVersionChanged() && appInitializer.getPrevAppVersion() < AppInitializer.VERSION_2_3) { if (appInitializer.isAppVersionChanged() && appInitializer.getPrevAppVersion() < AppInitializer.VERSION_2_3) {
osmandSettings.freezeExternalStorageDirectory(); osmandSettings.freezeExternalStorageDirectory();
} else if (appInitializer.isFirstTime()) { } else if (appInitializer.isFirstTime()) {
@ -364,9 +361,6 @@ public class OsmandApplication extends MultiDexApplication {
public void checkApplicationIsBeingInitialized(Activity activity, AppInitializeListener listener) { public void checkApplicationIsBeingInitialized(Activity activity, AppInitializeListener listener) {
// start application if it was previously closed // start application if it was previously closed
startApplication(); startApplication();
if (NetworkUtils.getProxy() == null && osmandSettings.ENABLE_PROXY.get()) {
NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get());
}
if(listener != null) { if(listener != null) {
appInitializer.addListener(listener); appInitializer.addListener(listener);
} }
@ -555,6 +549,9 @@ public class OsmandApplication extends MultiDexApplication {
if (!(uncaughtExceptionHandler instanceof DefaultExceptionHandler)) { if (!(uncaughtExceptionHandler instanceof DefaultExceptionHandler)) {
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler()); Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
} }
if (NetworkUtils.getProxy() == null && osmandSettings.ENABLE_PROXY.get()) {
NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get());
}
appInitializer.startApplication(); appInitializer.startApplication();
} }