hide replacement view when there is no replacement set

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-12-13 16:04:45 +01:00
parent f7078990d9
commit 74bf9f2e91
No known key found for this signature in database
GPG Key ID: F7AA2A8B65B50220
3 changed files with 18 additions and 7 deletions

View File

@ -45,6 +45,7 @@ import android.view.animation.AccelerateDecelerateInterpolator
import android.widget.AbsListView import android.widget.AbsListView
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.PopupMenu import android.widget.PopupMenu
import android.widget.TextView import android.widget.TextView
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
@ -1153,8 +1154,8 @@ class ChatActivity :
binding.outOfOfficeContainer.findViewById<TextView>(R.id.replacement_user_name).text = binding.outOfOfficeContainer.findViewById<TextView>(R.id.replacement_user_name).text =
uiState.userAbsence.replacementUserDisplayName uiState.userAbsence.replacementUserDisplayName
} else { } else {
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).visibility = binding.outOfOfficeContainer.findViewById<LinearLayout>(R.id.userAbsenceReplacement)
View.GONE .visibility = View.GONE
} }
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text = binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text =
uiState.userAbsence.message uiState.userAbsence.message

View File

@ -771,6 +771,7 @@ class ChatViewModel @Inject constructor(
} }
} }
@Suppress("Detekt.TooGenericExceptionCaught")
fun outOfOfficeStatusOfUser(credentials: String, baseUrl: String, userId: String) { fun outOfOfficeStatusOfUser(credentials: String, baseUrl: String, userId: String) {
viewModelScope.launch { viewModelScope.launch {
try { try {

View File

@ -5,12 +5,19 @@
~ SPDX-FileCopyrightText: 2024 Sowjanya Kota <sowjanya.kch@gmail.com> ~ SPDX-FileCopyrightText: 2024 Sowjanya Kota <sowjanya.kch@gmail.com>
~ SPDX-License-Identifier: GPL-3.0-or-later ~ SPDX-License-Identifier: GPL-3.0-or-later
--> -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="150dp"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/out_of_office_view"> android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/out_of_office_view"
app:layout_constraintHeight_min="0dp"
app:layout_constraintHeight_max="150dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -45,6 +52,7 @@
tools:text="Dec 5, 2024 - Dec 15, 2024"/> tools:text="Dec 5, 2024 - Dec 15, 2024"/>
<LinearLayout <LinearLayout
android:id="@+id/userAbsenceReplacement"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
@ -102,3 +110,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>