From 5f084488ac0c29899b4229c7ba02abc2e0f9b4ca Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Jul 2016 11:07:02 +0200 Subject: [PATCH] do not allow scheduling events in the past --- .../simplemobiletools/calendar/activities/EventActivity.java | 5 +++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java b/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java index 21401e610..1d155fcce 100644 --- a/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java +++ b/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java @@ -188,6 +188,11 @@ public class EventActivity extends AppCompatActivity implements DBHelper.DBOpera return; } + if (DateTime.now().isAfter(mEventStartDateTime.getMillis())) { + Utils.showToast(getApplicationContext(), R.string.start_in_past); + return; + } + final DBHelper dbHelper = DBHelper.newInstance(getApplicationContext(), this); final String description = mDescriptionET.getText().toString().trim(); final int reminderMinutes = getReminderMinutes(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cac09c7d9..cb7f36e92 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -10,6 +10,7 @@ Delete Title cannot be empty The event cannot end earlier than it starts + You cannot schedule events in the past Event added successfully Event updated successfully Reminder