show an error message if the imported event ends earlier than it starts

This commit is contained in:
tibbi 2022-01-12 19:46:18 +01:00
parent 7055bef9d7
commit e8019d7528
1 changed files with 3 additions and 0 deletions

View File

@ -2,11 +2,13 @@ package com.simplemobiletools.calendar.pro.helpers
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.widget.Toast
import androidx.collection.LongSparseArray import androidx.collection.LongSparseArray
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.extensions.* import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.models.Event import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.EventType import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.CHOPPED_LIST_DEFAULT_SIZE import com.simplemobiletools.commons.helpers.CHOPPED_LIST_DEFAULT_SIZE
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
@ -122,6 +124,7 @@ class EventsHelper(val context: Context) {
try { try {
for (event in events) { for (event in events) {
if (event.startTS > event.endTS) { if (event.startTS > event.endTS) {
context.toast(R.string.end_before_start, Toast.LENGTH_LONG)
continue continue
} }