From 88adcb1d9e23251348c3c991d59740a959650901 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 11 Sep 2016 15:28:15 +0200 Subject: [PATCH] adjust the end time of repeating events --- .../main/java/com/simplemobiletools/calendar/DBHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/simplemobiletools/calendar/DBHelper.java b/app/src/main/java/com/simplemobiletools/calendar/DBHelper.java index b3c67486b..010a8f0df 100644 --- a/app/src/main/java/com/simplemobiletools/calendar/DBHelper.java +++ b/app/src/main/java/com/simplemobiletools/calendar/DBHelper.java @@ -170,7 +170,10 @@ public class DBHelper extends SQLiteOpenHelper { final List newEvents = fillEvents(cursor); for (Event e : newEvents) { final int periods = (ts - e.getStartTS()) / e.getRepeatInterval(); - e.setStartTS(e.getStartTS() + periods * e.getRepeatInterval()); + final int newStartTS = e.getStartTS() + periods * e.getRepeatInterval(); + final int newEndTS = newStartTS + (e.getEndTS() - e.getStartTS()); + e.setStartTS(newStartTS); + e.setEndTS(newEndTS); } events.addAll(newEvents); }