Merge pull request #3214 from ByteHamster/work-manager-disabled-auto-update

Handle disabled auto update
This commit is contained in:
H. Lehmann 2019-06-03 12:39:19 +02:00 committed by GitHub
commit 83201d27df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -381,6 +381,10 @@ public class UserPreferences {
} }
} }
public static boolean isAutoUpdateDisabled() {
return prefs.getString(PREF_UPDATE_INTERVAL, "").equals("0");
}
public static String getMobileUpdatesEnabled() { public static String getMobileUpdatesEnabled() {
return prefs.getString(PREF_MOBILE_UPDATE, "images"); return prefs.getString(PREF_MOBILE_UPDATE, "images");
} }
@ -832,7 +836,9 @@ public class UserPreferences {
} }
public static void restartUpdateAlarm() { public static void restartUpdateAlarm() {
if (isAutoUpdateTimeOfDay()) { if (isAutoUpdateDisabled()) {
AutoUpdateManager.disableAutoUpdate();
} else if (isAutoUpdateTimeOfDay()) {
int[] timeOfDay = getUpdateTimeOfDay(); int[] timeOfDay = getUpdateTimeOfDay();
Log.d(TAG, "timeOfDay: " + Arrays.toString(timeOfDay)); Log.d(TAG, "timeOfDay: " + Arrays.toString(timeOfDay));
AutoUpdateManager.restartUpdateTimeOfDayAlarm(timeOfDay[0], timeOfDay[1]); AutoUpdateManager.restartUpdateTimeOfDayAlarm(timeOfDay[0], timeOfDay[1]);