diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index a9b2b4d91c..2006963fae 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -1099,7 +1099,7 @@ class ChatActivity : val startDate = Date(startDateTimestamp * 1000) val endDate = Date(endDateTimestamp * 1000) - if (dateUtils.isSameDate(startDate,endDate)) { + if (dateUtils.isSameDate(startDate, endDate)) { binding.outOfOfficeContainer.findViewById(R.id.userAbsenceShortMessage).text = String.format( context.resources.getString(R.string.user_absence_for_one_day), uiState.userAbsence.userId @@ -1110,10 +1110,11 @@ class ChatActivity : val dateFormatter = SimpleDateFormat("MMM d, yyyy", Locale.getDefault()) val startDateString = dateFormatter.format(startDate) val endDateString = dateFormatter.format(endDate) - binding.outOfOfficeContainer.findViewById(R.id.userAbsenceShortMessage).text = String.format( - context.resources.getString(R.string.user_absence), - uiState.userAbsence.userId - ) + binding.outOfOfficeContainer.findViewById(R.id.userAbsenceShortMessage).text = + String.format( + context.resources.getString(R.string.user_absence), + uiState.userAbsence.userId + ) binding.outOfOfficeContainer.findViewById(R.id.userAbsencePeriod).text = "$startDateString - $endDateString" } @@ -1138,7 +1139,8 @@ class ChatActivity : ) ) } - binding.outOfOfficeContainer.findViewById(R.id.absenceReplacement).text = context.resources.getString(R.string.user_absence_replacement) + binding.outOfOfficeContainer.findViewById(R.id.absenceReplacement).text = + context.resources.getString(R.string.user_absence_replacement) binding.outOfOfficeContainer.findViewById(R.id.replacement_user_avatar) .load(imageUri) { transformations(CircleCropTransformation()) diff --git a/app/src/main/java/com/nextcloud/talk/utils/DateUtils.kt b/app/src/main/java/com/nextcloud/talk/utils/DateUtils.kt index 8655456b66..852c5a54e9 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/DateUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/DateUtils.kt @@ -51,11 +51,11 @@ class DateUtils(val context: Context) { return formatTime.format(Date(timestampSeconds * DateConstants.SECOND_DIVIDER)) } - fun isSameDate(date1:Date, date2:Date):Boolean{ - val startDateCalendar = Calendar.getInstance().apply { time = date1} + fun isSameDate(date1: Date, date2: Date): Boolean { + val startDateCalendar = Calendar.getInstance().apply { time = date1 } val endDateCalendar = Calendar.getInstance().apply { time = date2 } val isSameDay = startDateCalendar.get(Calendar.YEAR) == endDateCalendar.get(Calendar.YEAR) && - startDateCalendar.get(Calendar.DAY_OF_YEAR) == endDateCalendar.get(Calendar.DAY_OF_YEAR) + startDateCalendar.get(Calendar.DAY_OF_YEAR) == endDateCalendar.get(Calendar.DAY_OF_YEAR) return isSameDay } @@ -105,5 +105,4 @@ class DateUtils(val context: Context) { } } } - }