mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
UI tweak
This commit is contained in:
parent
c2a81c528f
commit
def6758aaa
3 changed files with 29 additions and 23 deletions
|
@ -50,17 +50,17 @@ abstract class FormEditableAvatarItem : EpoxyModelWithHolder<FormEditableAvatarI
|
|||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.image.onClick(clickListener?.takeIf { enabled })
|
||||
holder.imageContainer.onClick(clickListener?.takeIf { enabled })
|
||||
GlideApp.with(holder.image)
|
||||
.load(imageUri)
|
||||
.apply(RequestOptions.circleCropTransform())
|
||||
.placeholder(R.drawable.bg_accent)
|
||||
.into(holder.image)
|
||||
holder.delete.isVisible = imageUri != null
|
||||
holder.delete.onClick(deleteListener?.takeIf { enabled })
|
||||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder() {
|
||||
val imageContainer by bind<View>(R.id.itemEditableAvatarImageContainer)
|
||||
val image by bind<ImageView>(R.id.itemEditableAvatarImage)
|
||||
val delete by bind<View>(R.id.itemEditableAvatarDelete)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<solid android:color="?colorAccent" />
|
||||
|
||||
</shape>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="?riotx_header_panel_background" />
|
||||
</shape>
|
|
@ -8,15 +8,32 @@
|
|||
android:background="?riotx_background"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/itemEditableAvatarImage"
|
||||
<!-- I cannot do what I want using layer-list, do it manually here-->
|
||||
<FrameLayout
|
||||
android:id="@+id/itemEditableAvatarImageContainer"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:background="@drawable/header_panel_round_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_add_image" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/itemEditableAvatarImage"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:scaleType="center"
|
||||
tools:alpha="0.3"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/itemEditableAvatarDelete"
|
||||
|
@ -26,20 +43,10 @@
|
|||
android:scaleType="center"
|
||||
android:src="@drawable/ic_delete"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/itemEditableAvatarImage"
|
||||
app:layout_constraintTop_toTopOf="@+id/itemEditableAvatarImage"
|
||||
app:layout_constraintEnd_toEndOf="@+id/itemEditableAvatarImageContainer"
|
||||
app:layout_constraintTop_toTopOf="@+id/itemEditableAvatarImageContainer"
|
||||
app:tint="@color/riotx_destructive_accent"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/itemEditableAvatarPicto"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/circle"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_add_image"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/itemEditableAvatarImage"
|
||||
app:layout_constraintEnd_toEndOf="@+id/itemEditableAvatarImage" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
Loading…
Reference in a new issue