diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index c8f1aa809..3c25f70ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -628,7 +628,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { val flags = if(format in yearDateFormats){ FLAG_ALL_DAY }else { - FLAG_ALL_DAY or FLAG_MISSING_YEAR_EVENT + FLAG_ALL_DAY or FLAG_MISSING_YEAR } val timestamp = date.time / 1000L diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index cfad8c82f..0cfcda6ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -93,7 +93,7 @@ const val REPEAT_ORDER_WEEKDAY = 4 // i.e. every 4th sunday // special event flags const val FLAG_ALL_DAY = 1 const val FLAG_IS_PAST_EVENT = 2 -const val FLAG_MISSING_YEAR_EVENT = 4 +const val FLAG_MISSING_YEAR = 4 // constants related to ICS file exporting / importing const val BEGIN_CALENDAR = "BEGIN:VCALENDAR" @@ -130,6 +130,7 @@ const val SEQUENCE = "SEQUENCE" // this tag isn't a standard ICS tag, but there's no official way of adding a category color in an ics file const val CATEGORY_COLOR = "X-SMT-CATEGORY-COLOR:" const val CATEGORY_COLOR_LEGACY = "CATEGORY_COLOR:" +const val MISSING_YEAR = "X-SMT-MISSING-YEAR:" const val DISPLAY = "DISPLAY" const val EMAIL = "EMAIL" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt index f32101a5e..0967f320f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt @@ -307,7 +307,7 @@ class EventsHelper(val context: Context) { (anniversaryEventId != -1L && it.eventType == anniversaryEventId)){ val eventStartDate = Formatter.getDateFromTS(it.startTS) val originalEventStartDate = Formatter.getDateFromTS(originalEvent.startTS) - if(it.flags and FLAG_MISSING_YEAR_EVENT == 0){ + if(it.hasMissingYear().not()){ val years = (eventStartDate.year - originalEventStartDate.year).coerceAtLeast(0) if(years > 0){ it.title = "${it.title} ($years)" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt index ced32bae0..c8ab33526 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt @@ -58,6 +58,7 @@ class IcsExporter { event.startTS.let { out.writeLn("$DTSTART:${Formatter.getExportedTime(it * 1000L)}") } event.endTS.let { out.writeLn("$DTEND:${Formatter.getExportedTime(it * 1000L)}") } } + event.hasMissingYear().let { out.writeLn("$MISSING_YEAR${if(it) 1 else 0}") } out.writeLn("$DTSTAMP$exportTime") out.writeLn("$STATUS$CONFIRMED") diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt index b884e1632..1b7b9a75b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt @@ -128,6 +128,10 @@ class IcsImporter(val activity: SimpleActivity) { if (color.trimStart('-').areDigitsOnly()) { curCategoryColor = Integer.parseInt(color) } + } else if (line.startsWith(MISSING_YEAR)) { + if (line.substring(MISSING_YEAR.length) == "1") { + curFlags = curFlags or FLAG_MISSING_YEAR + } } else if (line.startsWith(CATEGORIES) && !overrideFileEventTypes) { val categories = line.substring(CATEGORIES.length) tryAddCategories(categories) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt index 8f08aec5f..d6020ae47 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/models/Event.kt @@ -138,6 +138,7 @@ data class Event( } fun getIsAllDay() = flags and FLAG_ALL_DAY != 0 + fun hasMissingYear() = flags and FLAG_MISSING_YEAR != 0 fun getReminders() = setOf( Reminder(reminder1Minutes, reminder1Type),