Show the correct date for all-day events in the coming year

This commit is contained in:
azuo 2021-12-29 23:45:32 +08:00
parent fb3f28d035
commit 1667d9c22c
2 changed files with 6 additions and 18 deletions

View File

@ -496,8 +496,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
context,
now.timeInMillis,
nextEvent.startDate
)
.toLowerCase(Locale.getDefault())
).toLowerCase(Locale.getDefault())
} else {
SettingsStringHelper.getAllDayEventDifferenceText(
context,
@ -577,11 +576,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
} else {
val start = Calendar.getInstance().apply { timeInMillis = nextEvent.startDate }
bindingView.subLineText.text = if (now.get(Calendar.DAY_OF_YEAR) == start.get(
Calendar.DAY_OF_YEAR)) {
DateHelper.getDateText(context, start)
} else if (now.get(Calendar.DAY_OF_YEAR) > start.get(Calendar.DAY_OF_YEAR) || now.get(
Calendar.YEAR) > start.get(Calendar.YEAR)) {
bindingView.subLineText.text = if (now.after(start)) {
DateHelper.getDateText(context, now)
} else {
DateHelper.getDateText(context, start)
@ -716,8 +711,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
context,
now.timeInMillis,
nextEvent.startDate
)
.toLowerCase(Locale.getDefault())
).toLowerCase(Locale.getDefault())
} else {
SettingsStringHelper.getAllDayEventDifferenceText(
context,

View File

@ -528,8 +528,7 @@ class StandardWidget(val context: Context) {
context,
now.timeInMillis,
nextEvent.startDate
)
.toLowerCase(Locale.getDefault())
).toLowerCase(Locale.getDefault())
} else {
SettingsStringHelper.getAllDayEventDifferenceText(
context,
@ -609,11 +608,7 @@ class StandardWidget(val context: Context) {
} else {
val start = Calendar.getInstance().apply { timeInMillis = nextEvent.startDate }
bindingView.subLineText.text = if (now.get(Calendar.DAY_OF_YEAR) == start.get(
Calendar.DAY_OF_YEAR)) {
DateHelper.getDateText(context, start)
} else if (now.get(Calendar.DAY_OF_YEAR) > start.get(Calendar.DAY_OF_YEAR) || now.get(
Calendar.YEAR) > start.get(Calendar.YEAR)) {
bindingView.subLineText.text = if (now.after(start)) {
DateHelper.getDateText(context, now)
} else {
DateHelper.getDateText(context, start)
@ -748,8 +743,7 @@ class StandardWidget(val context: Context) {
context,
now.timeInMillis,
nextEvent.startDate
)
.toLowerCase(Locale.getDefault())
).toLowerCase(Locale.getDefault())
} else {
SettingsStringHelper.getAllDayEventDifferenceText(
context,