mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 21:48:50 +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) {
|
override fun bind(holder: Holder) {
|
||||||
super.bind(holder)
|
super.bind(holder)
|
||||||
holder.image.onClick(clickListener?.takeIf { enabled })
|
holder.imageContainer.onClick(clickListener?.takeIf { enabled })
|
||||||
GlideApp.with(holder.image)
|
GlideApp.with(holder.image)
|
||||||
.load(imageUri)
|
.load(imageUri)
|
||||||
.apply(RequestOptions.circleCropTransform())
|
.apply(RequestOptions.circleCropTransform())
|
||||||
.placeholder(R.drawable.bg_accent)
|
|
||||||
.into(holder.image)
|
.into(holder.image)
|
||||||
holder.delete.isVisible = imageUri != null
|
holder.delete.isVisible = imageUri != null
|
||||||
holder.delete.onClick(deleteListener?.takeIf { enabled })
|
holder.delete.onClick(deleteListener?.takeIf { enabled })
|
||||||
}
|
}
|
||||||
|
|
||||||
class Holder : VectorEpoxyHolder() {
|
class Holder : VectorEpoxyHolder() {
|
||||||
|
val imageContainer by bind<View>(R.id.itemEditableAvatarImageContainer)
|
||||||
val image by bind<ImageView>(R.id.itemEditableAvatarImage)
|
val image by bind<ImageView>(R.id.itemEditableAvatarImage)
|
||||||
val delete by bind<View>(R.id.itemEditableAvatarDelete)
|
val delete by bind<View>(R.id.itemEditableAvatarDelete)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
<solid android:color="?colorAccent" />
|
<solid android:color="?riotx_header_panel_background" />
|
||||||
|
|
||||||
</shape>
|
</shape>
|
|
@ -8,16 +8,33 @@
|
||||||
android:background="?riotx_background"
|
android:background="?riotx_background"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<!-- 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">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_add_image" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/itemEditableAvatarImage"
|
android:id="@+id/itemEditableAvatarImage"
|
||||||
android:layout_width="128dp"
|
android:layout_width="128dp"
|
||||||
android:layout_height="128dp"
|
android:layout_height="128dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:scaleType="center"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
tools:alpha="0.3"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:src="@tools:sample/avatars" />
|
tools:src="@tools:sample/avatars" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/itemEditableAvatarDelete"
|
android:id="@+id/itemEditableAvatarDelete"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
|
@ -26,20 +43,10 @@
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_delete"
|
android:src="@drawable/ic_delete"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/itemEditableAvatarImage"
|
app:layout_constraintEnd_toEndOf="@+id/itemEditableAvatarImageContainer"
|
||||||
app:layout_constraintTop_toTopOf="@+id/itemEditableAvatarImage"
|
app:layout_constraintTop_toTopOf="@+id/itemEditableAvatarImageContainer"
|
||||||
app:tint="@color/riotx_destructive_accent"
|
app:tint="@color/riotx_destructive_accent"
|
||||||
tools:ignore="MissingPrefix"
|
tools:ignore="MissingPrefix"
|
||||||
tools:visibility="visible" />
|
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>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
Loading…
Reference in a new issue