Correct and improve calendar events updating algorithm.
1. UpdateCalendarService will fetch all events from now to the next fetch time + Preferences.showUntil, so that EventRepository holds all events need to be shown before the next fetch; 2. Every event is updated 1 minute after the corresponding time span, to make the actual time difference consistent with the displayed getRelativeTimeSpanString; 3. Update events only when necessary, eliminate redundant alarms; cancel all update alarms when showEvents is turned off.
This commit is contained in:
@ -35,8 +35,6 @@ class WeatherReceiver : BroadcastReceiver() {
|
||||
companion object {
|
||||
private const val MINUTE = 60 * 1000L
|
||||
fun setUpdates(context: Context) {
|
||||
removeUpdates(context)
|
||||
|
||||
if (Preferences.showWeather) {
|
||||
val interval = MINUTE * when (Preferences.weatherRefreshPeriod) {
|
||||
0 -> 30
|
||||
|
Reference in New Issue
Block a user