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();
|
timePickerDialog.show();
|
||||||
});
|
});
|
||||||
builder.onNeutral((dialog, which) -> {
|
builder.onNeutral((dialog, which) -> {
|
||||||
UserPreferences.setUpdateInterval(0);
|
UserPreferences.disableAutoUpdate();
|
||||||
setUpdateIntervalText();
|
setUpdateIntervalText();
|
||||||
});
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|
|
@ -575,6 +575,13 @@ public class UserPreferences {
|
||||||
restartUpdateAlarm();
|
restartUpdateAlarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void disableAutoUpdate() {
|
||||||
|
prefs.edit()
|
||||||
|
.putString(PREF_UPDATE_INTERVAL, "0")
|
||||||
|
.apply();
|
||||||
|
AutoUpdateManager.disableAutoUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the auto-flattr settings
|
* Change the auto-flattr settings
|
||||||
*
|
*
|
||||||
|
|
|
@ -60,6 +60,10 @@ public class AutoUpdateManager {
|
||||||
WorkManager.getInstance().enqueueUniqueWork(WORK_ID_FEED_UPDATE, ExistingWorkPolicy.REPLACE, workRequest);
|
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() {
|
private static Constraints getConstraints() {
|
||||||
Constraints.Builder constraints = new Constraints.Builder();
|
Constraints.Builder constraints = new Constraints.Builder();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue