diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/decoration/DecoratableViewHolder.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/decoration/DecoratableViewHolder.kt index cd8bb49244..ceec78af5f 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/decoration/DecoratableViewHolder.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/decoration/DecoratableViewHolder.kt @@ -14,7 +14,6 @@ import androidx.core.view.updateLayoutParams import com.anytypeio.anytype.core_ui.BuildConfig import com.anytypeio.anytype.core_ui.R import com.anytypeio.anytype.presentation.editor.editor.model.BlockView -import com.anytypeio.anytype.presentation.editor.model.Indent interface DecoratableViewHolder { val decoratableContainer: EditorDecorationContainer @@ -24,16 +23,16 @@ interface DecoratableViewHolder { } } -interface DecoratableCardViewHolder: DecoratableViewHolder { +interface DecoratableCardViewHolder : DecoratableViewHolder { val decoratableCard: View + @CallSuper override fun applyDecorations(decorations: List) { if (BuildConfig.NESTED_DECORATION_ENABLED) { decoratableContainer.decorate(decorations) { rect -> decoratableCard.applyCardDecorations( rect = rect, - res = decoratableCard.resources, - indent = decorations.lastIndex + res = decoratableCard.resources ) } } @@ -41,15 +40,14 @@ interface DecoratableCardViewHolder: DecoratableViewHolder { } /** - * Applying decorations for card blocks (media blocks, placeholders, etc.) + * Applying decorations for card blocks (media blocks, placeholders, link-to-objects, bookmarks, etc.) */ inline fun View.applyCardDecorations( rect: Rect, - res: Resources, - indent: Indent + res: Resources ) = updateLayoutParams { val defaultIndentOffset = res.getDimension(R.dimen.default_indent).toInt() - marginStart = if (indent == 0) defaultIndentOffset + rect.left else rect.left + marginStart = defaultIndentOffset + rect.left marginEnd = defaultIndentOffset + rect.right topMargin = res.getDimension(R.dimen.card_block_extra_space_top).toInt() bottomMargin = res.getDimension(R.dimen.card_block_extra_space_bottom).toInt() + rect.bottom