do not allow scheduling events in the past

This commit is contained in:
tibbi 2016-07-07 11:07:02 +02:00
parent 2268100a20
commit 5f084488ac
2 changed files with 6 additions and 0 deletions

View File

@ -188,6 +188,11 @@ public class EventActivity extends AppCompatActivity implements DBHelper.DBOpera
return; return;
} }
if (DateTime.now().isAfter(mEventStartDateTime.getMillis())) {
Utils.showToast(getApplicationContext(), R.string.start_in_past);
return;
}
final DBHelper dbHelper = DBHelper.newInstance(getApplicationContext(), this); final DBHelper dbHelper = DBHelper.newInstance(getApplicationContext(), this);
final String description = mDescriptionET.getText().toString().trim(); final String description = mDescriptionET.getText().toString().trim();
final int reminderMinutes = getReminderMinutes(); final int reminderMinutes = getReminderMinutes();

View File

@ -10,6 +10,7 @@
<string name="delete">Delete</string> <string name="delete">Delete</string>
<string name="title_empty">Title cannot be empty</string> <string name="title_empty">Title cannot be empty</string>
<string name="end_before_start">The event cannot end earlier than it starts</string> <string name="end_before_start">The event cannot end earlier than it starts</string>
<string name="start_in_past">You cannot schedule events in the past</string>
<string name="event_added">Event added successfully</string> <string name="event_added">Event added successfully</string>
<string name="event_updated">Event updated successfully</string> <string name="event_updated">Event updated successfully</string>
<string name="reminder">Reminder</string> <string name="reminder">Reminder</string>