From 8620ebc15a7b0563a857a0d5034682a26306c225 Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Fri, 13 Dec 2024 22:04:44 +0100 Subject: [PATCH] DROID-2815 fixes --- .../core_ui/features/editor/holders/media/Picture.kt | 5 +++++ core-ui/src/main/res/layout/item_block_picture.xml | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt index d894f4ca23..30309f61d5 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/media/Picture.kt @@ -8,6 +8,7 @@ import com.anytypeio.anytype.core_ui.databinding.ItemBlockPictureBinding import com.anytypeio.anytype.core_ui.features.editor.decoration.DecoratableCardViewHolder import com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer import com.anytypeio.anytype.core_ui.features.editor.decoration.applySelectorOffset +import com.anytypeio.anytype.core_utils.ext.gone import com.anytypeio.anytype.core_utils.ext.invisible import com.anytypeio.anytype.core_utils.ext.visible import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType @@ -26,6 +27,7 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor override val clickContainer: View = root private val image = binding.image private val error = binding.error + private val loading = binding.progress override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer override val decoratableCard: View = binding.card @@ -42,6 +44,7 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor target: Target, isFirstResource: Boolean ): Boolean { + loading.gone() error.visible() Timber.w(e, "Error while loading picture with url: $model") return false @@ -54,6 +57,7 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor dataSource: DataSource, isFirstResource: Boolean ): Boolean { + loading.gone() error.invisible() return false } @@ -61,6 +65,7 @@ class Picture(val binding: ItemBlockPictureBinding) : Media(binding.root), Decor fun bind(item: BlockView.Media.Picture, clicked: (ListenerType) -> Unit) { super.bind(item, clicked) + loading.visible() Glide .with(image) .load(item.url) diff --git a/core-ui/src/main/res/layout/item_block_picture.xml b/core-ui/src/main/res/layout/item_block_picture.xml index 8fc9d81221..e61449aa00 100644 --- a/core-ui/src/main/res/layout/item_block_picture.xml +++ b/core-ui/src/main/res/layout/item_block_picture.xml @@ -20,6 +20,14 @@ app:cardElevation="0dp" app:cardCornerRadius="8dp"> + +