mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-217 Editor | Enhancement | Nested decoration for blocks relation (#2446)
* DROID-217 use binding in relationBlockHolder * DROID-217 block relation view implement Decoratable * DROID-217 decorations mapping * DROID-217 added decorationContainer to block relation layouts * DROID-217 block relation item, update design * DROID-217 relation block, design update 2 * DROID-217 block relation design * DROID-217 block relation holders, implement decorations * DROID-217 remove default root style for items * DROID-217 view id fix * DROID-217 fix tests Co-authored-by: konstantiniiv <ki@anytype.io>
This commit is contained in:
parent
424bbc5bad
commit
959a87cda6
21 changed files with 341 additions and 243 deletions
|
@ -41,9 +41,12 @@ import com.anytypeio.anytype.core_ui.databinding.ItemBlockObjectLinkDeleteBindin
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockObjectLinkLoadingBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockPictureBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockPictureUploadingBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationCheckboxBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationDefaultBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationFileBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationObjectBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationPlaceholderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationStatusBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationTagBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockTableBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockTextBinding
|
||||
|
@ -636,13 +639,8 @@ class BlockAdapter(
|
|||
)
|
||||
}
|
||||
HOLDER_RELATION_DEFAULT -> {
|
||||
RelationBlockViewHolder.Default(
|
||||
view = inflater.inflate(
|
||||
R.layout.item_block_relation_default,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
).setup(this)
|
||||
val binding = ItemBlockRelationDefaultBinding.inflate(inflater, parent, false)
|
||||
RelationBlockViewHolder.Default(binding).setup(this)
|
||||
}
|
||||
HOLDER_RELATION_PLACEHOLDER -> {
|
||||
RelationBlockViewHolder.Placeholder(
|
||||
|
@ -650,13 +648,8 @@ class BlockAdapter(
|
|||
).setupPlaceholder(this)
|
||||
}
|
||||
HOLDER_RELATION_STATUS -> {
|
||||
RelationBlockViewHolder.Status(
|
||||
view = inflater.inflate(
|
||||
R.layout.item_block_relation_status,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
).setup(this)
|
||||
val binding = ItemBlockRelationStatusBinding.inflate(inflater, parent, false)
|
||||
RelationBlockViewHolder.Status(binding).setup(this)
|
||||
}
|
||||
HOLDER_RELATION_TAGS -> {
|
||||
RelationBlockViewHolder.Tags(
|
||||
|
@ -674,13 +667,8 @@ class BlockAdapter(
|
|||
).setup(this)
|
||||
}
|
||||
HOLDER_RELATION_CHECKBOX -> {
|
||||
RelationBlockViewHolder.Checkbox(
|
||||
view = inflater.inflate(
|
||||
R.layout.item_block_relation_checkbox,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
).setup(this)
|
||||
val binding = ItemBlockRelationCheckboxBinding.inflate(inflater, parent, false)
|
||||
RelationBlockViewHolder.Checkbox(binding).setup(this)
|
||||
}
|
||||
HOLDER_FEATURED_RELATION -> {
|
||||
FeaturedRelationListViewHolder(
|
||||
|
|
|
@ -35,7 +35,7 @@ fun RelationBlockViewHolder.setupPlaceholder(adapter: BlockAdapter): RelationBlo
|
|||
with(itemView) {
|
||||
val paddingStart = context.dimen(R.dimen.default_document_content_padding_start)
|
||||
val paddingEnd = context.dimen(R.dimen.default_document_content_padding_end)
|
||||
findViewById<ViewGroup>(R.id.placeholderContainer).apply {
|
||||
findViewById<ViewGroup>(R.id.content).apply {
|
||||
setBackgroundResource(R.drawable.item_block_code_multi_select_mode_selector)
|
||||
updatePadding(left = paddingStart.toInt(), right = paddingEnd.toInt())
|
||||
}
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
package com.anytypeio.anytype.core_ui.features.editor.holders.relations
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationCheckboxBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationDefaultBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationFileBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationObjectBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationPlaceholderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationStatusBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockRelationTagBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationFileBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationObjectBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationTagBinding
|
||||
import com.anytypeio.anytype.core_ui.extensions.dark
|
||||
import com.anytypeio.anytype.core_ui.extensions.setBlockBackgroundColor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.DecoratableViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
import com.anytypeio.anytype.core_ui.widgets.GridCellFileItem
|
||||
import com.anytypeio.anytype.core_ui.widgets.RelationObjectItem
|
||||
import com.anytypeio.anytype.core_ui.widgets.text.TagWidget
|
||||
|
@ -34,32 +36,83 @@ sealed class RelationBlockViewHolder(
|
|||
view: View
|
||||
) : BlockViewHolder(view),
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
BlockViewHolder.IndentableHolder {
|
||||
BlockViewHolder.IndentableHolder,
|
||||
DecoratableViewHolder {
|
||||
|
||||
fun setBackgroundColor(color: String? = null) {
|
||||
itemView.setBlockBackgroundColor(color)
|
||||
}
|
||||
|
||||
class Placeholder(val binding: ItemBlockRelationPlaceholderBinding) : RelationBlockViewHolder(binding.root) {
|
||||
|
||||
val icon: View get() = itemView.findViewById(R.id.relationIcon)
|
||||
|
||||
fun bind(item: BlockView.Relation.Placeholder) = with(itemView) {
|
||||
findViewById<LinearLayout>(R.id.placeholderContainer).isSelected = item.isSelected
|
||||
indentize(item)
|
||||
fun indent(item: BlockView.Indentable, view: View) {
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
view.updatePadding(left = indent)
|
||||
}
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val indent = dimen(R.dimen.indent)
|
||||
icon.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
this.marginStart = item.indent * indent
|
||||
}
|
||||
|
||||
private fun applyDefaultOffsets(root: View) {
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
root.updatePadding(
|
||||
left = dimen(R.dimen.default_document_item_padding_start),
|
||||
right = dimen(R.dimen.default_document_item_padding_end)
|
||||
)
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
bottomMargin = dimen(R.dimen.dp_2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Default(view: View) : RelationBlockViewHolder(view) {
|
||||
fun bind(item: DocumentRelationView) : Unit = with(itemView) {
|
||||
findViewById<TextView>(R.id.tvRelationTitle).text = item.name
|
||||
findViewById<TextView>(R.id.tvRelationValue).apply {
|
||||
fun applyContentDecorations(
|
||||
viewGroup: ViewGroup,
|
||||
decorations: List<BlockView.Decoration>,
|
||||
) {
|
||||
if (BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
decoratableContainer.decorate(decorations = decorations) { rect ->
|
||||
viewGroup.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.dp_8) + rect.left
|
||||
marginEnd = dimen(R.dimen.dp_8) + rect.right
|
||||
bottomMargin = rect.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
applyDefaultOffsets(itemView)
|
||||
}
|
||||
|
||||
class Placeholder(binding: ItemBlockRelationPlaceholderBinding) :
|
||||
RelationBlockViewHolder(binding.root) {
|
||||
|
||||
val icon = binding.relationIcon
|
||||
val content = binding.content
|
||||
|
||||
fun bind(item: BlockView.Relation.Placeholder) = with(itemView) {
|
||||
content.isSelected = item.isSelected
|
||||
indentize(item)
|
||||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
indent(item, icon)
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content, decorations)
|
||||
}
|
||||
}
|
||||
|
||||
class Default(binding: ItemBlockRelationDefaultBinding) :
|
||||
RelationBlockViewHolder(binding.root) {
|
||||
|
||||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val tvValue = binding.content.tvRelationValue
|
||||
private val content = binding.content.root
|
||||
|
||||
fun bind(item: DocumentRelationView): Unit = with(itemView) {
|
||||
tvTitle.text = item.name
|
||||
tvValue.apply {
|
||||
text = item.value
|
||||
if (item is DocumentRelationView.Default) {
|
||||
when (item.format) {
|
||||
|
@ -77,30 +130,48 @@ sealed class RelationBlockViewHolder(
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val title = itemView.findViewById<TextView>(R.id.tvRelationTitle)
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
title.updatePadding(left = indent)
|
||||
indent(item, tvTitle)
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content, decorations)
|
||||
}
|
||||
}
|
||||
|
||||
class Checkbox(view: View) : RelationBlockViewHolder(view) {
|
||||
class Checkbox(binding: ItemBlockRelationCheckboxBinding) :
|
||||
RelationBlockViewHolder(binding.root) {
|
||||
|
||||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val tvCheckbox = binding.content.ivRelationCheckbox
|
||||
private val content = binding.content.root
|
||||
|
||||
fun bind(item: DocumentRelationView.Checkbox) = with(itemView) {
|
||||
findViewById<TextView>(R.id.tvRelationTitle).text = item.name
|
||||
findViewById<ImageView>(R.id.ivRelationCheckbox).isSelected = item.isChecked
|
||||
tvTitle.text = item.name
|
||||
tvCheckbox.isSelected = item.isChecked
|
||||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val title = itemView.findViewById<TextView>(R.id.tvRelationTitle)
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
title.updatePadding(left = indent)
|
||||
indent(item, tvTitle)
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content, decorations)
|
||||
}
|
||||
}
|
||||
|
||||
class Status(view: View) : RelationBlockViewHolder(view) {
|
||||
class Status(binding: ItemBlockRelationStatusBinding) : RelationBlockViewHolder(binding.root) {
|
||||
|
||||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val tvValue = binding.content.tvRelationValue
|
||||
private val content = binding.content.root
|
||||
|
||||
fun bind(item: DocumentRelationView.Status) {
|
||||
itemView.findViewById<TextView>(R.id.tvRelationTitle).text = item.name
|
||||
itemView.findViewById<TextView>(R.id.tvRelationValue).apply {
|
||||
tvTitle.text = item.name
|
||||
tvValue.apply {
|
||||
if (item.status.isNotEmpty()) {
|
||||
val status = item.status.first()
|
||||
text = status.status
|
||||
|
@ -118,18 +189,24 @@ sealed class RelationBlockViewHolder(
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val title = itemView.findViewById<TextView>(R.id.tvRelationTitle)
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
title.updatePadding(left = indent)
|
||||
indent(item, tvTitle)
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content, decorations)
|
||||
}
|
||||
}
|
||||
|
||||
class Tags(val binding: ViewBinding) : RelationBlockViewHolder(binding.root) {
|
||||
class Tags(binding: ItemBlockRelationTagBinding) : RelationBlockViewHolder(binding.root) {
|
||||
|
||||
private val placeholder : TextView get() = itemView.findViewById(R.id.tvPlaceholder)
|
||||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val content = binding.content
|
||||
private val placeholder = binding.content.tvPlaceholder
|
||||
|
||||
fun bind(item: DocumentRelationView.Tags) = with(itemView) {
|
||||
findViewById<TextView>(R.id.tvRelationTitle).text = item.name
|
||||
tvTitle.text = item.name
|
||||
if (item.tags.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
|
@ -139,57 +216,45 @@ sealed class RelationBlockViewHolder(
|
|||
item.tags.forEachIndexed { index, tagView ->
|
||||
when (index) {
|
||||
in 0..MAX_VISIBLE_TAGS_INDEX -> {
|
||||
getViewByIndex(index)?.let { view ->
|
||||
view.setup(tagView.tag, tagView.color)
|
||||
}
|
||||
getViewByIndex(index)?.setup(tagView.tag, tagView.color)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getViewByIndex(index: Int): TagWidget? = when(binding) {
|
||||
is ItemBlockRelationTagBinding -> {
|
||||
when (index) {
|
||||
0 -> binding.content.tag0
|
||||
1 -> binding.content.tag1
|
||||
2 -> binding.content.tag2
|
||||
3 -> binding.content.tag3
|
||||
4 -> binding.content.tag4
|
||||
5 -> binding.content.tag5
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
is ItemRelationListRelationTagBinding -> {
|
||||
when (index) {
|
||||
0 -> binding.content.tag0
|
||||
1 -> binding.content.tag1
|
||||
2 -> binding.content.tag2
|
||||
3 -> binding.content.tag3
|
||||
4 -> binding.content.tag4
|
||||
5 -> binding.content.tag5
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
private fun getViewByIndex(index: Int): TagWidget? = when (index) {
|
||||
0 -> content.tag0
|
||||
1 -> content.tag1
|
||||
2 -> content.tag2
|
||||
3 -> content.tag3
|
||||
4 -> content.tag4
|
||||
5 -> content.tag5
|
||||
else -> null
|
||||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
indent(item, tvTitle)
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content.root, decorations)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val MAX_VISIBLE_TAGS_INDEX = 5
|
||||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val title = itemView.findViewById<TextView>(R.id.tvRelationTitle)
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
title.updatePadding(left = indent)
|
||||
}
|
||||
}
|
||||
|
||||
class Object(val binding: ViewBinding) : RelationBlockViewHolder(binding.root) {
|
||||
class Object(binding: ItemBlockRelationObjectBinding) : RelationBlockViewHolder(binding.root) {
|
||||
|
||||
private val placeholder : TextView get() = itemView.findViewById(R.id.tvPlaceholder)
|
||||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val placeholder = binding.content.tvPlaceholder
|
||||
private val content = binding.content
|
||||
|
||||
fun bind(item: DocumentRelationView.Object) {
|
||||
itemView.findViewById<TextView>(R.id.tvRelationTitle).text = item.name
|
||||
tvTitle.text = item.name
|
||||
if (item.objects.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
|
@ -214,44 +279,36 @@ sealed class RelationBlockViewHolder(
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val title = itemView.findViewById<TextView>(R.id.tvRelationTitle)
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
title.updatePadding(left = indent)
|
||||
indent(item, tvTitle)
|
||||
}
|
||||
|
||||
private fun getViewByIndex(index: Int): RelationObjectItem? = when(binding) {
|
||||
is ItemBlockRelationObjectBinding -> {
|
||||
when (index) {
|
||||
0 -> binding.content.obj0
|
||||
1 -> binding.content.obj1
|
||||
2 -> binding.content.obj2
|
||||
3 -> binding.content.obj3
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
is ItemRelationListRelationObjectBinding -> {
|
||||
when (index) {
|
||||
0 -> binding.content.obj0
|
||||
1 -> binding.content.obj1
|
||||
2 -> binding.content.obj2
|
||||
3 -> binding.content.obj3
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
private fun getViewByIndex(index: Int): RelationObjectItem? = when (index) {
|
||||
0 -> content.obj0
|
||||
1 -> content.obj1
|
||||
2 -> content.obj2
|
||||
3 -> content.obj3
|
||||
else -> null
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content.root, decorations)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val MAX_VISIBLE_OBJECTS_INDEX = 3
|
||||
}
|
||||
}
|
||||
|
||||
class File(val binding: ViewBinding) : RelationBlockViewHolder(binding.root) {
|
||||
class File(binding: ItemBlockRelationFileBinding) : RelationBlockViewHolder(binding.root) {
|
||||
|
||||
private val placeholder : TextView get() = itemView.findViewById(R.id.tvPlaceholder)
|
||||
private val tvTitle = binding.content.tvRelationTitle
|
||||
private val placeholder = binding.content.tvPlaceholder
|
||||
private val content = binding.content
|
||||
|
||||
fun bind(item: DocumentRelationView.File) = with(itemView) {
|
||||
findViewById<TextView>(R.id.tvRelationTitle).text = item.name
|
||||
tvTitle.text = item.name
|
||||
if (item.files.isEmpty()) {
|
||||
placeholder.visible()
|
||||
} else {
|
||||
|
@ -269,34 +326,25 @@ sealed class RelationBlockViewHolder(
|
|||
}
|
||||
}
|
||||
|
||||
private fun getViewByIndex(index: Int): GridCellFileItem? = when(binding) {
|
||||
is ItemBlockRelationFileBinding -> {
|
||||
when (index) {
|
||||
0 -> binding.content.file0
|
||||
1 -> binding.content.file1
|
||||
2 -> binding.content.file2
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
is ItemRelationListRelationFileBinding -> {
|
||||
when (index) {
|
||||
0 -> binding.content.file0
|
||||
1 -> binding.content.file1
|
||||
2 -> binding.content.file2
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
private fun getViewByIndex(index: Int): GridCellFileItem? = when (index) {
|
||||
0 -> content.file0
|
||||
1 -> content.file1
|
||||
2 -> content.file2
|
||||
else -> null
|
||||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
indent(item, tvTitle)
|
||||
}
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer = binding.decorationContainer
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
applyContentDecorations(content.root, decorations)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val MAX_VISIBLE_FILES_INDEX = 2
|
||||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
val title = itemView.findViewById<TextView>(R.id.tvRelationTitle)
|
||||
val indent = dimen(R.dimen.indent) * item.indent
|
||||
title.updatePadding(left = indent)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultDocumentContainerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/content"
|
||||
layout="@layout/item_document_relation_checkbox"
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultDocumentContainerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/content"
|
||||
layout="@layout/item_document_relation_default"
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultDocumentContainerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/content"
|
||||
layout="@layout/item_document_relation_file"
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultDocumentContainerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/content"
|
||||
layout="@layout/item_document_relation_object"
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultDocumentContainerStyle">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/placeholderContainer"
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/item_block_multi_select_mode_selector"
|
||||
|
@ -29,9 +32,9 @@
|
|||
android:id="@+id/tvPlaceholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:text="@string/set_new_relation"
|
||||
android:textColor="@color/palette_dark_grey" />
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultDocumentContainerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/content"
|
||||
layout="@layout/item_document_relation_status"
|
||||
|
|
|
@ -2,10 +2,14 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultDocumentContainerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/content"
|
||||
layout="@layout/item_document_relation_tag"
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationTitle"
|
||||
<TextView android:id="@+id/tvRelationTitle"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="top"
|
||||
android:layout_weight="0.4"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:gravity="top"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
tools:text="Description of something" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0.6"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0.6">
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_relation_checkbox_selector"
|
||||
android:id="@+id/ivRelationCheckbox"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"/>
|
||||
|
||||
android:layout_height="16dp"
|
||||
android:src="@drawable/ic_relation_checkbox_selector" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,32 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/itemContainer"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationTitle"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="top"
|
||||
android:layout_weight="0.4"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:gravity="top"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
tools:text="Description of something" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationValue"
|
||||
style="@style/RelationViewValueStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:layout_weight="0.6"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/enter_value"
|
||||
android:singleLine="true"
|
||||
android:textColorHint="@color/text_tertiary"
|
||||
android:textColor="@color/text_primary"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
tools:text="@string/default_text_placeholder" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline3"
|
||||
|
@ -14,26 +14,28 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationTitle"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_gravity="top"
|
||||
android:gravity="top"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Description of something"
|
||||
tools:visibility="visible" />
|
||||
tools:text="Description of something" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/tvPlaceholder"
|
||||
style="@style/RelationPlaceholderTextStyle"
|
||||
android:text="@string/select_files"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/default_text_placeholder"
|
||||
style="@style/RelationPlaceholderTextStyle" />
|
||||
tools:text="@string/default_text_placeholder" />
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.GridCellFileItem
|
||||
android:id="@+id/file0"
|
||||
|
|
|
@ -7,26 +7,28 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationTitle"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_gravity="top"
|
||||
android:gravity="top"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Description of something"
|
||||
tools:visibility="visible" />
|
||||
tools:text="Description of something" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/tvPlaceholder"
|
||||
style="@style/RelationPlaceholderTextStyle"
|
||||
android:text="@string/select_objects"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/default_text_placeholder"
|
||||
style="@style/RelationPlaceholderTextStyle" />
|
||||
tools:text="@string/default_text_placeholder" />
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.RelationObjectItem
|
||||
android:id="@+id/obj0"
|
||||
|
|
|
@ -7,25 +7,24 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationTitle"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="top"
|
||||
android:layout_weight="0.4"
|
||||
style="@style/RelationViewTitleStyle"
|
||||
android:gravity="top"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
tools:text="Description of something" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRelationValue"
|
||||
style="@style/RelationViewValueStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0.6"
|
||||
android:ellipsize="end"
|
||||
android:hint="@string/select_status"
|
||||
android:textColorHint="@color/text_tertiary"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/text_primary"
|
||||
tools:text="@string/default_text_placeholder" />
|
||||
|
||||
</LinearLayout>
|
|
@ -18,22 +18,25 @@
|
|||
style="@style/RelationViewTitleStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="top"
|
||||
android:gravity="top"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Description" />
|
||||
tools:text="Description of something" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPlaceholder"
|
||||
android:visibility="gone"
|
||||
style="@style/RelationPlaceholderTextStyle"
|
||||
android:text="@string/select_tags"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/default_text_placeholder"
|
||||
style="@style/RelationPlaceholderTextStyle" />
|
||||
tools:text="@string/default_text_placeholder" />
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.text.TagWidget
|
||||
android:id="@+id/tag0"
|
||||
|
|
|
@ -577,11 +577,19 @@
|
|||
<item name="android:fontFamily">@font/inter_regular</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:maxLines">1</item>
|
||||
<item name="android:paddingEnd">8dp</item>
|
||||
<item name="android:maxLines">4</item>
|
||||
<item name="android:textColor">@color/text_secondary</item>
|
||||
</style>
|
||||
|
||||
<style name="RelationViewValueStyle">
|
||||
<item name="android:fontFamily">@font/inter_regular</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:textColorHint">@color/text_tertiary</item>
|
||||
<item name="android:maxLines">4</item>
|
||||
<item name="android:textColor">@color/text_primary</item>
|
||||
</style>
|
||||
|
||||
<style name="SelectedRelationCircleBadgeStyle">
|
||||
<item name="android:fontFamily">@font/inter_medium</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
|
|
|
@ -1060,7 +1060,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = view
|
||||
view = view,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
@ -1103,7 +1104,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = view
|
||||
view = view,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
@ -1145,7 +1147,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = view
|
||||
view = view,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
@ -1199,7 +1202,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = oldView
|
||||
view = oldView,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
@ -1253,7 +1257,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = oldView
|
||||
view = oldView,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
@ -1306,7 +1311,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = oldView
|
||||
view = oldView,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
@ -1359,7 +1365,8 @@ class BlockViewDiffUtilTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
isSelected = MockDataFactory.randomBoolean(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
view = oldView
|
||||
view = oldView,
|
||||
decorations = emptyList()
|
||||
)
|
||||
|
||||
val newBlock: BlockView = oldBlock.copy(
|
||||
|
|
|
@ -1145,11 +1145,12 @@ sealed class BlockView : ViewType {
|
|||
override fun getViewType(): Int = HOLDER_FEATURED_RELATION
|
||||
}
|
||||
|
||||
sealed class Relation : BlockView(), Selectable, Indentable {
|
||||
sealed class Relation : BlockView(), Selectable, Indentable, Decoratable {
|
||||
data class Placeholder(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false
|
||||
override val isSelected: Boolean = false,
|
||||
override val decorations: List<Decoration>
|
||||
) : Relation() {
|
||||
override fun getViewType(): Int = HOLDER_RELATION_PLACEHOLDER
|
||||
}
|
||||
|
@ -1159,7 +1160,8 @@ sealed class BlockView : ViewType {
|
|||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false,
|
||||
val background: String? = null,
|
||||
val view: DocumentRelationView
|
||||
val view: DocumentRelationView,
|
||||
override val decorations: List<Decoration>
|
||||
) : Relation() {
|
||||
override fun getViewType(): Int = when (view) {
|
||||
is DocumentRelationView.Default -> HOLDER_RELATION_DEFAULT
|
||||
|
|
|
@ -518,17 +518,18 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
}
|
||||
Content.Text.Style.CALLOUT -> {
|
||||
mCounter = 0
|
||||
val blockDecorationScheme: NestedDecorationData = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Callout(
|
||||
start = block.id,
|
||||
end = block.children.lastOrNull() ?: block.id
|
||||
),
|
||||
background = block.parseThemeBackgroundColor()
|
||||
val blockDecorationScheme: NestedDecorationData =
|
||||
buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Callout(
|
||||
start = block.id,
|
||||
end = block.children.lastOrNull() ?: block.id
|
||||
),
|
||||
background = block.parseThemeBackgroundColor()
|
||||
)
|
||||
)
|
||||
)
|
||||
result.add(
|
||||
callout(
|
||||
mode = mode,
|
||||
|
@ -679,6 +680,10 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
is Content.RelationBlock -> {
|
||||
isPreviousBlockMedia = false
|
||||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
result.add(
|
||||
relation(
|
||||
ctx = root.id,
|
||||
|
@ -687,7 +692,8 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
indent = indent,
|
||||
details = details,
|
||||
relations = relations,
|
||||
urlBuilder = urlBuilder
|
||||
urlBuilder = urlBuilder,
|
||||
schema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1949,12 +1955,14 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
indent: Int,
|
||||
details: Block.Details,
|
||||
relations: List<Relation>,
|
||||
urlBuilder: UrlBuilder
|
||||
urlBuilder: UrlBuilder,
|
||||
schema: NestedDecorationData
|
||||
): BlockView.Relation {
|
||||
if (content.key.isNullOrEmpty()) {
|
||||
return BlockView.Relation.Placeholder(
|
||||
id = block.id,
|
||||
indent = indent
|
||||
indent = indent,
|
||||
decorations = schema.toBlockViewDecoration(block)
|
||||
)
|
||||
} else {
|
||||
val relation = relations.firstOrNull { it.key == content.key }
|
||||
|
@ -1969,18 +1977,21 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
id = block.id,
|
||||
view = view,
|
||||
indent = indent,
|
||||
background = block.backgroundColor
|
||||
background = block.backgroundColor,
|
||||
decorations = schema.toBlockViewDecoration(block)
|
||||
)
|
||||
} else {
|
||||
BlockView.Relation.Placeholder(
|
||||
id = block.id,
|
||||
indent = indent
|
||||
indent = indent,
|
||||
decorations = schema.toBlockViewDecoration(block)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
return BlockView.Relation.Placeholder(
|
||||
id = block.id,
|
||||
indent = indent
|
||||
indent = indent,
|
||||
decorations = schema.toBlockViewDecoration(block)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,8 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
|
|||
name = relation.name,
|
||||
value = value,
|
||||
format = relation.format
|
||||
)
|
||||
),
|
||||
decorations = listOf()
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -232,7 +233,8 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
|
|||
BlockView.Relation.Placeholder(
|
||||
id = relationBlock.id,
|
||||
indent = 0,
|
||||
isSelected = false
|
||||
isSelected = false,
|
||||
decorations = listOf()
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -343,7 +345,8 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
|
|||
value = value2,
|
||||
isFeatured = false,
|
||||
format = r2.format
|
||||
)
|
||||
),
|
||||
decorations = listOf()
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -448,7 +451,8 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() {
|
|||
BlockView.Relation.Placeholder(
|
||||
id = relationBlock.id,
|
||||
indent = 0,
|
||||
isSelected = false
|
||||
isSelected = false,
|
||||
decorations = listOf()
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue