Skip to content

Commit

Permalink
hide replacement view when there is no replacement set
Browse files Browse the repository at this point in the history
Signed-off-by: sowjanyakch <[email protected]>
  • Loading branch information
sowjanyakch committed Dec 13, 2024
1 parent 5290ab1 commit 583e0eb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import android.view.animation.AccelerateDecelerateInterpolator
import android.widget.AbsListView
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.PopupMenu
import android.widget.TextView
import androidx.activity.OnBackPressedCallback
Expand Down Expand Up @@ -1153,8 +1154,8 @@ class ChatActivity :
binding.outOfOfficeContainer.findViewById<TextView>(R.id.replacement_user_name).text =
uiState.userAbsence.replacementUserDisplayName
} else {
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).visibility =
View.GONE
binding.outOfOfficeContainer.findViewById<LinearLayout>(R.id.userAbsenceReplacement)
.visibility = View.GONE
}
binding.outOfOfficeContainer.findViewById<TextView>(R.id.userAbsenceLongMessage).text =
uiState.userAbsence.message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.nextcloud.talk.chat.viewmodels

import android.annotation.SuppressLint
import android.content.Context
import android.net.Uri
import android.os.Bundle
Expand Down Expand Up @@ -771,6 +772,7 @@ class ChatViewModel @Inject constructor(
}
}

@SuppressLint("TooGenericExceptionCaught")
fun outOfOfficeStatusOfUser(credentials: String, baseUrl: String, userId: String) {
viewModelScope.launch {
try {
Expand Down
19 changes: 14 additions & 5 deletions app/src/main/res/layout/out_of_office_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
~ SPDX-FileCopyrightText: 2024 Sowjanya Kota <[email protected]>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="150dp"
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
android:layout_width="match_parent"
Expand Down Expand Up @@ -45,6 +52,7 @@
tools:text="Dec 5, 2024 - Dec 15, 2024"/>

<LinearLayout
android:id="@+id/userAbsenceReplacement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
Expand Down Expand Up @@ -101,4 +109,5 @@
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>
</LinearLayout>
</ScrollView>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 583e0eb

Please sign in to comment.