diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt
index 4e9d8c175..2dc798663 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt
@@ -37,6 +37,7 @@ import com.simplemobiletools.commons.helpers.isMarshmallowPlus
import com.simplemobiletools.commons.helpers.isOreoPlus
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
+import org.joda.time.LocalDate
import java.io.File
import java.text.SimpleDateFormat
import java.util.*
@@ -157,9 +158,19 @@ fun Context.notifyEvent(event: Event) {
val pendingIntent = getPendingIntent(applicationContext, event)
val startTime = Formatter.getTimeFromTS(applicationContext, event.startTS)
val endTime = Formatter.getTimeFromTS(applicationContext, event.endTS)
+ val startDate = Formatter.getDateFromTS(event.startTS)
+ val displayedStartDate: String
+ if (startDate == LocalDate.now()) {
+ displayedStartDate = ""
+ } else if (startDate == LocalDate.now().plusDays(1)) {
+ displayedStartDate = getString(R.string.tomorrow)
+ } else /* At least 2 days in the future */ {
+ displayedStartDate = Formatter.getDayAndMonth(startDate)
+ }
val timeRange = if (event.getIsAllDay()) getString(R.string.all_day) else getFormattedEventTime(startTime, endTime)
val descriptionOrLocation = if (config.replaceDescription) event.location else event.description
- val notification = getNotification(applicationContext, pendingIntent, event, "$timeRange $descriptionOrLocation")
+ val content = arrayOf(displayedStartDate, timeRange, descriptionOrLocation).joinToString(" ")
+ val notification = getNotification(applicationContext, pendingIntent, event, content)
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(event.id, notification)
}
@@ -210,7 +221,7 @@ private fun getNotification(context: Context, pendingIntent: PendingIntent, even
return builder.build()
}
-private fun getFormattedEventTime(startTime: String, endTime: String) = if (startTime == endTime) startTime else "$startTime - $endTime"
+private fun getFormattedEventTime(startTime: String, endTime: String) = if (startTime == endTime) startTime else "$startTime\u2013$endTime"
private fun getPendingIntent(context: Context, event: Event): PendingIntent {
val intent = Intent(context, EventActivity::class.java)
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt
index ef2389d3f..1605e164a 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Formatter.kt
@@ -7,7 +7,9 @@ import com.simplemobiletools.calendar.extensions.getNowSeconds
import com.simplemobiletools.calendar.extensions.seconds
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
+import org.joda.time.LocalDate
import org.joda.time.format.DateTimeFormat
+import java.text.DateFormat
object Formatter {
val DAYCODE_PATTERN = "YYYYMMdd"
@@ -76,6 +78,8 @@ object Formatter {
fun getDayCodeFromDateTime(dateTime: DateTime) = dateTime.toString(DAYCODE_PATTERN)
+ fun getDateFromTS(ts: Int) = LocalDate(ts * 1000L, DateTimeZone.getDefault())
+
fun getDateTimeFromTS(ts: Int) = DateTime(ts * 1000L, DateTimeZone.getDefault())
fun getUTCDateTimeFromTS(ts: Int) = DateTime(ts * 1000L, DateTimeZone.UTC)
@@ -104,4 +108,6 @@ object Formatter {
}
fun getShiftedImportTimestamp(ts: Int) = getUTCDateTimeFromTS(ts).withTime(13, 0, 0, 0).withZoneRetainFields(DateTimeZone.getDefault()).seconds()
+
+ fun getDayAndMonth(localDate: LocalDate) = localDate.toString("dd.MM.")
}
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 2ee73b187..b91bf2309 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -89,6 +89,7 @@
Erinnerung
+ Morgen
vorher
Füge eine weitere Erinnerung hinzu
Ereignis Erinnerungen
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fad828cb1..6b8e8cd71 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -89,6 +89,7 @@
Reminder
+ Tomorrow
before
Add another reminder
Event reminders