mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
create chip for avatar icon and name
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
ca4ace687c
commit
9a481aefc8
@ -72,6 +72,7 @@ import androidx.work.WorkInfo
|
|||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import coil.imageLoader
|
import coil.imageLoader
|
||||||
|
import coil.load
|
||||||
import coil.request.CachePolicy
|
import coil.request.CachePolicy
|
||||||
import coil.request.ImageRequest
|
import coil.request.ImageRequest
|
||||||
import coil.target.Target
|
import coil.target.Target
|
||||||
@ -1125,10 +1126,24 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uiState.userAbsence.replacementUserDisplayName != null) {
|
if (uiState.userAbsence.replacementUserDisplayName != null) {
|
||||||
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).text = String.format(
|
var imageUri = Uri.parse(ApiUtils.getUrlForAvatar(conversationUser?.baseUrl, uiState.userAbsence
|
||||||
context.resources.getString(R.string.user_absence_replacement),
|
.replacementUserId, false))
|
||||||
|
if (DisplayUtils.isDarkModeOn(context)) {
|
||||||
|
imageUri = Uri.parse(ApiUtils.getUrlForAvatarDarkTheme(conversationUser?.baseUrl, uiState
|
||||||
|
.userAbsence
|
||||||
|
.replacementUserId, false))
|
||||||
|
}
|
||||||
|
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())
|
||||||
|
placeholder(R.drawable.account_circle_96dp)
|
||||||
|
error(R.drawable.account_circle_96dp)
|
||||||
|
crossfade(true)
|
||||||
|
}
|
||||||
|
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 = View.GONE
|
binding.outOfOfficeContainer.findViewById<TextView>(R.id.absenceReplacement).visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
@ -372,6 +372,12 @@ object ApiUtils {
|
|||||||
return baseUrl + "/index.php/avatar/" + Uri.encode(name) + "/" + avatarSize
|
return baseUrl + "/index.php/avatar/" + Uri.encode(name) + "/" + avatarSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getUrlForAvatarDarkTheme(baseUrl: String?, name: String?, requestBigSize: Boolean): String {
|
||||||
|
val avatarSize = if (requestBigSize) AVATAR_SIZE_BIG else AVATAR_SIZE_SMALL
|
||||||
|
return baseUrl + "/index.php/avatar/" + Uri.encode(name) + "/" + avatarSize + "/dark"
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getUrlForFederatedAvatar(
|
fun getUrlForFederatedAvatar(
|
||||||
baseUrl: String,
|
baseUrl: String,
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
-->
|
-->
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:maxHeight="150dp"
|
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:id="@+id/out_of_office_view">
|
||||||
|
|
||||||
@ -44,13 +44,53 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="Dec 5, 2024 - Dec 15, 2024"/>
|
tools:text="Dec 5, 2024 - Dec 15, 2024"/>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/absenceReplacement"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:orientation="horizontal"
|
||||||
android:textSize="14sp"
|
android:layout_marginTop ="8dp"
|
||||||
tools:text="Replacement: Bob"/>
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/absenceReplacement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:text="Replacement: "/>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/avatar_chip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:cardCornerRadius="16dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding = "4dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/replacement_user_avatar"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:contentDescription="@null" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/replacement_user_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
tools:text="Bob" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/userAbsenceLongMessage"
|
android:id="@+id/userAbsenceLongMessage"
|
||||||
|
@ -842,5 +842,5 @@ How to translate with transifex:
|
|||||||
|
|
||||||
<string name="user_absence">%1$s is out of office and might not respond</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_for_one_day">%1$s is out of office today</string>
|
||||||
<string name="user_absence_replacement">Replacement: %1$s</string>
|
<string name="user_absence_replacement">Replacement</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user