Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
Signed-off-by: sowjanyakch <[email protected]>
  • Loading branch information
sowjanyakch committed Dec 9, 2024
1 parent ab8d73f commit 82e623e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 8 additions & 6 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextView>(R.id.userAbsenceShortMessage).text = String.format(
context.resources.getString(R.string.user_absence_for_one_day),
uiState.userAbsence.userId
Expand All @@ -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<TextView>(R.id.userAbsenceShortMessage).text = String.format(
context.resources.getString(R.string.user_absence),
uiState.userAbsence.userId
)
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceShortMessage).text =
String.format(
context.resources.getString(R.string.user_absence),
uiState.userAbsence.userId
)

binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsencePeriod).text = "$startDateString - $endDateString"
}
Expand All @@ -1138,7 +1139,8 @@ class ChatActivity :
)
)
}
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text = context.resources.getString(R.string.user_absence_replacement)
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text =
context.resources.getString(R.string.user_absence_replacement)
binding.outOfOfficeContainer.findViewById<ImageView>(R.id.replacement_user_avatar)
.load(imageUri) {
transformations(CircleCropTransformation())
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/com/nextcloud/talk/utils/DateUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -105,5 +105,4 @@ class DateUtils(val context: Context) {
}
}
}

}

0 comments on commit 82e623e

Please sign in to comment.