mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
Droid 179 Editor | Enhancement | Nested decoration for link-to-object blocks (#2438)
* DROID-179 decors for link-to-object card * DROID-179 fixes * DROID-179 rendering nested decoration for default link-to-object block * DROID-179 rendering nested decoration for deleted and archived link link-to-object blocks * DROID-179 revert toggles
This commit is contained in:
parent
9eac4ba83c
commit
f1c8ae8280
12 changed files with 381 additions and 161 deletions
|
@ -3,9 +3,12 @@ package com.anytypeio.anytype.core_ui.features.editor.holders.other
|
|||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.style.UnderlineSpan
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.common.SearchHighlightSpan
|
||||
import com.anytypeio.anytype.core_ui.common.SearchTargetHighlightSpan
|
||||
|
@ -16,6 +19,7 @@ import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
|||
import com.anytypeio.anytype.core_ui.features.editor.EditorTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportCustomTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportNesting
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.DecoratableViewHolder
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.core_utils.ext.gone
|
||||
import com.anytypeio.anytype.core_utils.ext.removeSpans
|
||||
|
@ -30,6 +34,7 @@ class LinkToObject(
|
|||
) : BlockViewHolder(binding.root),
|
||||
BlockViewHolder.IndentableHolder,
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
DecoratableViewHolder,
|
||||
SupportCustomTouchProcessor,
|
||||
SupportNesting {
|
||||
|
||||
|
@ -44,8 +49,24 @@ class LinkToObject(
|
|||
fallback = { e -> itemView.onTouchEvent(e) }
|
||||
)
|
||||
|
||||
override val decoratableContainer = binding.decorationContainer
|
||||
|
||||
init {
|
||||
itemView.setOnTouchListener { v, e -> editorTouchProcessor.process(v, e) }
|
||||
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.default_graphic_text_root_margin_bottom)
|
||||
topMargin = dimen(R.dimen.default_graphic_text_root_margin_top)
|
||||
}
|
||||
container.updatePadding(
|
||||
left = dimen(R.dimen.default_graphic_text_container_padding_start),
|
||||
right = dimen(R.dimen.default_graphic_text_container_padding_end)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(
|
||||
|
@ -134,8 +155,10 @@ class LinkToObject(
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
marginStart = item.indent * dimen(R.dimen.indent)
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
marginStart = item.indent * dimen(R.dimen.indent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +181,21 @@ class LinkToObject(
|
|||
}
|
||||
|
||||
private fun applyBackground(background: String?) {
|
||||
root.setBlockBackgroundColor(background)
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
root.setBlockBackgroundColor(background)
|
||||
}
|
||||
}
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
if (BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
decoratableContainer.decorate(decorations) { rect ->
|
||||
binding.container.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.default_indent) + rect.left
|
||||
marginEnd = dimen(R.dimen.dp_8) + rect.right
|
||||
bottomMargin = rect.bottom
|
||||
// TODO handle top and bottom offsets
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,13 +2,23 @@ package com.anytypeio.anytype.core_ui.features.editor.holders.other
|
|||
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.common.SearchHighlightSpan
|
||||
import com.anytypeio.anytype.core_ui.common.SearchTargetHighlightSpan
|
||||
import com.anytypeio.anytype.core_ui.common.Span
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockObjectLinkArchiveBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.*
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.EditorTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportCustomTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportNesting
|
||||
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_utils.ext.VALUE_ROUNDED
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.core_utils.ext.removeSpans
|
||||
|
@ -26,6 +36,7 @@ class LinkToObjectArchive(
|
|||
) : BlockViewHolder(binding.root),
|
||||
BlockViewHolder.IndentableHolder,
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
DecoratableViewHolder,
|
||||
SupportCustomTouchProcessor,
|
||||
SupportNesting {
|
||||
|
||||
|
@ -41,8 +52,12 @@ class LinkToObjectArchive(
|
|||
fallback = { e -> itemView.onTouchEvent(e) }
|
||||
)
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer
|
||||
get() = binding.decorationContainer
|
||||
|
||||
init {
|
||||
itemView.setOnTouchListener { v, e -> editorTouchProcessor.process(v, e) }
|
||||
applyDefaultOffsets()
|
||||
}
|
||||
|
||||
fun bind(
|
||||
|
@ -113,9 +128,11 @@ class LinkToObjectArchive(
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
guideline.setGuidelineBegin(
|
||||
item.indent * dimen(R.dimen.indent)
|
||||
)
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
guideline.setGuidelineBegin(
|
||||
item.indent * dimen(R.dimen.indent)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun applySearchHighlight(item: BlockView.Searchable) {
|
||||
|
@ -161,4 +178,32 @@ class LinkToObjectArchive(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
if (BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
decoratableContainer.decorate(decorations) { rect ->
|
||||
binding.content.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.default_indent) + rect.left
|
||||
marginEnd = dimen(R.dimen.dp_8) + rect.right
|
||||
bottomMargin = rect.bottom
|
||||
// TODO handle top and bottom offsets
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyDefaultOffsets() {
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
binding.content.updatePadding(
|
||||
left = dimen(R.dimen.default_document_content_padding_start),
|
||||
right = dimen(R.dimen.default_document_item_padding_end)
|
||||
)
|
||||
binding.content.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.default_document_item_padding_start)
|
||||
marginEnd = dimen(R.dimen.default_document_item_padding_end)
|
||||
topMargin = dimen(R.dimen.dp_1)
|
||||
bottomMargin = dimen(R.dimen.dp_1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,9 +2,12 @@ package com.anytypeio.anytype.core_ui.features.editor.holders.other
|
|||
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.common.SearchHighlightSpan
|
||||
import com.anytypeio.anytype.core_ui.common.SearchTargetHighlightSpan
|
||||
|
@ -15,6 +18,8 @@ import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
|||
import com.anytypeio.anytype.core_ui.features.editor.EditorTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportCustomTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportNesting
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.DecoratableCardViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.decoration.applySelectorOffset
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.core_utils.ext.gone
|
||||
import com.anytypeio.anytype.core_utils.ext.removeSpans
|
||||
|
@ -26,10 +31,12 @@ import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
|||
import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
||||
import com.bumptech.glide.Glide
|
||||
|
||||
class LinkToObjectCard(binding: ItemBlockObjectLinkCardBinding) :
|
||||
BlockViewHolder(binding.root),
|
||||
class LinkToObjectCard(
|
||||
private val binding: ItemBlockObjectLinkCardBinding
|
||||
) : BlockViewHolder(binding.root),
|
||||
BlockViewHolder.IndentableHolder,
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
DecoratableCardViewHolder,
|
||||
SupportCustomTouchProcessor,
|
||||
SupportNesting {
|
||||
|
||||
|
@ -43,12 +50,16 @@ class LinkToObjectCard(binding: ItemBlockObjectLinkCardBinding) :
|
|||
private val selected = binding.selected
|
||||
private val type = binding.cardType
|
||||
|
||||
override val decoratableContainer = binding.decorationContainer
|
||||
override val decoratableCard = binding.card
|
||||
|
||||
override val editorTouchProcessor = EditorTouchProcessor(
|
||||
fallback = { e -> itemView.onTouchEvent(e) }
|
||||
)
|
||||
|
||||
init {
|
||||
itemView.setOnTouchListener { v, e -> editorTouchProcessor.process(v, e) }
|
||||
applyDefaultOffsets()
|
||||
}
|
||||
|
||||
fun bind(
|
||||
|
@ -159,8 +170,10 @@ class LinkToObjectCard(binding: ItemBlockObjectLinkCardBinding) :
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
marginStart = item.indent * dimen(R.dimen.indent)
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
marginStart = item.indent * dimen(R.dimen.indent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,15 +256,18 @@ class LinkToObjectCard(binding: ItemBlockObjectLinkCardBinding) :
|
|||
}
|
||||
|
||||
private fun applyRootMargins(item: BlockView.LinkToObject.Default.Card) {
|
||||
if (item.isPreviousBlockMedia) {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
apply { topMargin = 0 }
|
||||
}
|
||||
} else {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
apply {
|
||||
topMargin =
|
||||
root.resources.getDimension(R.dimen.default_link_card_root_margin_top).toInt()
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
if (item.isPreviousBlockMedia) {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
apply { topMargin = 0 }
|
||||
}
|
||||
} else {
|
||||
root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
apply {
|
||||
topMargin =
|
||||
root.resources.getDimension(R.dimen.default_link_card_root_margin_top)
|
||||
.toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,4 +281,30 @@ class LinkToObjectCard(binding: ItemBlockObjectLinkCardBinding) :
|
|||
type.gone()
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyDefaultOffsets() {
|
||||
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_10)
|
||||
}
|
||||
binding.card.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.dp_12)
|
||||
marginEnd = dimen(R.dimen.dp_12)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
super.applyDecorations(decorations)
|
||||
if (BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
binding.selected.applySelectorOffset<FrameLayout.LayoutParams>(
|
||||
content = binding.card,
|
||||
res = itemView.resources
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,17 @@
|
|||
package com.anytypeio.anytype.core_ui.features.editor.holders.other
|
||||
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemBlockObjectLinkDeleteBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.EditorTouchProcessor
|
||||
import com.anytypeio.anytype.core_ui.features.editor.SupportCustomTouchProcessor
|
||||
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_utils.ext.dimen
|
||||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
|
@ -15,16 +21,21 @@ class LinkToObjectDelete(
|
|||
) : BlockViewHolder(binding.root),
|
||||
BlockViewHolder.IndentableHolder,
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
DecoratableViewHolder,
|
||||
SupportCustomTouchProcessor {
|
||||
|
||||
private val guideline = binding.pageGuideline
|
||||
|
||||
override val decoratableContainer: EditorDecorationContainer
|
||||
get() = binding.decorationContainer
|
||||
|
||||
override val editorTouchProcessor = EditorTouchProcessor(
|
||||
fallback = { e -> itemView.onTouchEvent(e) }
|
||||
)
|
||||
|
||||
init {
|
||||
itemView.setOnTouchListener { v, e -> editorTouchProcessor.process(v, e) }
|
||||
applyDefaultOffsets()
|
||||
}
|
||||
|
||||
fun bind(
|
||||
|
@ -37,7 +48,9 @@ class LinkToObjectDelete(
|
|||
}
|
||||
|
||||
override fun indentize(item: BlockView.Indentable) {
|
||||
guideline.setGuidelineBegin(item.indent * dimen(R.dimen.indent))
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
guideline.setGuidelineBegin(item.indent * dimen(R.dimen.indent))
|
||||
}
|
||||
}
|
||||
|
||||
fun processChangePayload(payloads: List<BlockViewDiffUtil.Payload>, item: BlockView) {
|
||||
|
@ -48,4 +61,32 @@ class LinkToObjectDelete(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun applyDecorations(decorations: List<BlockView.Decoration>) {
|
||||
if (BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
decoratableContainer.decorate(decorations) { rect ->
|
||||
binding.content.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.default_indent) + rect.left
|
||||
marginEnd = dimen(R.dimen.dp_8) + rect.right
|
||||
bottomMargin = rect.bottom
|
||||
// TODO handle top and bottom offsets
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyDefaultOffsets() {
|
||||
if (!BuildConfig.NESTED_DECORATION_ENABLED) {
|
||||
binding.content.updatePadding(
|
||||
left = dimen(R.dimen.default_document_content_padding_start),
|
||||
right = dimen(R.dimen.default_document_item_padding_end)
|
||||
)
|
||||
binding.content.updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
marginStart = dimen(R.dimen.default_document_item_padding_start)
|
||||
marginEnd = dimen(R.dimen.default_document_item_padding_end)
|
||||
topMargin = dimen(R.dimen.dp_1)
|
||||
bottomMargin = dimen(R.dimen.dp_1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,16 +3,20 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultGraphicTextBlockRootStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:context="com.anytypeio.anytype.core_ui.features.editor.holders.other.LinkToObject">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.features.editor.decoration.EditorDecorationContainer
|
||||
android:id="@+id/decorationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/DefaultGraphicTextBlockContainerStyle"
|
||||
android:background="@drawable/item_block_multi_select_mode_selector"
|
||||
tools:background="@drawable/item_block_multi_select_selected">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
|
@ -37,8 +41,8 @@
|
|||
app:emojiSize="20dp"
|
||||
app:hasEmojiRounded8Background="false"
|
||||
app:hasInitialRounded8Background="true"
|
||||
app:imageSize="20dp"
|
||||
app:imageCornerRadius="@dimen/list_item_object_image_corner_radius_small"
|
||||
app:imageSize="20dp"
|
||||
app:initialTextSize="13sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -1,62 +1,68 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
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"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="@drawable/item_block_multi_select_mode_selector"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp">
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/pageGuideline"
|
||||
android:layout_width="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" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="0dp" />
|
||||
android:background="@drawable/item_block_multi_select_mode_selector">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/pageIconContainer"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pageGuideline"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pageIcon"
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/pageGuideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/content_description_page_icon" />
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="0dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/linkImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<FrameLayout
|
||||
android:id="@+id/pageIconContainer"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pageGuideline"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/linkEmoji"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center" />
|
||||
<ImageView
|
||||
android:id="@+id/pageIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/content_description_page_icon" />
|
||||
|
||||
</FrameLayout>
|
||||
<ImageView
|
||||
android:id="@+id/linkImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.text.TextHighlightWidget
|
||||
android:id="@+id/pageTitle"
|
||||
style="@style/BlockPageArchivedContentStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/pageIconContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Partnership terms Partnership terms Partnership terms Partnership terms" />
|
||||
<ImageView
|
||||
android:id="@+id/linkEmoji"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.text.TextHighlightWidget
|
||||
android:id="@+id/pageTitle"
|
||||
style="@style/BlockPageArchivedContentStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/pageIconContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Partnership terms Partnership terms Partnership terms Partnership terms" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
|
@ -3,10 +3,14 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
style="@style/DefaultLinkCardBlockRootStyle"
|
||||
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" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,51 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout 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"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="@drawable/item_block_multi_select_mode_selector"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/pageGuideline"
|
||||
android:layout_width="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" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="0dp" />
|
||||
android:background="@drawable/item_block_multi_select_mode_selector">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/pageIconContainer"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pageGuideline"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/pageGuideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="0dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_non_existent_object"/>
|
||||
<FrameLayout
|
||||
android:id="@+id/pageIconContainer"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pageGuideline"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
</FrameLayout>
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_non_existent_object" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/linkDeleteTitle"
|
||||
style="@style/BlockObjectLinkDeleteContentStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:text="@string/non_existent_object"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/pageIconContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Non-existent object" />
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<TextView
|
||||
android:id="@+id/linkDeleteTitle"
|
||||
style="@style/BlockObjectLinkDeleteContentStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:text="@string/non_existent_object"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/pageIconContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Non-existent object" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
|
@ -921,14 +921,6 @@
|
|||
<item name="android:layout_height">1dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Editor, link as card block style, {root {card {containerWithBackground {cover, guideline, icon, name, descr}}}, selected}-->
|
||||
<style name="DefaultLinkCardBlockRootStyle">
|
||||
<item name="android:layout_marginTop">0dp</item>
|
||||
<item name="android:layout_marginBottom">10dp</item>
|
||||
<item name="android:paddingStart">@dimen/default_document_item_padding_start</item>
|
||||
<item name="android:paddingEnd">@dimen/default_document_item_padding_end</item>
|
||||
</style>
|
||||
|
||||
<!-- card -->
|
||||
<style name="DefaultLinkCardBlockCardStyle">
|
||||
<item name="android:minHeight">96dp</item>
|
||||
|
@ -937,8 +929,6 @@
|
|||
<item name="rippleColor">@android:color/transparent</item>
|
||||
<item name="strokeColor">@color/shape_primary</item>
|
||||
<item name="strokeWidth">0.5dp</item>
|
||||
<item name="android:layout_marginEnd">12dp</item>
|
||||
<item name="android:layout_marginStart">12dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Editor, Table of Contents block -->
|
||||
|
|
|
@ -11,8 +11,8 @@ android {
|
|||
minSdkVersion config["min_sdk"]
|
||||
targetSdkVersion config["target_sdk"]
|
||||
testInstrumentationRunner config["test_runner"]
|
||||
buildConfigField "boolean", "ENABLE_LINK_APPERANCE_MENU", "true"
|
||||
buildConfigField "boolean", "NESTED_DECORATION_ENABLED", "false"
|
||||
buildConfigField "boolean", "ENABLE_LINK_APPERANCE_MENU", "false"
|
||||
}
|
||||
|
||||
testOptions.unitTests.includeAndroidResources = true
|
||||
|
|
|
@ -1017,7 +1017,7 @@ sealed class BlockView : ViewType {
|
|||
}
|
||||
}
|
||||
|
||||
sealed class LinkToObject : BlockView(), Indentable, Selectable {
|
||||
sealed class LinkToObject : BlockView(), Indentable, Selectable, Decoratable {
|
||||
|
||||
/**
|
||||
* UI-model for blocks containing links to objects.
|
||||
|
@ -1044,7 +1044,8 @@ sealed class BlockView : ViewType {
|
|||
override val text: String? = null,
|
||||
override val description: String? = null,
|
||||
override val icon: ObjectIcon,
|
||||
override val backgroundColor: String?
|
||||
override val backgroundColor: String?,
|
||||
override val decorations: List<Decoration> = emptyList()
|
||||
) : Default(), Searchable {
|
||||
override fun getViewType() = HOLDER_OBJECT_LINK_DEFAULT
|
||||
}
|
||||
|
@ -1058,6 +1059,7 @@ sealed class BlockView : ViewType {
|
|||
override val description: String? = null,
|
||||
override val icon: ObjectIcon,
|
||||
override val backgroundColor: String?,
|
||||
override val decorations: List<Decoration> = emptyList(),
|
||||
val objectTypeName: String?,
|
||||
val coverColor: CoverColor? = null,
|
||||
val coverImage: Url? = null,
|
||||
|
@ -1080,6 +1082,7 @@ sealed class BlockView : ViewType {
|
|||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false,
|
||||
override val searchFields: List<Searchable.Field> = emptyList(),
|
||||
override val decorations: List<Decoration> = emptyList(),
|
||||
var text: String? = null,
|
||||
val emoji: String? = null,
|
||||
val image: String? = null,
|
||||
|
@ -1091,7 +1094,8 @@ sealed class BlockView : ViewType {
|
|||
data class Deleted(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false
|
||||
override val isSelected: Boolean = false,
|
||||
override val decorations: List<Decoration> = emptyList()
|
||||
) : LinkToObject() {
|
||||
override fun getViewType() = HOLDER_OBJECT_LINK_DELETED
|
||||
}
|
||||
|
@ -1099,7 +1103,8 @@ sealed class BlockView : ViewType {
|
|||
data class Loading(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false
|
||||
override val isSelected: Boolean = false,
|
||||
override val decorations: List<Decoration> = emptyList()
|
||||
) : LinkToObject() {
|
||||
override fun getViewType() = HOLDER_OBJECT_LINK_LOADING
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection: Set<Id>,
|
||||
count: Int,
|
||||
objectTypes: List<ObjectType>,
|
||||
parentScheme: NestedDecorationData,
|
||||
parentSchema: NestedDecorationData,
|
||||
onRenderFlag: (BlockViewRenderer.RenderFlag) -> Unit,
|
||||
): List<BlockView> {
|
||||
|
||||
|
@ -104,7 +104,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
result.add(
|
||||
paragraph(
|
||||
|
@ -132,7 +132,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
|
||||
result.add(
|
||||
|
@ -178,7 +178,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
result.add(
|
||||
toggle(
|
||||
|
@ -215,7 +215,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
restrictions = restrictions,
|
||||
selection = selection,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme,
|
||||
parentSchema = blockDecorationScheme,
|
||||
objectTypes = objectTypes
|
||||
)
|
||||
)
|
||||
|
@ -225,7 +225,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Header.H1,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
|
@ -257,7 +257,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Header.H2,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
|
@ -298,7 +298,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Header.H3,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
|
@ -339,7 +339,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
val normalized: NestedDecorationData = if (NESTED_DECORATION_ENABLED) {
|
||||
normalizeNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
} else {
|
||||
emptyList()
|
||||
|
@ -387,7 +387,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = if (NESTED_DECORATION_ENABLED)
|
||||
parentSchema = if (NESTED_DECORATION_ENABLED)
|
||||
(normalized + current)
|
||||
else
|
||||
emptyList()
|
||||
|
@ -399,7 +399,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
result.add(
|
||||
bulleted(
|
||||
|
@ -427,7 +427,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme
|
||||
parentScheme = parentSchema
|
||||
)
|
||||
result.add(
|
||||
checkbox(
|
||||
|
@ -480,7 +480,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme: NestedDecorationData = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Callout(
|
||||
start = block.id,
|
||||
|
@ -555,7 +555,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
objectTypes = objectTypes,
|
||||
onRenderFlag = onRenderFlag,
|
||||
parentScheme = blockDecorationScheme
|
||||
parentSchema = blockDecorationScheme
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Card,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
|
@ -590,7 +590,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.None,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
|
@ -621,6 +621,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
isPreviousBlockMedia = isPreviousBlockMedia,
|
||||
objectTypes = objectTypes,
|
||||
parentSchema = parentSchema
|
||||
)
|
||||
result.add(link)
|
||||
isPreviousBlockMedia = link is BlockView.LinkToObject.Default.Card
|
||||
|
@ -629,7 +630,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mCounter = 0
|
||||
val blockDecorationScheme = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentScheme,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Card,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
|
@ -1528,7 +1529,8 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mode: EditorMode,
|
||||
selection: Set<Id>,
|
||||
isPreviousBlockMedia: Boolean,
|
||||
objectTypes: List<ObjectType>
|
||||
objectTypes: List<ObjectType>,
|
||||
parentSchema: NestedDecorationData
|
||||
): BlockView.LinkToObject {
|
||||
if (obj.isEmpty()) {
|
||||
return BlockView.LinkToObject.Loading(
|
||||
|
@ -1543,7 +1545,8 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
block = block,
|
||||
indent = indent,
|
||||
mode = mode,
|
||||
selection = selection
|
||||
selection = selection,
|
||||
parentSchema = parentSchema
|
||||
)
|
||||
} else {
|
||||
if (isArchived == true) {
|
||||
|
@ -1552,7 +1555,8 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
indent = indent,
|
||||
obj = obj,
|
||||
mode = mode,
|
||||
selection = selection
|
||||
selection = selection,
|
||||
parentSchema = parentSchema
|
||||
)
|
||||
} else {
|
||||
link(
|
||||
|
@ -1564,6 +1568,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection = selection,
|
||||
isPreviousBlockMedia = isPreviousBlockMedia,
|
||||
objectTypes = objectTypes,
|
||||
parentSchema = parentSchema
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1578,6 +1583,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
selection: Set<Id>,
|
||||
isPreviousBlockMedia: Boolean,
|
||||
objectTypes: List<ObjectType>,
|
||||
parentSchema: NestedDecorationData
|
||||
): BlockView.LinkToObject.Default {
|
||||
val factory = LinkAppearanceFactory(content, obj.layout)
|
||||
val inEditorAppearance = factory.createInEditorLinkAppearance()
|
||||
|
@ -1651,7 +1657,15 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
coverGradient = coverGradient,
|
||||
backgroundColor = block.backgroundColor,
|
||||
isPreviousBlockMedia = isPreviousBlockMedia,
|
||||
objectTypeName = type
|
||||
objectTypeName = type,
|
||||
decorations = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.Card,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
)
|
||||
).toBlockViewDecoration(block)
|
||||
)
|
||||
} else {
|
||||
BlockView.LinkToObject.Default.Text(
|
||||
|
@ -1664,7 +1678,15 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
block = block,
|
||||
selection = selection
|
||||
),
|
||||
backgroundColor = block.backgroundColor
|
||||
backgroundColor = block.backgroundColor,
|
||||
decorations = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.None,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
)
|
||||
).toBlockViewDecoration(block)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1674,7 +1696,8 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
indent: Int,
|
||||
obj: ObjectWrapper.Basic,
|
||||
mode: EditorMode,
|
||||
selection: Set<Id>
|
||||
selection: Set<Id>,
|
||||
parentSchema: NestedDecorationData
|
||||
): BlockView.LinkToObject.Archived = BlockView.LinkToObject.Archived(
|
||||
id = block.id,
|
||||
isEmpty = true,
|
||||
|
@ -1693,14 +1716,23 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
)
|
||||
),
|
||||
decorations = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.None,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
)
|
||||
).toBlockViewDecoration(block)
|
||||
)
|
||||
|
||||
private fun linkDeleted(
|
||||
block: Block,
|
||||
indent: Int,
|
||||
mode: EditorMode,
|
||||
selection: Set<Id>
|
||||
selection: Set<Id>,
|
||||
parentSchema: NestedDecorationData
|
||||
): BlockView.LinkToObject.Deleted = BlockView.LinkToObject.Deleted(
|
||||
id = block.id,
|
||||
indent = indent,
|
||||
|
@ -1708,7 +1740,15 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
)
|
||||
),
|
||||
decorations = buildNestedDecorationData(
|
||||
block = block,
|
||||
parentScheme = parentSchema,
|
||||
currentDecoration = DecorationData(
|
||||
style = DecorationData.Style.None,
|
||||
background = block.parseThemeBackgroundColor()
|
||||
)
|
||||
).toBlockViewDecoration(block)
|
||||
)
|
||||
|
||||
private fun unsupported(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue