mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 04:29:45 +01:00
show userAbsence period
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
ecd5bfdf41
commit
4bdedfbc0d
@ -206,6 +206,7 @@ import java.io.File
|
||||
import java.io.IOException
|
||||
import java.net.HttpURLConnection
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.ExecutionException
|
||||
@ -569,7 +570,7 @@ class ChatActivity :
|
||||
this.lifecycle.removeObserver(chatViewModel)
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
|
||||
@Suppress("LongMethod")
|
||||
private fun initObservers() {
|
||||
Log.d(TAG, "initObservers Called")
|
||||
@ -1081,10 +1082,40 @@ class ChatActivity :
|
||||
}
|
||||
is ChatViewModel.OutOfOfficeUIState.Success -> {
|
||||
binding.outOfOfficeContainer.visibility = View.VISIBLE
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceShortMessage).text = String.format(
|
||||
context.resources.getString(R.string.user_absence),
|
||||
uiState.userAbsence.userId
|
||||
)
|
||||
|
||||
|
||||
val startDateTimestamp:Long = uiState.userAbsence.startDate.toLong()
|
||||
val endDateTimestamp:Long = uiState.userAbsence.endDate.toLong()
|
||||
|
||||
val startDate = Date(startDateTimestamp * 1000)
|
||||
val endDate = Date(endDateTimestamp * 1000)
|
||||
|
||||
val date1 = Calendar.getInstance().apply{time = startDate}
|
||||
val date2 = Calendar.getInstance().apply{time = endDate}
|
||||
|
||||
val isSameDay = date1.get(Calendar.YEAR) == date2.get(Calendar.YEAR) &&
|
||||
date1.get(Calendar.DAY_OF_YEAR) == date2.get(Calendar.DAY_OF_YEAR)
|
||||
|
||||
if (isSameDay) {
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceShortMessage).text = String.format(
|
||||
context.resources.getString(R.string.user_absence_for_one_day),
|
||||
uiState.userAbsence.userId
|
||||
)
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsencePeriod).visibility =
|
||||
View.GONE
|
||||
} else {
|
||||
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.userAbsencePeriod).text = "$startDateString - $endDateString"
|
||||
}
|
||||
|
||||
|
||||
if(uiState.userAbsence.replacementUserDisplayName != null){
|
||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text = String.format(
|
||||
context.resources.getString(R.string.user_absence_replacement),
|
||||
|
@ -18,7 +18,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:layout_margin="8dp"
|
||||
android:elevation="4dp"
|
||||
app:cornerRadius="8dp">
|
||||
|
||||
@ -26,27 +25,32 @@
|
||||
android:id="@+id/userAbsenceShortMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/scrollview_out_of_office_text"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop ="8dp"
|
||||
tools:text="Jane is out of office"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userAbsencePeriod"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop ="8dp"
|
||||
android:textSize="14sp"
|
||||
tools:text="Dec 5, 2024 - Dec 15, 2024"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/absenceReplacement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="@color/scrollview_out_of_office_text"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="Replacement: Bob"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userAbsenceLongMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:textColor="@color/scrollview_out_of_office_text"
|
||||
android:layout_marginTop ="8dp"
|
||||
android:textSize="14sp"
|
||||
tools:text="Hi, I am out of office this week. Please contact ....., ..........write very very very very very very very very very very very very very very very long message..................................................................................................................................if you have any issues."/>
|
||||
</LinearLayout>
|
||||
|
@ -841,5 +841,6 @@ How to translate with transifex:
|
||||
<string name="automatic_status_set">Your status was set automatically</string>
|
||||
|
||||
<string name="user_absence">%1$s is out of office and might not respond</string>
|
||||
<string name="user_absence_for_one_day">%1$s is out of office today</string>
|
||||
<string name="user_absence_replacement">Replacement: %1$s</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user