mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-10 01:51:05 +09:00
App | Feature | Block views update (#1876)
* rename page to linkToObject * remove legacy const * object links holders * fixes * fixes * fix * fix * fix * fix * fix tests * ci off
This commit is contained in:
parent
b29c480b92
commit
9db2bd5c16
45 changed files with 468 additions and 555 deletions
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
|
@ -1,7 +1,7 @@
|
|||
on:
|
||||
pull_request:
|
||||
# add "synchronize" in "types", in order to trigger workflow for pull request commit(s) pushes.
|
||||
types: [opened,synchronize]
|
||||
types: [opened]
|
||||
branches: [develop]
|
||||
name: Run debug unit tests
|
||||
jobs:
|
||||
|
|
|
@ -108,8 +108,7 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
is BlockView.Upload.Video -> addButtons(view, ACTIONS.VIDEO_PICTURE)
|
||||
is BlockView.MediaPlaceholder.Video -> addButtons(view, ACTIONS.VIDEO_PICTURE)
|
||||
is BlockView.Error.Video -> addButtons(view, ACTIONS.VIDEO_PICTURE)
|
||||
is BlockView.Page -> addButtons(view, ACTIONS.PAGE)
|
||||
is BlockView.PageArchive -> addButtons(view, ACTIONS.PAGE_ARCHIVE)
|
||||
is BlockView.LinkToObject.Default -> addButtons(view, ACTIONS.PAGE)
|
||||
is BlockView.DividerLine -> addButtons(view, ACTIONS.DIVIDER)
|
||||
is BlockView.DividerDots -> addButtons(view, ACTIONS.DIVIDER)
|
||||
is BlockView.MediaPlaceholder.Bookmark -> addButtons(view, ACTIONS.BOOKMARK)
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.anytypeio.anytype.ui.editor.modals.actions
|
|||
import androidx.core.os.bundleOf
|
||||
import com.anytypeio.anytype.presentation.editor.editor.BlockDimensions
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types
|
||||
|
||||
@Deprecated("Legacy")
|
||||
object BlockActionToolbarFactory {
|
||||
|
@ -27,8 +27,7 @@ object BlockActionToolbarFactory {
|
|||
is BlockView.Upload.Video -> newInstance(block, dimensions)
|
||||
is BlockView.MediaPlaceholder.Video -> newInstance(block, dimensions)
|
||||
is BlockView.Error.Video -> newInstance(block, dimensions)
|
||||
is BlockView.Page -> newInstance(block, dimensions)
|
||||
is BlockView.PageArchive -> newInstance(block, dimensions)
|
||||
is BlockView.LinkToObject.Default -> newInstance(block, dimensions)
|
||||
is BlockView.DividerLine -> newInstance(block, dimensions)
|
||||
is BlockView.DividerDots -> newInstance(block, dimensions)
|
||||
is BlockView.MediaPlaceholder.Bookmark -> newInstance(block, dimensions)
|
||||
|
@ -49,6 +48,8 @@ object BlockActionToolbarFactory {
|
|||
is BlockView.Unsupported -> TODO()
|
||||
is BlockView.TitleNote -> TODO()
|
||||
is BlockView.Latex -> TODO()
|
||||
is BlockView.LinkToObject.Archived -> TODO()
|
||||
is BlockView.LinkToObject.Deleted -> TODO()
|
||||
}
|
||||
|
||||
fun newInstance(
|
||||
|
@ -99,7 +100,7 @@ object BlockActionToolbarFactory {
|
|||
)
|
||||
}
|
||||
|
||||
fun newInstance(block: BlockView.Page, dimensions: BlockDimensions): PageBlockActionToolbar =
|
||||
fun newInstance(block: BlockView.LinkToObject.Default, dimensions: BlockDimensions): PageBlockActionToolbar =
|
||||
PageBlockActionToolbar().apply {
|
||||
arguments = bundleOf(
|
||||
BlockActionToolbar.ARG_BLOCK to block,
|
||||
|
@ -107,17 +108,6 @@ object BlockActionToolbarFactory {
|
|||
)
|
||||
}
|
||||
|
||||
fun newInstance(
|
||||
block: BlockView.PageArchive,
|
||||
dimensions: BlockDimensions
|
||||
): PageArchiveBlockActionToolbar =
|
||||
PageArchiveBlockActionToolbar().apply {
|
||||
arguments = bundleOf(
|
||||
BlockActionToolbar.ARG_BLOCK to block,
|
||||
BlockActionToolbar.ARG_BLOCK_DIMENSIONS to dimensions
|
||||
)
|
||||
}
|
||||
|
||||
fun newInstance(
|
||||
block: BlockView.Text.Paragraph,
|
||||
dimensions: BlockDimensions
|
||||
|
|
|
@ -7,8 +7,11 @@ import android.widget.ImageView
|
|||
import android.widget.TextView
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_ERROR
|
||||
|
||||
class ErrorActionToolbar : BlockActionToolbar() {
|
||||
|
||||
|
@ -20,7 +23,7 @@ class ErrorActionToolbar : BlockActionToolbar() {
|
|||
}
|
||||
|
||||
override fun initUi(view: View, colorView: ImageView?, backgroundView: ImageView?) {
|
||||
if (block.getViewType() == BlockViewHolder.HOLDER_BOOKMARK_ERROR) {
|
||||
if (block.getViewType() == HOLDER_BOOKMARK_ERROR) {
|
||||
initBookmarkError(view)
|
||||
}
|
||||
setConstraints()
|
||||
|
@ -43,10 +46,10 @@ class ErrorActionToolbar : BlockActionToolbar() {
|
|||
|
||||
override fun blockLayout(): Int =
|
||||
when (block.getViewType()) {
|
||||
BlockViewHolder.HOLDER_FILE_ERROR -> R.layout.item_block_file_error_preview
|
||||
BlockViewHolder.HOLDER_BOOKMARK_ERROR -> R.layout.item_block_bookmark_error
|
||||
BlockViewHolder.HOLDER_VIDEO_ERROR -> R.layout.item_block_video_error_preview
|
||||
BlockViewHolder.HOLDER_PICTURE_ERROR -> R.layout.item_block_picture_error_preview
|
||||
HOLDER_FILE_ERROR -> R.layout.item_block_file_error_preview
|
||||
HOLDER_BOOKMARK_ERROR -> R.layout.item_block_bookmark_error
|
||||
HOLDER_VIDEO_ERROR -> R.layout.item_block_video_error_preview
|
||||
HOLDER_PICTURE_ERROR -> R.layout.item_block_picture_error_preview
|
||||
else -> R.layout.item_block_file_error_preview
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package com.anytypeio.anytype.ui.editor.modals.actions
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.common.Span
|
||||
import com.anytypeio.anytype.core_ui.extensions.color
|
||||
import com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget
|
||||
import com.anytypeio.anytype.core_utils.ext.VALUE_ROUNDED
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.emojifier.Emojifier
|
||||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
|
||||
class PageArchiveBlockActionToolbar : BlockActionToolbar() {
|
||||
|
||||
lateinit var block: BlockView.PageArchive
|
||||
lateinit var icon: ImageView
|
||||
lateinit var emoji: ImageView
|
||||
lateinit var image: ImageView
|
||||
lateinit var title: TextInputWidget
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
block = arguments?.getParcelable(ARG_BLOCK)!!
|
||||
}
|
||||
|
||||
override fun blockLayout() = R.layout.item_block_page_preview
|
||||
override fun getBlock(): BlockView = block
|
||||
|
||||
override fun initUi(view: View, colorView: ImageView?, backgroundView: ImageView?) {
|
||||
|
||||
image = view.findViewById(R.id.linkImage)
|
||||
icon = view.findViewById(R.id.pageIcon)
|
||||
emoji = view.findViewById(R.id.linkEmoji)
|
||||
title = view.findViewById(R.id.pageTitle)
|
||||
|
||||
title.enableReadMode()
|
||||
|
||||
val untitled = getString(R.string.untitled)
|
||||
val archived = getString(R.string.archived)
|
||||
|
||||
val text = if (block.text.isNullOrEmpty()) {
|
||||
SpannableStringBuilder("$untitled $archived").apply {
|
||||
setSpan(
|
||||
Span.Keyboard(VALUE_ROUNDED),
|
||||
untitled.length + 1,
|
||||
untitled.length + 1 + archived.length,
|
||||
Markup.DEFAULT_SPANNABLE_FLAG
|
||||
)
|
||||
}
|
||||
} else {
|
||||
SpannableStringBuilder("${block.text} $archived").apply {
|
||||
setSpan(
|
||||
Span.Keyboard(VALUE_ROUNDED),
|
||||
block.text!!.length + 1,
|
||||
block.text!!.length + 1 + archived.length,
|
||||
Markup.DEFAULT_SPANNABLE_FLAG
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
title.setTextColor(requireContext().color(R.color.page_archive_text_color))
|
||||
title.setText(text, TextView.BufferType.SPANNABLE)
|
||||
|
||||
when {
|
||||
block.emoji != null -> {
|
||||
image.setImageDrawable(null)
|
||||
try {
|
||||
Glide
|
||||
.with(emoji)
|
||||
.load(Emojifier.uri(block.emoji!!))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(emoji)
|
||||
} catch (e: Exception) {
|
||||
icon.setImageResource(com.anytypeio.anytype.core_ui.R.drawable.ic_block_page_without_emoji)
|
||||
}
|
||||
}
|
||||
block.image != null -> {
|
||||
image.visible()
|
||||
Glide
|
||||
.with(image)
|
||||
.load(block.image)
|
||||
.centerInside()
|
||||
.circleCrop()
|
||||
.into(image)
|
||||
}
|
||||
block.isEmpty -> {
|
||||
icon.setImageResource(com.anytypeio.anytype.core_ui.R.drawable.ic_block_empty_page)
|
||||
image.setImageDrawable(null)
|
||||
}
|
||||
else -> {
|
||||
icon.setImageResource(com.anytypeio.anytype.core_ui.R.drawable.ic_block_page_without_emoji)
|
||||
image.setImageDrawable(null)
|
||||
}
|
||||
}
|
||||
|
||||
setConstraints()
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import timber.log.Timber
|
|||
|
||||
class PageBlockActionToolbar : BlockActionToolbar() {
|
||||
|
||||
lateinit var block: BlockView.Page
|
||||
lateinit var block: BlockView.LinkToObject.Default
|
||||
lateinit var emoji: ImageView
|
||||
lateinit var image: ImageView
|
||||
lateinit var title: TextView
|
||||
|
|
|
@ -7,11 +7,11 @@ import android.widget.FrameLayout.LayoutParams
|
|||
import android.widget.ImageView
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_BOOKMARK_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_FILE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PICTURE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_VIDEO_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_PLACEHOLDER
|
||||
|
||||
class PlaceholderActionToolbar : BlockActionToolbar() {
|
||||
|
||||
|
|
|
@ -4,8 +4,10 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_UPLOAD
|
||||
|
||||
class UploadActionToolbar : BlockActionToolbar() {
|
||||
|
||||
|
@ -18,9 +20,9 @@ class UploadActionToolbar : BlockActionToolbar() {
|
|||
|
||||
override fun blockLayout() =
|
||||
when (block.getViewType()) {
|
||||
BlockViewHolder.HOLDER_PICTURE_UPLOAD -> R.layout.item_block_picture_uploading_preview
|
||||
BlockViewHolder.HOLDER_VIDEO_UPLOAD -> R.layout.item_block_video_uploading_preview
|
||||
BlockViewHolder.HOLDER_FILE_UPLOAD -> R.layout.item_block_file_uploading_preview
|
||||
HOLDER_PICTURE_UPLOAD -> R.layout.item_block_picture_uploading_preview
|
||||
HOLDER_VIDEO_UPLOAD -> R.layout.item_block_video_uploading_preview
|
||||
HOLDER_FILE_UPLOAD -> R.layout.item_block_file_uploading_preview
|
||||
else -> R.layout.item_block_picture_uploading_preview
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import android.view.View
|
|||
import android.widget.ImageView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer
|
||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
||||
import com.google.android.exoplayer2.ui.PlayerView
|
||||
|
@ -29,7 +29,7 @@ class VideoBlockActionToolbar : BlockActionToolbar() {
|
|||
|
||||
override fun blockLayout() =
|
||||
when (block.getViewType()) {
|
||||
BlockViewHolder.HOLDER_VIDEO -> R.layout.item_block_video_playback_off
|
||||
HOLDER_VIDEO -> R.layout.item_block_video_playback_off
|
||||
else -> R.layout.item_block_video_uploading_preview
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class VideoBlockActionToolbar : BlockActionToolbar() {
|
|||
|
||||
override fun initUi(view: View, colorView: ImageView?, backgroundView: ImageView?) {
|
||||
when (block.getViewType()) {
|
||||
BlockViewHolder.HOLDER_VIDEO -> initVideo(view)
|
||||
HOLDER_VIDEO -> initVideo(view)
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.core_ui.R
|
||||
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.BlockViewHolder.Companion.HOLDER_ARCHIVE_TITLE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PAGE_ARCHIVE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.other.PageArchive
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.other.LinkToObjectArchive
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.other.Title
|
||||
import com.anytypeio.anytype.core_utils.ext.typeOf
|
||||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_ARCHIVE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_LINK_ARCHIVE
|
||||
import timber.log.Timber
|
||||
|
||||
class ArchiveAdapter(
|
||||
|
@ -42,10 +42,10 @@ class ArchiveAdapter(
|
|||
)
|
||||
)
|
||||
}
|
||||
HOLDER_PAGE_ARCHIVE -> {
|
||||
PageArchive(
|
||||
HOLDER_OBJECT_LINK_ARCHIVE -> {
|
||||
LinkToObjectArchive(
|
||||
view = inflater.inflate(
|
||||
R.layout.item_block_page_archived,
|
||||
R.layout.item_block_object_link_archive,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
|
@ -59,9 +59,9 @@ class ArchiveAdapter(
|
|||
|
||||
override fun onBindViewHolder(holder: BlockViewHolder, position: Int) {
|
||||
when (holder) {
|
||||
is PageArchive -> {
|
||||
is LinkToObjectArchive -> {
|
||||
holder.bind(
|
||||
item = blocks[position] as BlockView.PageArchive,
|
||||
item = blocks[position] as BlockView.LinkToObject.Archived,
|
||||
clicked = onClickListener
|
||||
)
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class ArchiveAdapter(
|
|||
onBindViewHolder(holder, position)
|
||||
} else {
|
||||
when (holder) {
|
||||
is PageArchive -> {
|
||||
is LinkToObjectArchive -> {
|
||||
holder.processChangePayload(
|
||||
payloads = payloads.typeOf(),
|
||||
item = blocks[position]
|
||||
|
|
|
@ -5,8 +5,8 @@ import android.os.Build.VERSION_CODES.N
|
|||
import android.os.Build.VERSION_CODES.N_MR1
|
||||
import android.text.Editable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
|
@ -14,37 +14,6 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_ui.BuildConfig
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_BOOKMARK
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_BOOKMARK_ERROR
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_BOOKMARK_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_CODE_SNIPPET
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_DIVIDER_DOTS
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_DIVIDER_LINE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_FILE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_FILE_ERROR
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_FILE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_FILE_UPLOAD
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_HIGHLIGHT
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PAGE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PAGE_ARCHIVE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PICTURE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PICTURE_ERROR
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PICTURE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PICTURE_UPLOAD
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_PROFILE_TITLE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_TITLE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_TOGGLE
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_VIDEO
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_VIDEO_ERROR
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_VIDEO_PLACEHOLDER
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder.Companion.HOLDER_VIDEO_UPLOAD
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.`interface`.TextHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.error.BookmarkError
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.error.FileError
|
||||
|
@ -75,19 +44,50 @@ import com.anytypeio.anytype.presentation.editor.editor.KeyPressedEvent
|
|||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.mention.MentionEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_DESCRIPTION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_FEATURED_RELATION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_NOTE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_LATEX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_DEFAULT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_OBJECT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_STATUS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_TAGS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_TODO_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_UNSUPPORTED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CODE_SNIPPET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_DESCRIPTION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_DIVIDER_DOTS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_DIVIDER_LINE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FEATURED_RELATION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HIGHLIGHT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_LATEX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NOTE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_LINK_ARCHIVE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_LINK_DEFAULT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PROFILE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_DEFAULT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_OBJECT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_STATUS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_TAGS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TODO_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TOGGLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_UNSUPPORTED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import kotlinx.android.synthetic.main.item_block_description.view.*
|
||||
|
@ -477,19 +477,19 @@ class BlockAdapter(
|
|||
)
|
||||
)
|
||||
}
|
||||
HOLDER_PAGE -> {
|
||||
Page(
|
||||
HOLDER_OBJECT_LINK_DEFAULT -> {
|
||||
LinkToObject(
|
||||
view = inflater.inflate(
|
||||
R.layout.item_block_page,
|
||||
R.layout.item_block_object_link,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
HOLDER_PAGE_ARCHIVE -> {
|
||||
PageArchive(
|
||||
HOLDER_OBJECT_LINK_ARCHIVE -> {
|
||||
LinkToObjectArchive(
|
||||
view = inflater.inflate(
|
||||
R.layout.item_block_page_archived,
|
||||
R.layout.item_block_object_link_archive,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
|
@ -981,13 +981,13 @@ class BlockAdapter(
|
|||
item = blocks[position]
|
||||
)
|
||||
}
|
||||
is Page -> {
|
||||
is LinkToObject -> {
|
||||
holder.processChangePayload(
|
||||
payloads = payloads.typeOf(),
|
||||
item = blocks[position]
|
||||
)
|
||||
}
|
||||
is PageArchive -> {
|
||||
is LinkToObjectArchive -> {
|
||||
holder.processChangePayload(
|
||||
payloads = payloads.typeOf(),
|
||||
item = blocks[position]
|
||||
|
@ -1311,15 +1311,15 @@ class BlockAdapter(
|
|||
clicked = onClickListener
|
||||
)
|
||||
}
|
||||
is Page -> {
|
||||
is LinkToObject -> {
|
||||
holder.bind(
|
||||
item = blocks[position] as BlockView.Page,
|
||||
item = blocks[position] as BlockView.LinkToObject.Default,
|
||||
clicked = onClickListener
|
||||
)
|
||||
}
|
||||
is PageArchive -> {
|
||||
is LinkToObjectArchive -> {
|
||||
holder.bind(
|
||||
item = blocks[position] as BlockView.PageArchive,
|
||||
item = blocks[position] as BlockView.LinkToObject.Archived,
|
||||
clicked = onClickListener
|
||||
)
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class BlockViewDiffUtil(
|
|||
changes.add(LOADING_STATE_CHANGED)
|
||||
}
|
||||
|
||||
if (newBlock is BlockView.Page && oldBlock is BlockView.Page) {
|
||||
if (newBlock is BlockView.LinkToObject.Default && oldBlock is BlockView.LinkToObject.Default) {
|
||||
if (newBlock.text != oldBlock.text)
|
||||
changes.add(OBJECT_TITLE_CHANGED)
|
||||
if (newBlock.emoji != oldBlock.emoji || newBlock.image != oldBlock.image)
|
||||
|
|
|
@ -49,48 +49,4 @@ open class BlockViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
|||
)
|
||||
clicked(ListenerType.LongClick(target, dimensions))
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val HOLDER_PARAGRAPH = 0
|
||||
const val HOLDER_TITLE = 1
|
||||
const val HOLDER_PROFILE_TITLE = 35
|
||||
const val HOLDER_ARCHIVE_TITLE = 36
|
||||
const val HOLDER_HEADER_ONE = 2
|
||||
const val HOLDER_HEADER_TWO = 3
|
||||
const val HOLDER_HEADER_THREE = 4
|
||||
const val HOLDER_CODE_SNIPPET = 5
|
||||
const val HOLDER_CHECKBOX = 6
|
||||
const val HOLDER_BULLET = 8
|
||||
const val HOLDER_NUMBERED = 9
|
||||
const val HOLDER_TOGGLE = 10
|
||||
const val HOLDER_PAGE = 13
|
||||
const val HOLDER_PAGE_ARCHIVE = 37
|
||||
|
||||
const val HOLDER_HIGHLIGHT = 17
|
||||
|
||||
const val HOLDER_VIDEO = 19
|
||||
const val HOLDER_VIDEO_PLACEHOLDER = 20
|
||||
const val HOLDER_VIDEO_UPLOAD = 21
|
||||
const val HOLDER_VIDEO_ERROR = 22
|
||||
|
||||
const val HOLDER_PICTURE = 24
|
||||
const val HOLDER_PICTURE_PLACEHOLDER = 25
|
||||
const val HOLDER_PICTURE_UPLOAD = 26
|
||||
const val HOLDER_PICTURE_ERROR = 27
|
||||
|
||||
const val HOLDER_BOOKMARK = 28
|
||||
const val HOLDER_BOOKMARK_PLACEHOLDER = 29
|
||||
const val HOLDER_BOOKMARK_ERROR = 30
|
||||
|
||||
const val HOLDER_FILE = 31
|
||||
const val HOLDER_FILE_PLACEHOLDER = 32
|
||||
const val HOLDER_FILE_UPLOAD = 33
|
||||
const val HOLDER_FILE_ERROR = 34
|
||||
|
||||
const val HOLDER_DIVIDER_LINE = 16
|
||||
const val HOLDER_DIVIDER_DOTS = 38
|
||||
|
||||
const val FOCUS_TIMEOUT_MILLIS = 16L
|
||||
const val KEYBOARD_SHOW_DELAY = 16L
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
|||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView.Searchable.Field.Companion.DEFAULT_SEARCH_FIELD_KEY
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import kotlinx.android.synthetic.main.item_block_page.view.*
|
||||
import kotlinx.android.synthetic.main.item_block_object_link.view.*
|
||||
import timber.log.Timber
|
||||
|
||||
class Page(view: View) :
|
||||
class LinkToObject(view: View) :
|
||||
BlockViewHolder(view),
|
||||
BlockViewHolder.IndentableHolder,
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
|
@ -46,7 +46,7 @@ class Page(view: View) :
|
|||
}
|
||||
|
||||
fun bind(
|
||||
item: BlockView.Page,
|
||||
item: BlockView.LinkToObject.Default,
|
||||
clicked: (ListenerType) -> Unit
|
||||
) {
|
||||
indentize(item)
|
||||
|
@ -64,13 +64,13 @@ class Page(view: View) :
|
|||
bindLoading(item.isLoading)
|
||||
}
|
||||
|
||||
private fun applyText(item: BlockView.Page) {
|
||||
private fun applyText(item: BlockView.LinkToObject.Default) {
|
||||
//title.enableReadMode()
|
||||
val text = if (item.text.isNullOrEmpty()) untitled else item.text
|
||||
title.setText(text, TextView.BufferType.EDITABLE)
|
||||
}
|
||||
|
||||
private fun applyImageOrEmoji(item: BlockView.Page) {
|
||||
private fun applyImageOrEmoji(item: BlockView.LinkToObject.Default) {
|
||||
when {
|
||||
item.emoji != null -> {
|
||||
icon.setImageDrawable(null)
|
||||
|
@ -159,7 +159,7 @@ class Page(view: View) :
|
|||
}
|
||||
|
||||
fun processChangePayload(payloads: List<BlockViewDiffUtil.Payload>, item: BlockView) {
|
||||
check(item is BlockView.Page) { "Expected a page block, but was: $item" }
|
||||
check(item is BlockView.LinkToObject.Default) { "Expected a link to object block, but was: $item" }
|
||||
payloads.forEach { payload ->
|
||||
if (payload.changes.contains(BlockViewDiffUtil.SELECTION_CHANGED)) {
|
||||
itemView.isSelected = item.isSelected
|
|
@ -21,9 +21,9 @@ import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
|||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView.Searchable.Field.Companion.DEFAULT_SEARCH_FIELD_KEY
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import kotlinx.android.synthetic.main.item_block_page_archived.view.*
|
||||
import kotlinx.android.synthetic.main.item_block_object_link_archive.view.*
|
||||
|
||||
class PageArchive(view: View) : BlockViewHolder(view),
|
||||
class LinkToObjectArchive(view: View) : BlockViewHolder(view),
|
||||
BlockViewHolder.IndentableHolder,
|
||||
BlockViewHolder.DragAndDropHolder,
|
||||
SupportCustomTouchProcessor,
|
||||
|
@ -46,7 +46,7 @@ class PageArchive(view: View) : BlockViewHolder(view),
|
|||
}
|
||||
|
||||
fun bind(
|
||||
item: BlockView.PageArchive,
|
||||
item: BlockView.LinkToObject.Archived,
|
||||
clicked: (ListenerType) -> Unit
|
||||
) {
|
||||
indentize(item)
|
||||
|
@ -158,7 +158,7 @@ class PageArchive(view: View) : BlockViewHolder(view),
|
|||
}
|
||||
|
||||
fun processChangePayload(payloads: List<BlockViewDiffUtil.Payload>, item: BlockView) {
|
||||
check(item is BlockView.PageArchive) { "Expected a page archive block, but was: $item" }
|
||||
check(item is BlockView.LinkToObject.Archived) { "Expected a object link archive block, but was: $item" }
|
||||
payloads.forEach { payload ->
|
||||
if (payload.changes.contains(BlockViewDiffUtil.SELECTION_CHANGED)) {
|
||||
itemView.isSelected = item.isSelected
|
|
@ -5,7 +5,10 @@ import android.text.Spannable
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.*
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.postDelayed
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
|
@ -164,7 +167,7 @@ sealed class Title(view: View) : BlockViewHolder(view), TextHolder {
|
|||
}
|
||||
|
||||
private fun showKeyboard() {
|
||||
content.postDelayed(KEYBOARD_SHOW_DELAY) {
|
||||
content.postDelayed(16L) {
|
||||
imm().showSoftInput(content, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil.Companion
|
|||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil.Companion.SELECTION_CHANGED
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil.Companion.TEXT_CHANGED
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewDiffUtil.Companion.TEXT_COLOR_CHANGED
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.EditorDragAndDropListener
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.error.FileError
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.error.PictureError
|
||||
|
@ -27,7 +26,7 @@ import com.anytypeio.anytype.core_ui.features.editor.holders.error.VideoError
|
|||
import com.anytypeio.anytype.core_ui.features.editor.holders.media.File
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.media.Picture
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.media.Video
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.other.Page
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.other.LinkToObject
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.other.Title.Document
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.placeholders.BookmarkPlaceholder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.placeholders.FilePlaceholder
|
||||
|
@ -42,9 +41,12 @@ import com.anytypeio.anytype.core_utils.ext.dimen
|
|||
import com.anytypeio.anytype.core_utils.ext.hexColorCode
|
||||
import com.anytypeio.anytype.presentation.editor.editor.ThemeColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TITLE
|
||||
import kotlinx.android.synthetic.main.item_block_bookmark_placeholder.view.*
|
||||
import kotlinx.android.synthetic.main.item_block_checkbox.view.*
|
||||
import kotlinx.android.synthetic.main.item_block_page.view.*
|
||||
import kotlinx.android.synthetic.main.item_block_object_link.view.*
|
||||
import kotlinx.android.synthetic.main.item_block_toggle.view.*
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -53,7 +55,10 @@ import org.robolectric.RobolectricTestRunner
|
|||
import org.robolectric.annotation.Config
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.test.*
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@Config(sdk = [Build.VERSION_CODES.P])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
|
@ -94,7 +99,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
assertEquals(
|
||||
expected = Paragraph::class,
|
||||
|
@ -120,7 +125,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -155,7 +160,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -193,7 +198,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -248,7 +253,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -304,7 +309,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -360,7 +365,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -433,7 +438,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -491,7 +496,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -534,7 +539,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -579,7 +584,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
assertEquals(
|
||||
expected = Document::class,
|
||||
|
@ -606,7 +611,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -645,7 +650,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -699,7 +704,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -748,7 +753,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -757,7 +762,7 @@ class BlockAdapterTest {
|
|||
check(holder is Document)
|
||||
|
||||
Robolectric.getForegroundThreadScheduler().apply {
|
||||
advanceBy(BlockViewHolder.FOCUS_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
|
||||
advanceBy(16L, TimeUnit.MILLISECONDS)
|
||||
}
|
||||
|
||||
assertEquals(
|
||||
|
@ -783,7 +788,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -816,7 +821,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_ONE)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -849,7 +854,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_TWO)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -882,7 +887,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_THREE)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -915,7 +920,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_CHECKBOX)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -950,7 +955,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_TOGGLE)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -980,7 +985,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_FILE_PLACEHOLDER)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_FILE_PLACEHOLDER)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1010,7 +1015,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_FILE_ERROR)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_FILE_ERROR)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1040,7 +1045,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_FILE_UPLOAD)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_FILE_UPLOAD)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1075,7 +1080,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_VIDEO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_VIDEO)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1105,7 +1110,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_VIDEO_PLACEHOLDER)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_VIDEO_PLACEHOLDER)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1135,7 +1140,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_VIDEO_UPLOAD)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_VIDEO_UPLOAD)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1165,7 +1170,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_VIDEO_ERROR)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_VIDEO_ERROR)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1182,7 +1187,7 @@ class BlockAdapterTest {
|
|||
@Test
|
||||
fun `should apply indent to page view`() {
|
||||
|
||||
val view = BlockView.Page(
|
||||
val view = BlockView.LinkToObject.Default(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
emoji = null,
|
||||
|
@ -1198,11 +1203,11 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PAGE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_OBJECT_LINK_DEFAULT)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
check(holder is Page)
|
||||
check(holder is LinkToObject)
|
||||
|
||||
val actual =
|
||||
(holder.itemView.pageGuideline.layoutParams as ConstraintLayout.LayoutParams).guideBegin
|
||||
|
@ -1234,11 +1239,11 @@ class BlockAdapterTest {
|
|||
//
|
||||
// val adapter = buildAdapter(views)
|
||||
//
|
||||
// val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BOOKMARK)
|
||||
// val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_BOOKMARK)
|
||||
//
|
||||
// adapter.bindViewHolder(holder, 0)
|
||||
//
|
||||
// check(holder is BlockViewHolder.Bookmark)
|
||||
// check(holder is Types.Bookmark)
|
||||
//
|
||||
// val actual = (holder.itemView.bookmarkRoot).marginLeft
|
||||
//
|
||||
|
@ -1264,7 +1269,7 @@ class BlockAdapterTest {
|
|||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BOOKMARK_PLACEHOLDER)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_BOOKMARK_PLACEHOLDER)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1298,7 +1303,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PICTURE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_PICTURE)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1329,7 +1334,7 @@ class BlockAdapterTest {
|
|||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PICTURE_PLACEHOLDER)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_PICTURE_PLACEHOLDER)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1359,7 +1364,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PICTURE_ERROR)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_PICTURE_ERROR)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1389,7 +1394,7 @@ class BlockAdapterTest {
|
|||
|
||||
val adapter = buildAdapter(views)
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PICTURE_UPLOAD)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_PICTURE_UPLOAD)
|
||||
|
||||
adapter.bindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1426,7 +1431,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1477,7 +1482,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1529,7 +1534,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1578,7 +1583,7 @@ class BlockAdapterTest {
|
|||
// this.adapter = adapter
|
||||
// }
|
||||
//
|
||||
// val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
// val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
//
|
||||
// adapter.onBindViewHolder(holder, 0)
|
||||
//
|
||||
|
@ -1612,7 +1617,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -1658,8 +1663,8 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val firstHolder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val secondHolder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val firstHolder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
val secondHolder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -1692,7 +1697,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -1736,7 +1741,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1801,7 +1806,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -1842,7 +1847,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -1885,7 +1890,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TITLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TITLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -1957,9 +1962,9 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val h1Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val h2Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val h3Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val h1Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_ONE)
|
||||
val h2Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_TWO)
|
||||
val h3Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_THREE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2071,17 +2076,17 @@ class BlockAdapterTest {
|
|||
}
|
||||
|
||||
val h1SelectedHolder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_ONE)
|
||||
val h1NotSelectedHolder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_ONE)
|
||||
val h2SelectedHolder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_TWO)
|
||||
val h2NotSelectedHolder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_TWO)
|
||||
val h3SelectedHolder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_THREE)
|
||||
val h3NotSelectedHolder =
|
||||
adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_THREE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2141,9 +2146,9 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val h1Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val h2Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val h3Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val h1Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_ONE)
|
||||
val h2Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_TWO)
|
||||
val h3Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_THREE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2232,9 +2237,9 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val h1Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val h2Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val h3Holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val h1Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_ONE)
|
||||
val h2Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_TWO)
|
||||
val h3Holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HEADER_THREE)
|
||||
|
||||
adapter.onBindViewHolder(h1Holder, 0)
|
||||
adapter.onBindViewHolder(h2Holder, 1)
|
||||
|
@ -2377,7 +2382,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HIGHLIGHT)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2421,7 +2426,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HIGHLIGHT)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -2475,7 +2480,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HIGHLIGHT)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2519,7 +2524,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_HIGHLIGHT)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -2582,7 +2587,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_BULLET)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2621,7 +2626,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_BULLET)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2664,7 +2669,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_BULLET)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -2727,7 +2732,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_CHECKBOX)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2766,7 +2771,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_CHECKBOX)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2809,7 +2814,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -2873,7 +2878,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_NUMBERED)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2913,7 +2918,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_NUMBERED)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -2957,7 +2962,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_NUMBERED)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -3022,7 +3027,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_TOGGLE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -3065,7 +3070,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_TOGGLE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -3110,7 +3115,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_TOGGLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -3187,8 +3192,8 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val firstHolder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_FILE)
|
||||
val secondHolder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_FILE)
|
||||
val firstHolder = adapter.onCreateViewHolder(recycler, Types.HOLDER_FILE)
|
||||
val secondHolder = adapter.onCreateViewHolder(recycler, Types.HOLDER_FILE)
|
||||
adapter.onBindViewHolder(firstHolder, 0)
|
||||
adapter.onBindViewHolder(secondHolder, 1)
|
||||
|
||||
|
@ -3227,7 +3232,7 @@ class BlockAdapterTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_FILE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_FILE)
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
check(holder is File)
|
||||
|
@ -3253,7 +3258,7 @@ class BlockAdapterTest {
|
|||
|
||||
// Setup
|
||||
|
||||
val file = BlockView.Page(
|
||||
val file = BlockView.LinkToObject.Default(
|
||||
id = MockDataFactory.randomString(),
|
||||
indent = MockDataFactory.randomInt(),
|
||||
isSelected = false,
|
||||
|
@ -3272,11 +3277,11 @@ class BlockAdapterTest {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PAGE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, Types.HOLDER_OBJECT_LINK_DEFAULT)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
check(holder is Page)
|
||||
check(holder is LinkToObject)
|
||||
|
||||
// Testing
|
||||
|
||||
|
|
|
@ -641,7 +641,7 @@ class BlockViewDiffUtilTest {
|
|||
|
||||
val id = MockDataFactory.randomUuid()
|
||||
|
||||
val oldBlock = BlockView.Page(
|
||||
val oldBlock = BlockView.LinkToObject.Default(
|
||||
id = id,
|
||||
indent = MockDataFactory.randomInt(),
|
||||
emoji = null,
|
||||
|
@ -861,7 +861,7 @@ class BlockViewDiffUtilTest {
|
|||
|
||||
val id = MockDataFactory.randomUuid()
|
||||
|
||||
val oldBlock = BlockView.Page(
|
||||
val oldBlock = BlockView.LinkToObject.Default(
|
||||
id = id,
|
||||
isLoading = true,
|
||||
)
|
||||
|
|
|
@ -137,7 +137,7 @@ class BlockViewSearchTextTest {
|
|||
target = IntRange.EMPTY
|
||||
)
|
||||
|
||||
val page = BlockView.Page(
|
||||
val page = BlockView.LinkToObject.Default(
|
||||
id = MockDataFactory.randomString(),
|
||||
text = MockDataFactory.randomString(),
|
||||
searchFields = listOf(field1),
|
||||
|
@ -170,7 +170,7 @@ class BlockViewSearchTextTest {
|
|||
target = IntRange.EMPTY
|
||||
)
|
||||
|
||||
val page = BlockView.PageArchive(
|
||||
val page = BlockView.LinkToObject.Archived(
|
||||
id = MockDataFactory.randomString(),
|
||||
text = MockDataFactory.randomString(),
|
||||
searchFields = listOf(field1),
|
||||
|
|
|
@ -10,7 +10,6 @@ import androidx.test.core.app.ApplicationProvider
|
|||
import com.anytypeio.anytype.core_ui.common.Span
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockAdapter
|
||||
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.EditorDragAndDropListener
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.HeaderOne
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.HeaderThree
|
||||
|
@ -18,6 +17,9 @@ import com.anytypeio.anytype.core_ui.features.editor.holders.text.HeaderTwo
|
|||
import com.anytypeio.anytype.core_ui.tools.ClipboardInterceptor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -53,7 +55,7 @@ class HeaderBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_ONE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -103,7 +105,7 @@ class HeaderBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_TWO)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -153,7 +155,7 @@ class HeaderBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_THREE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -214,7 +216,7 @@ class HeaderBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_ONE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -272,7 +274,7 @@ class HeaderBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_TWO)
|
||||
|
||||
// Testing
|
||||
|
||||
|
@ -330,7 +332,7 @@ class HeaderBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_THREE)
|
||||
|
||||
// Testing
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.anytypeio.anytype.core_ui.features.editor.holders.text.Highlight
|
|||
import com.anytypeio.anytype.core_ui.tools.ClipboardInterceptor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HIGHLIGHT
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -54,7 +55,7 @@ class HighlightingBlockTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HIGHLIGHT)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import com.anytypeio.anytype.core_ui.features.editor.holders.text.Checkbox
|
|||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.ThemeColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -40,7 +42,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -73,7 +75,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -113,7 +115,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -148,7 +150,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -194,7 +196,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -244,7 +246,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -303,7 +305,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -362,7 +364,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -411,7 +413,7 @@ class BlockAdapterCheckboxTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_BULLET)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -10,6 +10,15 @@ import com.anytypeio.anytype.core_ui.MockDataFactory
|
|||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.*
|
||||
import com.anytypeio.anytype.core_ui.tools.ClipboardInterceptor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HIGHLIGHT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TOGGLE
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -49,7 +58,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -84,7 +93,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_ONE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -119,7 +128,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_TWO)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -154,7 +163,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_THREE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -192,7 +201,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HIGHLIGHT)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -228,7 +237,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -264,7 +273,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_BULLET)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -301,7 +310,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_NUMBERED)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -337,7 +346,7 @@ class BlockAdapterCursorBindingTest {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TOGGLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -9,6 +9,12 @@ import com.anytypeio.anytype.core_ui.R
|
|||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.*
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -43,7 +49,7 @@ class BlockAdapterIndentationTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -96,7 +102,7 @@ class BlockAdapterIndentationTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_ONE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -149,7 +155,7 @@ class BlockAdapterIndentationTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_TWO)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -202,7 +208,7 @@ class BlockAdapterIndentationTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_THREE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -254,7 +260,7 @@ class BlockAdapterIndentationTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -307,7 +313,7 @@ class BlockAdapterIndentationTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_NUMBERED)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.anytypeio.anytype.core_ui.features.editor.holders.text.Paragraph
|
|||
import com.anytypeio.anytype.core_ui.tools.CustomBetterLinkMovementMethod
|
||||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -46,7 +47,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -88,7 +89,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -138,7 +139,8 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler,
|
||||
HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -188,7 +190,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -230,7 +232,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -304,7 +306,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -378,7 +380,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -453,7 +455,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -536,7 +538,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -611,7 +613,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -686,7 +688,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -768,7 +770,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -850,7 +852,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
@ -930,7 +932,7 @@ class BlockAdapterMovementMethodTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.core_ui.MockDataFactory
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Numbered
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -48,8 +49,8 @@ class BlockAdapterNumberedListTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val aHolder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val bHolder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val aHolder = adapter.onCreateViewHolder(recycler, HOLDER_NUMBERED)
|
||||
val bHolder = adapter.onCreateViewHolder(recycler, HOLDER_NUMBERED)
|
||||
|
||||
adapter.onBindViewHolder(aHolder, 0)
|
||||
adapter.onBindViewHolder(bHolder, 1)
|
||||
|
|
|
@ -9,6 +9,8 @@ import com.anytypeio.anytype.core_ui.MockDataFactory
|
|||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Checkbox
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Paragraph
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
@ -52,7 +54,7 @@ class BlockAdapterReadWriteModeTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -116,7 +118,7 @@ class BlockAdapterReadWriteModeTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -185,7 +187,7 @@ class BlockAdapterReadWriteModeTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -256,7 +258,7 @@ class BlockAdapterReadWriteModeTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -325,7 +327,7 @@ class BlockAdapterReadWriteModeTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
check(holder is Checkbox)
|
||||
|
||||
|
|
|
@ -6,6 +6,15 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.core_ui.MockDataFactory
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.*
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HIGHLIGHT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TOGGLE
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -38,7 +47,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -91,7 +100,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_ONE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_ONE)
|
||||
|
||||
check(holder is HeaderOne)
|
||||
|
||||
|
@ -144,7 +153,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_TWO)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_TWO)
|
||||
|
||||
check(holder is HeaderTwo)
|
||||
|
||||
|
@ -197,7 +206,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HEADER_THREE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HEADER_THREE)
|
||||
|
||||
check(holder is HeaderThree)
|
||||
|
||||
|
@ -250,7 +259,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_HIGHLIGHT)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_HIGHLIGHT)
|
||||
|
||||
check(holder is Highlight)
|
||||
|
||||
|
@ -303,7 +312,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_CHECKBOX)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_CHECKBOX)
|
||||
|
||||
check(holder is Checkbox)
|
||||
|
||||
|
@ -356,7 +365,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_BULLET)
|
||||
|
||||
check(holder is Bulleted)
|
||||
|
||||
|
@ -410,7 +419,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_NUMBERED)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_NUMBERED)
|
||||
|
||||
check(holder is Numbered)
|
||||
|
||||
|
@ -463,7 +472,7 @@ class BlockAdapterTextBindingTest : BlockAdapterTestSetup() {
|
|||
this.adapter = adapter
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TOGGLE)
|
||||
|
||||
check(holder is Toggle)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_ui.MockDataFactory
|
|||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Bulleted
|
||||
import com.anytypeio.anytype.presentation.editor.editor.ThemeColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BULLET
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -44,7 +45,7 @@ class BlockAdapterTextColorTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_BULLET)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_BULLET)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.core_ui.MockDataFactory
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.text.Toggle
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TOGGLE
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -43,7 +44,7 @@ class BlockAdapterToggleTest : BlockAdapterTestSetup() {
|
|||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_TOGGLE)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_TOGGLE)
|
||||
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.anytypeio.anytype.core_ui.features.editor.holders.text.Paragraph
|
|||
import com.anytypeio.anytype.core_ui.tools.CustomBetterLinkMovementMethod
|
||||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
@ -33,7 +34,7 @@ class TextBlockSetTextTest : BlockAdapterTestSetup() {
|
|||
val recycler = RecyclerView(context).apply {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -61,7 +62,7 @@ class TextBlockSetTextTest : BlockAdapterTestSetup() {
|
|||
val recycler = RecyclerView(context).apply {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -95,7 +96,7 @@ class TextBlockSetTextTest : BlockAdapterTestSetup() {
|
|||
val recycler = RecyclerView(context).apply {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -130,7 +131,7 @@ class TextBlockSetTextTest : BlockAdapterTestSetup() {
|
|||
val recycler = RecyclerView(context).apply {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
@ -165,7 +166,7 @@ class TextBlockSetTextTest : BlockAdapterTestSetup() {
|
|||
val recycler = RecyclerView(context).apply {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
}
|
||||
val holder = adapter.onCreateViewHolder(recycler, BlockViewHolder.HOLDER_PARAGRAPH)
|
||||
val holder = adapter.onCreateViewHolder(recycler, HOLDER_PARAGRAPH)
|
||||
adapter.onBindViewHolder(holder, 0)
|
||||
check(holder is Paragraph)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
|||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
class PageLinkViewKtTest {
|
||||
class LinkToObjectViewKtTest {
|
||||
|
||||
@Test
|
||||
fun `should contain text`() {
|
|
@ -1,8 +1,11 @@
|
|||
package com.anytypeio.anytype.core_ui.features.page
|
||||
|
||||
import com.anytypeio.anytype.core_ui.MockDataFactory
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockViewHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_UPLOAD
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
|
@ -14,7 +17,7 @@ class BlockViewTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
indent = MockDataFactory.randomInt()
|
||||
)
|
||||
assertEquals(BlockViewHolder.HOLDER_VIDEO_PLACEHOLDER, block.getViewType())
|
||||
assertEquals(HOLDER_VIDEO_PLACEHOLDER, block.getViewType())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -23,7 +26,7 @@ class BlockViewTest {
|
|||
id = MockDataFactory.randomUuid(),
|
||||
indent = MockDataFactory.randomInt()
|
||||
)
|
||||
assertEquals(BlockViewHolder.HOLDER_VIDEO_ERROR, block.getViewType())
|
||||
assertEquals(HOLDER_VIDEO_ERROR, block.getViewType())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -37,7 +40,7 @@ class BlockViewTest {
|
|||
name = MockDataFactory.randomString(),
|
||||
indent = MockDataFactory.randomInt()
|
||||
)
|
||||
assertEquals(BlockViewHolder.HOLDER_VIDEO, block.getViewType())
|
||||
assertEquals(HOLDER_VIDEO, block.getViewType())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -46,6 +49,6 @@ class BlockViewTest {
|
|||
id = MockDataFactory.randomString(),
|
||||
indent = MockDataFactory.randomInt()
|
||||
)
|
||||
assertEquals(BlockViewHolder.HOLDER_VIDEO_UPLOAD, block.getViewType())
|
||||
assertEquals(HOLDER_VIDEO_UPLOAD, block.getViewType())
|
||||
}
|
||||
}
|
|
@ -148,7 +148,7 @@ class ArchiveViewModel(
|
|||
selection = emptySet()
|
||||
)
|
||||
}
|
||||
.map { views -> views.filterNot { it is BlockView.Page } }
|
||||
.map { views -> views.filterNot { it is BlockView.LinkToObject } }
|
||||
.onEach { views ->
|
||||
orchestrator.stores.views.update(views)
|
||||
renderCommand.send(Unit)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.anytypeio.anytype.presentation.editor.editor.ext
|
||||
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.ext.replaceRangeWithWord
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView.Media.Bookmark.Companion.SEARCH_FIELD_DESCRIPTION_KEY
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView.Media.Bookmark.Companion.SEARCH_FIELD_TITLE_KEY
|
||||
|
@ -296,10 +295,13 @@ fun List<BlockView>.enterSAM(
|
|||
is BlockView.Relation.Related -> view.copy(
|
||||
isSelected = isSelected
|
||||
)
|
||||
is BlockView.Page -> view.copy(
|
||||
is BlockView.LinkToObject.Default -> view.copy(
|
||||
isSelected = isSelected
|
||||
)
|
||||
is BlockView.PageArchive -> view.copy(
|
||||
is BlockView.LinkToObject.Archived -> view.copy(
|
||||
isSelected = isSelected
|
||||
)
|
||||
is BlockView.LinkToObject.Deleted -> view.copy(
|
||||
isSelected = isSelected
|
||||
)
|
||||
is BlockView.DividerDots -> view.copy(
|
||||
|
@ -492,8 +494,8 @@ fun List<BlockView>.clearSearchHighlights(): List<BlockView> = map { view ->
|
|||
is BlockView.Title.Todo -> view.copy(searchFields = emptyList())
|
||||
is BlockView.Media.Bookmark -> view.copy(searchFields = emptyList())
|
||||
is BlockView.Media.File -> view.copy(searchFields = emptyList())
|
||||
is BlockView.Page -> view.copy(searchFields = emptyList())
|
||||
is BlockView.PageArchive -> view.copy(searchFields = emptyList())
|
||||
is BlockView.LinkToObject.Default -> view.copy(searchFields = emptyList())
|
||||
is BlockView.LinkToObject.Archived -> view.copy(searchFields = emptyList())
|
||||
else -> view.also { check(view !is BlockView.Searchable) }
|
||||
}
|
||||
}
|
||||
|
@ -562,11 +564,11 @@ fun List<BlockView>.highlight(
|
|||
val fields = listOf(DEFAULT_SEARCH_FIELD_KEY to view.name.orEmpty())
|
||||
view.copy(searchFields = highlighter(fields))
|
||||
}
|
||||
is BlockView.Page -> {
|
||||
is BlockView.LinkToObject.Default -> {
|
||||
val fields = listOf(DEFAULT_SEARCH_FIELD_KEY to view.text.orEmpty())
|
||||
view.copy(searchFields = highlighter(fields))
|
||||
}
|
||||
is BlockView.PageArchive -> {
|
||||
is BlockView.LinkToObject.Archived -> {
|
||||
val fields = listOf(DEFAULT_SEARCH_FIELD_KEY to view.text.orEmpty())
|
||||
view.copy(searchFields = highlighter(fields))
|
||||
}
|
||||
|
@ -591,8 +593,8 @@ fun BlockView.setHighlight(
|
|||
is BlockView.Title.Todo -> copy(searchFields = highlights)
|
||||
is BlockView.Media.Bookmark -> copy(searchFields = highlights)
|
||||
is BlockView.Media.File -> copy(searchFields = highlights)
|
||||
is BlockView.Page -> copy(searchFields = highlights)
|
||||
is BlockView.PageArchive -> copy(searchFields = highlights)
|
||||
is BlockView.LinkToObject.Default -> copy(searchFields = highlights)
|
||||
is BlockView.LinkToObject.Archived -> copy(searchFields = highlights)
|
||||
else -> this.also { check(this !is BlockView.Searchable) }
|
||||
}
|
||||
|
||||
|
@ -823,8 +825,9 @@ fun BlockView.updateSelection(newSelection: Boolean) = when (this) {
|
|||
is BlockView.Upload.Video -> copy(isSelected = newSelection)
|
||||
is BlockView.MediaPlaceholder.Video -> copy(isSelected = newSelection)
|
||||
is BlockView.Error.Video -> copy(isSelected = newSelection)
|
||||
is BlockView.Page -> copy(isSelected = newSelection)
|
||||
is BlockView.PageArchive -> copy(isSelected = newSelection)
|
||||
is BlockView.LinkToObject.Default -> copy(isSelected = newSelection)
|
||||
is BlockView.LinkToObject.Archived -> copy(isSelected = newSelection)
|
||||
is BlockView.LinkToObject.Deleted -> copy(isSelected = newSelection)
|
||||
is BlockView.MediaPlaceholder.Bookmark -> copy(isSelected = newSelection)
|
||||
is BlockView.Media.Bookmark -> copy(isSelected = newSelection)
|
||||
is BlockView.Error.Bookmark -> copy(isSelected = newSelection)
|
||||
|
|
|
@ -5,53 +5,53 @@ import com.anytypeio.anytype.core_models.Url
|
|||
import com.anytypeio.anytype.core_utils.ui.ViewType
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.Markup
|
||||
import com.anytypeio.anytype.presentation.editor.editor.ThemeColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_ARCHIVE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_BOOKMARK
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_BOOKMARK_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_BOOKMARK_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_CODE_SNIPPET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_DESCRIPTION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_DIVIDER_DOTS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_DIVIDER_LINE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_FEATURED_RELATION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_FILE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_FILE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_FILE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_HIGHLIGHT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_NOTE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_LATEX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_OBJECT_TYPE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PAGE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PAGE_ARCHIVE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PICTURE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PICTURE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PICTURE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PICTURE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PROFILE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_DEFAULT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_OBJECT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_STATUS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_RELATION_TAGS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_TODO_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_TOGGLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_UNSUPPORTED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_VIDEO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_VIDEO_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_VIDEO_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_VIDEO_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_ARCHIVE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BOOKMARK_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_BULLET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_CODE_SNIPPET
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_DESCRIPTION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_DIVIDER_DOTS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_DIVIDER_LINE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FEATURED_RELATION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_FILE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_ONE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_THREE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HIGHLIGHT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_LATEX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NOTE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_LINK_ARCHIVE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_LINK_DEFAULT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_LINK_DELETED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_OBJECT_TYPE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PICTURE_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PROFILE_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_CHECKBOX
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_DEFAULT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_FILE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_OBJECT
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_STATUS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_RELATION_TAGS
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TODO_TITLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_TOGGLE
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_UNSUPPORTED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_ERROR
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_PLACEHOLDER
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_VIDEO_UPLOAD
|
||||
import com.anytypeio.anytype.presentation.relations.DocumentRelationView
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.parcel.RawValue
|
||||
|
@ -853,47 +853,65 @@ sealed class BlockView : ViewType, Parcelable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UI-model for blocks containing page links.
|
||||
* @property id block's id
|
||||
* @property text a page's name
|
||||
* @property emoji a page's emoji (if present)
|
||||
* @property isEmpty this property determines whether this page is empty or not
|
||||
*/
|
||||
@Parcelize
|
||||
data class Page(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false,
|
||||
override val searchFields: @RawValue List<Searchable.Field> = emptyList(),
|
||||
override val isLoading: Boolean = false,
|
||||
var text: String? = null,
|
||||
val emoji: String? = null,
|
||||
val image: String? = null,
|
||||
val isEmpty: Boolean = false,
|
||||
) : BlockView(), Indentable, Selectable, Searchable, Loadable {
|
||||
override fun getViewType() = HOLDER_PAGE
|
||||
}
|
||||
sealed class LinkToObject : BlockView(), Indentable, Selectable, Loadable {
|
||||
/**
|
||||
* UI-model for blocks containing links to objects.
|
||||
* @property id block's id
|
||||
* @property text a page's name
|
||||
* @property emoji a page's emoji (if present)
|
||||
* @property isEmpty this property determines whether this page is empty or not
|
||||
* @property isArchived this property determines whether this linked object is archived or not
|
||||
* @property isDeleted this property determines whether this linked object is deleted or not.
|
||||
* Whenever isDeleted is true, we don't care about isArchived flags
|
||||
*/
|
||||
@Parcelize
|
||||
data class Default(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false,
|
||||
override val searchFields: @RawValue List<Searchable.Field> = emptyList(),
|
||||
override val isLoading: Boolean = false,
|
||||
var text: String? = null,
|
||||
val emoji: String? = null,
|
||||
val image: String? = null,
|
||||
val isEmpty: Boolean = false,
|
||||
val isArchived: Boolean? = false,
|
||||
val isDeleted: Boolean? = false
|
||||
) : LinkToObject(), Searchable {
|
||||
override fun getViewType() = HOLDER_OBJECT_LINK_DEFAULT
|
||||
}
|
||||
|
||||
/**
|
||||
* UI-model for blocks containing archived page links.
|
||||
* @property id block's id
|
||||
* @property text a page's name
|
||||
* @property emoji a page's emoji (if present)
|
||||
* @property isEmpty this property determines whether this page is empty or not
|
||||
*/
|
||||
@Parcelize
|
||||
data class PageArchive(
|
||||
override val id: String,
|
||||
override val indent: Int,
|
||||
override val isSelected: Boolean = false,
|
||||
override val searchFields: @RawValue List<Searchable.Field> = emptyList(),
|
||||
var text: String? = null,
|
||||
val emoji: String?,
|
||||
val image: String?,
|
||||
val isEmpty: Boolean = false
|
||||
) : BlockView(), Indentable, Selectable, Searchable {
|
||||
override fun getViewType() = HOLDER_PAGE_ARCHIVE
|
||||
/**
|
||||
* UI-model for blocks containing links to archived objects.
|
||||
* @property id block's id
|
||||
* @property text a page's name
|
||||
* @property emoji a page's emoji (if present)
|
||||
* @property isEmpty this property determines whether this page is empty or not
|
||||
*/
|
||||
@Parcelize
|
||||
data class Archived(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false,
|
||||
override val searchFields: @RawValue List<Searchable.Field> = emptyList(),
|
||||
override val isLoading: Boolean = false,
|
||||
var text: String? = null,
|
||||
val emoji: String? = null,
|
||||
val image: String? = null,
|
||||
val isEmpty: Boolean = false
|
||||
) : LinkToObject(), Searchable {
|
||||
override fun getViewType() = HOLDER_OBJECT_LINK_ARCHIVE
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Deleted(
|
||||
override val id: String,
|
||||
override val indent: Int = 0,
|
||||
override val isSelected: Boolean = false,
|
||||
override val isLoading: Boolean = false
|
||||
) : LinkToObject() {
|
||||
override fun getViewType() = HOLDER_OBJECT_LINK_DELETED
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.anytypeio.anytype.presentation.editor.editor.model
|
||||
package com.anytypeio.anytype.presentation.editor.editor.model.types
|
||||
|
||||
object Types {
|
||||
const val HOLDER_PARAGRAPH = 0
|
||||
|
@ -15,8 +15,10 @@ object Types {
|
|||
const val HOLDER_BULLET = 8
|
||||
const val HOLDER_NUMBERED = 9
|
||||
const val HOLDER_TOGGLE = 10
|
||||
const val HOLDER_PAGE = 13
|
||||
const val HOLDER_PAGE_ARCHIVE = 37
|
||||
|
||||
const val HOLDER_OBJECT_LINK_DEFAULT = 13
|
||||
const val HOLDER_OBJECT_LINK_ARCHIVE = 14
|
||||
const val HOLDER_OBJECT_LINK_DELETED = 15
|
||||
|
||||
const val HOLDER_HIGHLIGHT = 17
|
||||
|
||||
|
@ -56,7 +58,4 @@ object Types {
|
|||
|
||||
const val HOLDER_UNSUPPORTED = 49
|
||||
const val HOLDER_LATEX = 51
|
||||
|
||||
const val FOCUS_TIMEOUT_MILLIS = 16L
|
||||
const val KEYBOARD_SHOW_DELAY = 16L
|
||||
}
|
|
@ -3,7 +3,7 @@ package com.anytypeio.anytype.presentation.editor.editor.slash
|
|||
import com.anytypeio.anytype.core_models.Block
|
||||
import com.anytypeio.anytype.core_models.ObjectType
|
||||
import com.anytypeio.anytype.presentation.editor.editor.ThemeColor
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.UiBlock
|
||||
|
||||
fun List<ObjectType>.toSlashItemView(): List<SlashItem.ObjectType> = map { oType ->
|
||||
|
|
|
@ -415,7 +415,7 @@ class DefaultBlockViewRenderer(
|
|||
is Content.Link -> {
|
||||
counter.reset()
|
||||
result.add(
|
||||
toPages(
|
||||
toLinks(
|
||||
block = block,
|
||||
content = content,
|
||||
indent = indent,
|
||||
|
@ -1127,7 +1127,7 @@ class DefaultBlockViewRenderer(
|
|||
}
|
||||
}
|
||||
|
||||
private fun toPages(
|
||||
private fun toLinks(
|
||||
block: Block,
|
||||
content: Content.Link,
|
||||
indent: Int,
|
||||
|
@ -1137,7 +1137,7 @@ class DefaultBlockViewRenderer(
|
|||
): BlockView {
|
||||
val isArchived = details.details[content.target]?.isArchived
|
||||
return if (isArchived == true) {
|
||||
pageArchive(
|
||||
linkArchive(
|
||||
block = block,
|
||||
content = content,
|
||||
indent = indent,
|
||||
|
@ -1146,7 +1146,7 @@ class DefaultBlockViewRenderer(
|
|||
selection = selection
|
||||
)
|
||||
} else {
|
||||
page(
|
||||
link(
|
||||
block = block,
|
||||
content = content,
|
||||
indent = indent,
|
||||
|
@ -1157,14 +1157,14 @@ class DefaultBlockViewRenderer(
|
|||
}
|
||||
}
|
||||
|
||||
private fun page(
|
||||
private fun link(
|
||||
mode: Editor.Mode,
|
||||
block: Block,
|
||||
content: Content.Link,
|
||||
indent: Int,
|
||||
details: Block.Details,
|
||||
selection: Set<Id>
|
||||
): BlockView.Page = BlockView.Page(
|
||||
): BlockView.LinkToObject = BlockView.LinkToObject.Default(
|
||||
id = block.id,
|
||||
isEmpty = true,
|
||||
emoji = details.details[content.target]?.iconEmoji?.let { name ->
|
||||
|
@ -1189,14 +1189,14 @@ class DefaultBlockViewRenderer(
|
|||
)
|
||||
)
|
||||
|
||||
private fun pageArchive(
|
||||
private fun linkArchive(
|
||||
block: Block,
|
||||
content: Content.Link,
|
||||
indent: Int,
|
||||
details: Block.Details,
|
||||
mode: EditorMode,
|
||||
selection: Set<Id>
|
||||
): BlockView.PageArchive = BlockView.PageArchive(
|
||||
): BlockView.LinkToObject.Archived = BlockView.LinkToObject.Archived(
|
||||
id = block.id,
|
||||
isEmpty = true,
|
||||
emoji = details.details[content.target]?.iconEmoji?.let { name ->
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.anytypeio.anytype.core_models.ObjectType
|
|||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.core_models.SmartBlockType
|
||||
import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView
|
||||
|
|
|
@ -6,9 +6,9 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
|||
import com.anytypeio.anytype.core_models.Block
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_HEADER_TWO
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_NUMBERED
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types.HOLDER_PARAGRAPH
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.anytypeio.anytype.domain.editor.Editor
|
|||
import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory
|
||||
import com.anytypeio.anytype.presentation.editor.EditorViewModel.Companion.TEXT_CHANGES_DEBOUNCE_DURATION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.anytypeio.anytype.core_models.Position
|
|||
import com.anytypeio.anytype.domain.page.CreateObject
|
||||
import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory
|
||||
import com.anytypeio.anytype.presentation.editor.EditorViewModel.Companion.TEXT_CHANGES_DEBOUNCE_DURATION
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.model.types.Types
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
import com.anytypeio.anytype.presentation.util.CoroutinesTestRule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue