Fixed bug, when Live Updates switch state was ignored when downloading Live Updates after settings dialog closed.

This commit is contained in:
GaidamakUA 2016-01-04 16:55:49 +02:00
parent c06c224e73
commit c04267b58a

View file

@ -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);