mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-02-01 19:29:24 +00:00
Huge performances boost by removing AvatarView, todo: do it everywhere
This commit is contained in:
parent
888c8c453a
commit
daacb3ca98
3 changed files with 10 additions and 16 deletions
|
|
@ -90,11 +90,7 @@ class LinphoneApplication : Application(), ImageLoaderFactory {
|
|||
.components {
|
||||
add(VideoFrameDecoder.Factory())
|
||||
add(SvgDecoder.Factory())
|
||||
if (Version.sdkAboveOrEqual(Version.API28_PIE_90)) {
|
||||
add(ImageDecoderDecoder.Factory())
|
||||
} else {
|
||||
add(GifDecoder.Factory())
|
||||
}
|
||||
add(ImageDecoderDecoder.Factory())
|
||||
}
|
||||
.memoryCache {
|
||||
MemoryCache.Builder(this)
|
||||
|
|
|
|||
|
|
@ -173,10 +173,10 @@ fun AppCompatTextView.setDrawableTint(@ColorInt color: Int) {
|
|||
|
||||
@UiThread
|
||||
@BindingAdapter("coil")
|
||||
fun loadPictureWithCoil(imageView: ImageView, file: String?) {
|
||||
fun ImageView.loadCircleFileWithCoil(file: String?) {
|
||||
Log.i("[Data Binding Utils] Loading file [$file] with coil")
|
||||
if (file != null) {
|
||||
imageView.load(file) {
|
||||
load(file) {
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
}
|
||||
|
|
@ -309,6 +309,11 @@ fun AvatarView.loadContactAvatar(contact: ContactAvatarModel?) {
|
|||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("contactPicture")
|
||||
fun ImageView.loadContactPicture(contact: ContactAvatarModel?) {
|
||||
loadCircleFileWithCoil(contact?.avatar?.value?.toString())
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("groupAvatar")
|
||||
fun AvatarView.loadGroupAvatar(contact: GroupAvatarModel?) {
|
||||
|
|
|
|||
|
|
@ -22,21 +22,14 @@
|
|||
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">
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<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}"
|
||||
contactAvatar="@{model.avatarModel}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
contactPicture="@{model.avatarModel}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue