From c04267b58a74c2cc57428951c09cb50c097dddd4 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Mon, 4 Jan 2016 16:55:49 +0200 Subject: [PATCH] Fixed bug, when Live Updates switch state was ignored when downloading Live Updates after settings dialog closed. --- .../plus/liveupdates/LiveUpdatesSettingsDialogFragment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java index 735bbc03bc..301040a926 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java @@ -128,9 +128,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { public void onClick(DialogInterface dialog, int which) { if (liveUpdatePreference.get() != liveUpdatesSwitch.isChecked()) { liveUpdatePreference.set(liveUpdatesSwitch.isChecked()); - if (liveUpdatesSwitch.isChecked()) { - runLiveUpdate(localIndexInfo, false); - } else { + if (!liveUpdatesSwitch.isChecked()) { long updatesSize = changesManager.getUpdatesSize(fileNameWithoutExtension); if (updatesSize != 0) { ClearUpdatesDialogFragment.createInstance(localIndexInfo) @@ -151,6 +149,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { timeOfDayPreference.set(timeOfDayInt); if (liveUpdatesSwitch.isChecked() && getSettings().IS_LIVE_UPDATES_ON.get()) { + runLiveUpdate(localIndexInfo, false); UpdateFrequency updateFrequency = UpdateFrequency.values()[updateFrequencyInt]; TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDayInt]; setAlarmForPendingIntent(alarmIntent, alarmMgr, updateFrequency, timeOfDayToUpdate);