mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-05-03 15:26:27 +00:00
Use ShapableImageView to easily draw borders around avatars, fixed trust badge display condition
This commit is contained in:
parent
1dc5776cb8
commit
4ce5d989c5
25 changed files with 108 additions and 84 deletions
|
|
@ -69,7 +69,7 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : Abstrac
|
|||
friend.addListener(friendListener)
|
||||
|
||||
initials.postValue(AppUtils.getInitials(friend.name.orEmpty()))
|
||||
trust.postValue(SecurityLevel.Safe) // TODO FIXME: use API
|
||||
trust.postValue(SecurityLevel.Encrypted) // TODO FIXME: use API
|
||||
showTrust.postValue(coreContext.core.defaultAccount?.isInSecureMode())
|
||||
images.postValue(arrayListOf(getAvatarUri(friend).toString()))
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ import coil.imageLoader
|
|||
import coil.load
|
||||
import coil.request.ImageRequest
|
||||
import coil.transform.CircleCropTransformation
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -65,6 +66,7 @@ import org.linphone.BR
|
|||
import org.linphone.R
|
||||
import org.linphone.contacts.AbstractAvatarModel
|
||||
import org.linphone.contacts.AvatarGenerator
|
||||
import org.linphone.core.ChatRoom
|
||||
import org.linphone.core.ConsolidatedPresence
|
||||
import org.linphone.core.tools.Log
|
||||
|
||||
|
|
@ -210,7 +212,7 @@ fun AppCompatTextView.setColor(@ColorRes color: Int) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coil")
|
||||
fun ImageView.loadCircleFileWithCoil(file: String?) {
|
||||
fun ShapeableImageView.loadCircleFileWithCoil(file: String?) {
|
||||
Log.i("[Data Binding Utils] Loading file [$file] with coil")
|
||||
if (file != null) {
|
||||
load(file) {
|
||||
|
|
@ -221,7 +223,7 @@ fun ImageView.loadCircleFileWithCoil(file: String?) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coilAvatar")
|
||||
fun ImageView.loadAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
fun ShapeableImageView.loadAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
loadContactPictureWithCoil(imageView, model)
|
||||
|
|
@ -230,7 +232,7 @@ fun ImageView.loadAvatarWithCoil(model: AbstractAvatarModel?) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coilBubbleAvatar")
|
||||
fun ImageView.loadBubbleAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
fun ShapeableImageView.loadBubbleAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
val size = R.dimen.avatar_bubble_size
|
||||
|
|
@ -241,7 +243,7 @@ fun ImageView.loadBubbleAvatarWithCoil(model: AbstractAvatarModel?) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coilBigAvatar")
|
||||
fun ImageView.loadBigAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
fun ShapeableImageView.loadBigAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
val size = R.dimen.avatar_big_size
|
||||
|
|
@ -252,7 +254,7 @@ fun ImageView.loadBigAvatarWithCoil(model: AbstractAvatarModel?) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coilCallAvatar")
|
||||
fun ImageView.loadCallAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
fun ShapeableImageView.loadCallAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
val size = R.dimen.avatar_in_call_size
|
||||
|
|
@ -263,7 +265,7 @@ fun ImageView.loadCallAvatarWithCoil(model: AbstractAvatarModel?) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coilInitials")
|
||||
fun ImageView.loadInitialsAvatarWithCoil(initials: String?) {
|
||||
fun ShapeableImageView.loadInitialsAvatarWithCoil(initials: String?) {
|
||||
Log.i("[Data Binding Utils] Displaying initials [$initials] on ImageView")
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
|
|
@ -277,7 +279,7 @@ fun ImageView.loadInitialsAvatarWithCoil(initials: String?) {
|
|||
|
||||
@SuppressLint("ResourceType")
|
||||
private suspend fun loadContactPictureWithCoil(
|
||||
imageView: ImageView,
|
||||
imageView: ShapeableImageView,
|
||||
model: AbstractAvatarModel?,
|
||||
@DimenRes size: Int = 0,
|
||||
@DimenRes textSize: Int = 0
|
||||
|
|
@ -287,6 +289,26 @@ private suspend fun loadContactPictureWithCoil(
|
|||
|
||||
val context = imageView.context
|
||||
if (model != null) {
|
||||
if (model.showTrust.value == true) {
|
||||
when (model.trust.value) {
|
||||
ChatRoom.SecurityLevel.Safe -> {
|
||||
imageView.setStrokeColorResource(R.color.blue_info_500)
|
||||
imageView.setStrokeWidthResource(R.dimen.avatar_trust_border_width)
|
||||
}
|
||||
ChatRoom.SecurityLevel.Unsafe -> {
|
||||
imageView.setStrokeColorResource(R.color.red_danger_500)
|
||||
imageView.setStrokeWidthResource(R.dimen.avatar_trust_border_width)
|
||||
}
|
||||
else -> {
|
||||
imageView.setStrokeColorResource(R.color.transparent_color)
|
||||
imageView.setStrokeWidthResource(R.dimen.zero)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
imageView.setStrokeColorResource(R.color.transparent_color)
|
||||
imageView.setStrokeWidthResource(R.dimen.zero)
|
||||
}
|
||||
|
||||
val images = model.images.value.orEmpty()
|
||||
val count = images.size
|
||||
if (count == 1) {
|
||||
|
|
|
|||
|
|
@ -25,15 +25,14 @@
|
|||
app:barrierDirection="right"
|
||||
app:constraint_referenced_ids="name, register_status" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -84,14 +84,13 @@
|
|||
app:constraint_referenced_ids="sip_address, sip_address_label, display_name, display_name_label, details_background"
|
||||
android:visibility="@{viewModel.expandDetails ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:onClick="@{pickImageClickListener}"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="20dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{viewModel.accountModel}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -111,15 +111,13 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/image1"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
android:src="@drawable/user_circle"
|
||||
coilInitials="@{`JD`}"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -149,14 +147,14 @@
|
|||
app:layout_constraintTop_toTopOf="@id/image1"
|
||||
app:layout_constraintBottom_toBottomOf="@id/image1"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/image2"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
android:src="@drawable/user_circle"
|
||||
coilInitials="@{`JD`}"
|
||||
app:strokeWidth="@dimen/avatar_trust_border_width"
|
||||
app:strokeColor="@color/blue_info_500"
|
||||
app:layout_constraintStart_toEndOf="@id/arrow"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/image1"
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/image1"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/image1"
|
||||
app:layout_constraintBottom_toBottomOf="@id/image1"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/image2"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -172,6 +172,8 @@
|
|||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
android:src="@drawable/user_circle"
|
||||
coilInitials="@{`JD`}"
|
||||
app:strokeWidth="@dimen/avatar_trust_border_width"
|
||||
app:strokeColor="@color/blue_info_500"
|
||||
app:layout_constraintStart_toEndOf="@id/arrow"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/image1"
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintWidth_max="@dimen/avatar_in_call_size"
|
||||
|
|
@ -80,8 +80,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
|
||||
android:src="@{viewModel.contact.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.contact.trust == SecurityLevel.Encrypted || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -82,11 +82,11 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
|
|
|
|||
|
|
@ -25,15 +25,14 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model.contact}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
|
|
|
|||
|
|
@ -22,12 +22,11 @@
|
|||
android:layout_marginTop="@{model.isGroupedWithPreviousOne ? @dimen/chat_bubble_grouped_top_margin : @dimen/chat_bubble_top_margin, default=@dimen/chat_bubble_top_margin}"
|
||||
android:layout_marginStart="16dp">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_bubble_size"
|
||||
android:layout_height="@dimen/avatar_bubble_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
android:visibility="@{!model.isFromGroup ? View.GONE: model.isGroupedWithPreviousOne ? View.INVISIBLE : View.VISIBLE}"
|
||||
coilBubbleAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -41,15 +41,14 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{viewModel.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
|
|
@ -59,8 +58,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_size"
|
||||
android:src="@{viewModel.avatarModel.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.avatarModel.trust == SecurityLevel.Encrypted || viewModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{viewModel.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.avatarModel.trust == SecurityLevel.Safe || viewModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,13 +30,12 @@
|
|||
android:paddingBottom="4dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -58,8 +57,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_size"
|
||||
android:src="@{model.avatarModel.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.avatarModel.trust == SecurityLevel.Encrypted || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,11 @@
|
|||
android:padding="5dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_favorite_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_favorite_list_cell_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
@ -53,8 +52,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_size"
|
||||
android:src="@{model.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.trust == SecurityLevel.Encrypted || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{model.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.trust == SecurityLevel.Safe || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -96,13 +96,12 @@
|
|||
app:constraint_referenced_ids="trusted_devices_count, trust_background, trusted_devices_progress, devices, trusted_devices_progress_label"
|
||||
android:visibility="@{viewModel.expandDevicesTrust ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilBigAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -124,8 +123,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
|
||||
android:src="@{viewModel.contact.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.contact.trust == SecurityLevel.Encrypted || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{viewModel.contact.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.contact.trust == SecurityLevel.Safe || viewModel.contact.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -52,15 +52,14 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/header"
|
||||
|
|
@ -82,8 +81,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_size"
|
||||
android:src="@{model.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.trust == SecurityLevel.Encrypted || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{model.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.trust == SecurityLevel.Safe || model.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:onClick="@{pickImageClickListener}"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coil="@{viewModel.picturePath}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilBigAvatar="@{viewModel.callLogModel.avatarModel}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -98,8 +98,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_in_call_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_in_call_size"
|
||||
android:src="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Encrypted || viewModel.callLogModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.callLogModel.avatarModel.trust == SecurityLevel.Safe || viewModel.callLogModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,15 +29,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -59,8 +58,8 @@
|
|||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_size"
|
||||
android:src="@{model.avatarModel.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.avatarModel.trust == SecurityLevel.Encrypted || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
android:src="@{model.avatarModel.trust == SecurityLevel.Safe ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{model.avatarModel.trust == SecurityLevel.Safe || model.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,14 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -21,14 +21,13 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilInitials="@{model.initials, default=`JD`}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@
|
|||
app:constraint_referenced_ids="title, search"
|
||||
app:barrierDirection="bottom" />
|
||||
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:onClick="@{() -> viewModel.openDrawerMenu()}"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="15dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
coilAvatar="@{viewModel.account}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
<dimen name="avatar_favorite_list_cell_size">50dp</dimen>
|
||||
<dimen name="avatar_big_size">100dp</dimen>
|
||||
<dimen name="avatar_in_call_size">120dp</dimen>
|
||||
|
||||
<dimen name="avatar_bubble_presence_badge_size">5dp</dimen>
|
||||
<dimen name="avatar_presence_badge_size">12dp</dimen>
|
||||
<dimen name="avatar_presence_badge_in_call_size">26dp</dimen>
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
<dimen name="avatar_presence_badge_big_size">22dp</dimen>
|
||||
<dimen name="avatar_presence_badge_big_padding">3dp</dimen>
|
||||
<dimen name="avatar_presence_badge_big_end_margin">5dp</dimen>
|
||||
|
||||
<dimen name="avatar_trust_border_width">2dp</dimen>
|
||||
|
||||
<dimen name="avatar_initials_text_size">16sp</dimen>
|
||||
|
|
|
|||
|
|
@ -146,4 +146,16 @@
|
|||
<item name="trackTint">@color/switch_track_color</item>
|
||||
<item name="trackDecorationTint">@color/transparent_color</item>
|
||||
</style>
|
||||
<style name="ShapeAppearance.CircularBorder" parent="">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">50%</item>
|
||||
</style>
|
||||
<style name="avatar_imageview">
|
||||
<item name="android:padding">1dp</item> <!-- half the size of the border @dimen/avatar_trust_border_width -->
|
||||
<item name="android:background">@drawable/shape_circle_light_blue_background</item>
|
||||
<item name="android:adjustViewBounds">true</item>
|
||||
<item name="shapeAppearanceOverlay">@style/ShapeAppearance.CircularBorder</item>
|
||||
<item name="strokeColor">@color/transparent_color</item>
|
||||
<item name="strokeWidth">0dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue