Allow to disable auto updates
This commit is contained in:
parent
4443d629fc
commit
f05132a716
|
@ -1190,7 +1190,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
|||
timePickerDialog.show();
|
||||
});
|
||||
builder.onNeutral((dialog, which) -> {
|
||||
UserPreferences.setUpdateInterval(0);
|
||||
UserPreferences.disableAutoUpdate();
|
||||
setUpdateIntervalText();
|
||||
});
|
||||
builder.show();
|
||||
|
|
|
@ -575,6 +575,13 @@ public class UserPreferences {
|
|||
restartUpdateAlarm();
|
||||
}
|
||||
|
||||
public static void disableAutoUpdate() {
|
||||
prefs.edit()
|
||||
.putString(PREF_UPDATE_INTERVAL, "0")
|
||||
.apply();
|
||||
AutoUpdateManager.disableAutoUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the auto-flattr settings
|
||||
*
|
||||
|
|
|
@ -60,6 +60,10 @@ public class AutoUpdateManager {
|
|||
WorkManager.getInstance().enqueueUniqueWork(WORK_ID_FEED_UPDATE, ExistingWorkPolicy.REPLACE, workRequest);
|
||||
}
|
||||
|
||||
public static void disableAutoUpdate() {
|
||||
WorkManager.getInstance().cancelUniqueWork(WORK_ID_FEED_UPDATE);
|
||||
}
|
||||
|
||||
private static Constraints getConstraints() {
|
||||
Constraints.Builder constraints = new Constraints.Builder();
|
||||
|
||||
|
|
Loading…
Reference in New Issue