mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3133 Date as an Object | Design review (#1913)
This commit is contained in:
parent
d82f3e0d19
commit
95616ba231
32 changed files with 335 additions and 74 deletions
|
@ -21,7 +21,14 @@ import android.widget.PopupMenu
|
|||
import android.widget.TextView
|
||||
import androidx.activity.addCallback
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.ime
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.core.animation.doOnEnd
|
||||
|
@ -747,6 +754,10 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent {
|
||||
SpaceSyncStatusScreen(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.windowInsetsPadding(WindowInsets.ime)
|
||||
.padding(bottom = 6.dp, start = 8.dp, end = 8.dp),
|
||||
uiState = vm.syncStatusWidget.collectAsStateWithLifecycle().value,
|
||||
onDismiss = vm::onSyncWidgetDismiss,
|
||||
scope = lifecycleScope,
|
||||
|
|
|
@ -21,7 +21,14 @@ import android.widget.LinearLayout
|
|||
import android.widget.TextView
|
||||
import androidx.activity.addCallback
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.ime
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.os.bundleOf
|
||||
|
@ -448,6 +455,10 @@ open class ObjectSetFragment :
|
|||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent {
|
||||
SpaceSyncStatusScreen(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.windowInsetsPadding(WindowInsets.ime)
|
||||
.padding(bottom = 6.dp, start = 8.dp, end = 8.dp),
|
||||
uiState = vm.syncStatusWidget.collectAsStateWithLifecycle().value,
|
||||
onDismiss = vm::onSyncWidgetDismiss,
|
||||
scope = lifecycleScope,
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_ui.R
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetStyleBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.ActionMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashActionsAdapter(
|
||||
|
@ -34,12 +35,16 @@ class SlashActionsAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashItem.Actions -> R.layout.item_slash_widget_style
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
else -> throw IllegalArgumentException("Wrong item type:$item")
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_ui.R
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetStyleBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.AlignMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashAlignmentAdapter(
|
||||
|
@ -34,12 +35,16 @@ class SlashAlignmentAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashItem.Alignment -> R.layout.item_slash_widget_style
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
else -> throw IllegalArgumentException("Wrong item type:$item")
|
||||
}
|
||||
}
|
|
@ -6,7 +6,9 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
abstract class SlashBaseAdapter(
|
||||
|
@ -59,6 +61,13 @@ abstract class SlashBaseAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
R.layout.item_slash_widget_subheader_left -> {
|
||||
SubheaderOnlyMenuHolder(
|
||||
binding = ItemSlashWidgetSubheaderLeftBinding.inflate(
|
||||
inflater, parent, false
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> throw IllegalArgumentException("Wrong viewtype:$viewType")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,13 @@ import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetBackgroundBindin
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetBackgroundDefaultBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetColorBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.BackgroundDefaultMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.BackgroundMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.ColorMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.DefaultMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashColorAdapter(
|
||||
|
@ -85,6 +87,13 @@ class SlashColorAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
R.layout.item_slash_widget_subheader_left -> {
|
||||
SubheaderOnlyMenuHolder(
|
||||
binding = ItemSlashWidgetSubheaderLeftBinding.inflate(
|
||||
inflater, parent, false
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> throw IllegalArgumentException("Wrong viewtype:$viewType")
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +108,10 @@ class SlashColorAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +121,7 @@ class SlashColorAdapter(
|
|||
else R.layout.item_slash_widget_background
|
||||
}
|
||||
is SlashItem.Color.Text -> R.layout.item_slash_widget_color
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
else -> throw IllegalArgumentException("Wrong item type:$item")
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_ui.R
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetStyleBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.MediaMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashMediaAdapter(
|
||||
|
@ -34,12 +35,16 @@ class SlashMediaAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashItem.Media -> R.layout.item_slash_widget_style
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
else -> throw IllegalArgumentException("Wrong item type:$item")
|
||||
}
|
||||
}
|
|
@ -6,11 +6,15 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetObjectTypeBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSelectDateBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetStyleBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.ActionMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.DateSelectHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.ObjectTypeMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashObjectTypesAdapter(
|
||||
|
@ -57,6 +61,16 @@ class SlashObjectTypesAdapter(
|
|||
clicks(SlashItem.Back)
|
||||
}
|
||||
}
|
||||
R.layout.item_slash_widget_subheader_left -> SubheaderOnlyMenuHolder(
|
||||
binding = ItemSlashWidgetSubheaderLeftBinding.inflate(
|
||||
inflater, parent, false
|
||||
)
|
||||
)
|
||||
R.layout.item_slash_widget_select_date -> DateSelectHolder(
|
||||
binding = ItemSlashWidgetSelectDateBinding.inflate(
|
||||
inflater, parent, false
|
||||
)
|
||||
)
|
||||
else -> throw IllegalArgumentException("Wrong viewtype:$viewType")
|
||||
}.apply {
|
||||
itemView.setOnClickListener {
|
||||
|
@ -82,15 +96,39 @@ class SlashObjectTypesAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
||||
override fun getItemViewType(position: Int): Int = when (items[position]) {
|
||||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashItem.ObjectType -> R.layout.item_slash_widget_object_type
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
is SlashItem.Actions -> R.layout.item_slash_widget_style
|
||||
is SlashItem.SelectDate -> R.layout.item_slash_widget_select_date
|
||||
else -> throw IllegalArgumentException("Wrong item type:${items[position]} for SlashObjectTypeAdapter")
|
||||
}
|
||||
}
|
||||
|
||||
fun SlashItem.Subheader.getViewType(): Int = when (this) {
|
||||
SlashItem.Subheader.Actions -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.ActionsWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.Alignment -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.AlignmentWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.Background -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.BackgroundWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.Color -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.ColorWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.Media -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.MediaWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.ObjectType -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.ObjectTypeWithBlack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.Other -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.OtherWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashItem.Subheader.Style -> R.layout.item_slash_widget_subheader_left
|
||||
SlashItem.Subheader.StyleWithBack -> R.layout.item_slash_widget_subheader
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_ui.R
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetStyleBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.OtherMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashOtherAdapter(
|
||||
|
@ -34,12 +35,16 @@ class SlashOtherAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashItem.Other -> R.layout.item_slash_widget_style
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
else -> throw IllegalArgumentException("Wrong item type:$item")
|
||||
}
|
||||
}
|
|
@ -16,9 +16,11 @@ import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationObjectB
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationStatusBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemRelationListRelationTagBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.holders.relations.ListRelationViewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.RelationNewHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.RelationsSubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.RelationsSubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.core_utils.diff.DefaultDiffUtil
|
||||
import com.anytypeio.anytype.core_utils.ext.dimen
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
|
@ -144,6 +146,13 @@ class SlashRelationsAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
R.layout.item_slash_widget_subheader_left -> {
|
||||
RelationsSubheaderOnlyMenuHolder(
|
||||
binding = ItemSlashWidgetSubheaderLeftBinding.inflate(
|
||||
inflater, parent, false
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> throw IllegalStateException("Unexpected view type: $viewType")
|
||||
}
|
||||
}
|
||||
|
@ -219,6 +228,9 @@ class SlashRelationsAdapter(
|
|||
check(item is SlashRelationView.Section)
|
||||
holder.bind(item)
|
||||
}
|
||||
is RelationsSubheaderOnlyMenuHolder -> {
|
||||
holder.bind()
|
||||
}
|
||||
else -> {
|
||||
Timber.d("Skipping binding for: $holder")
|
||||
}
|
||||
|
@ -240,7 +252,7 @@ class SlashRelationsAdapter(
|
|||
}
|
||||
}
|
||||
is SlashRelationView.Section.SubheaderWithBack -> R.layout.item_slash_widget_subheader
|
||||
SlashRelationView.Section.Subheader -> R.layout.item_slash_widget_subheader
|
||||
SlashRelationView.Section.Subheader -> R.layout.item_slash_widget_subheader_left
|
||||
SlashRelationView.RelationNew -> R.layout.item_relation_add_new
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_ui.R
|
|||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetStyleBinding
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.StyleMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderMenuHolder
|
||||
import com.anytypeio.anytype.core_ui.features.editor.slash.holders.SubheaderOnlyMenuHolder
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
||||
class SlashStyleAdapter(
|
||||
|
@ -34,12 +35,16 @@ class SlashStyleAdapter(
|
|||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
is SubheaderOnlyMenuHolder -> {
|
||||
val item = items[position] as SlashItem.Subheader
|
||||
holder.bind(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int = when (val item = items[position]) {
|
||||
is SlashItem.Style -> R.layout.item_slash_widget_style
|
||||
is SlashItem.Subheader -> R.layout.item_slash_widget_subheader
|
||||
is SlashItem.Subheader -> item.getViewType()
|
||||
else -> throw IllegalArgumentException("Wrong item type:$item")
|
||||
}
|
||||
}
|
|
@ -50,7 +50,7 @@ class ActionMenuHolder(val binding: ItemSlashWidgetStyleBinding) : RecyclerView.
|
|||
ivIcon.setImageResource(R.drawable.ic_slash_actions_link_to)
|
||||
tvSubtitle.setText(R.string.slash_widget_actions_link_to_subtitle)
|
||||
}
|
||||
SlashItem.Actions.SelectDate -> {
|
||||
SlashItem.SelectDate -> {
|
||||
tvTitle.setText(R.string.select_date)
|
||||
ivIcon.setImageResource(R.drawable.ic_obj_date_24)
|
||||
tvSubtitle.gone()
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.anytypeio.anytype.core_ui.features.editor.slash.holders
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSelectDateBinding
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
||||
|
||||
class DateSelectHolder(
|
||||
val binding: ItemSlashWidgetSelectDateBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
init {
|
||||
binding.ivIcon.setIcon(ObjectIcon.Empty.Date)
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.anytypeio.anytype.core_ui.features.editor.slash.holders
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemListObjectSmallBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetObjectTypeBinding
|
||||
import com.anytypeio.anytype.core_utils.ext.gone
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.core_ui.features.editor.slash.holders
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding
|
||||
import com.anytypeio.anytype.core_utils.ext.invisible
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashRelationView
|
||||
|
@ -24,4 +25,13 @@ class RelationsSubheaderMenuHolder(
|
|||
}
|
||||
subheader.setText(text)
|
||||
}
|
||||
}
|
||||
|
||||
class RelationsSubheaderOnlyMenuHolder(
|
||||
val binding: ItemSlashWidgetSubheaderLeftBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind() = with(binding) {
|
||||
subheader.setText(R.string.slash_widget_main_relations)
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.core_ui.features.editor.slash.holders
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderBinding
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemSlashWidgetSubheaderLeftBinding
|
||||
import com.anytypeio.anytype.core_utils.ext.invisible
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem
|
||||
|
@ -80,4 +81,42 @@ class SubheaderMenuHolder(
|
|||
}
|
||||
subheader.setText(text)
|
||||
}
|
||||
}
|
||||
|
||||
class SubheaderOnlyMenuHolder(
|
||||
val binding: ItemSlashWidgetSubheaderLeftBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: SlashItem.Subheader) = with(binding) {
|
||||
val text = when (item) {
|
||||
SlashItem.Subheader.Style -> {
|
||||
R.string.slash_widget_main_style
|
||||
}
|
||||
SlashItem.Subheader.Media -> {
|
||||
R.string.slash_widget_main_media
|
||||
}
|
||||
SlashItem.Subheader.ObjectType -> {
|
||||
R.string.slash_widget_main_objects_subheader
|
||||
}
|
||||
SlashItem.Subheader.Other -> {
|
||||
R.string.slash_widget_main_other
|
||||
}
|
||||
SlashItem.Subheader.Actions -> {
|
||||
R.string.slash_widget_main_actions
|
||||
}
|
||||
SlashItem.Subheader.Alignment -> {
|
||||
R.string.slash_widget_main_alignment
|
||||
}
|
||||
SlashItem.Subheader.Color -> {
|
||||
R.string.slash_widget_main_color
|
||||
}
|
||||
SlashItem.Subheader.Background -> {
|
||||
R.string.slash_widget_main_background
|
||||
}
|
||||
else -> {
|
||||
0
|
||||
}
|
||||
}
|
||||
subheader.setText(text)
|
||||
}
|
||||
}
|
|
@ -10,11 +10,14 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.ime
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
|
@ -60,6 +63,7 @@ import kotlinx.coroutines.launch
|
|||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun SpaceSyncStatusScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
uiState: SyncStatusWidgetState,
|
||||
onDismiss: () -> Unit,
|
||||
scope: CoroutineScope,
|
||||
|
@ -99,10 +103,7 @@ fun SpaceSyncStatusScreen(
|
|||
.offset { IntOffset(0, swappableState.offset.value.roundToInt()) }
|
||||
) {
|
||||
ElevatedCard(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
.padding(start = 8.dp, end = 8.dp, bottom = 10.dp),
|
||||
modifier = modifier,
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = colorResource(id = R.color.background_secondary)
|
||||
),
|
||||
|
|
|
@ -50,7 +50,7 @@ fun StatusBadge(
|
|||
Image(
|
||||
painter = painterResource(R.drawable.ic_sync_error_10),
|
||||
contentDescription = null,
|
||||
modifier = modifier
|
||||
modifier = modifier.size(8.dp)
|
||||
)
|
||||
} else {
|
||||
when (spaceSyncUpdate.status) {
|
||||
|
@ -74,7 +74,7 @@ fun StatusBadge(
|
|||
Image(
|
||||
painter = painterResource(R.drawable.ic_sync_error_10),
|
||||
contentDescription = "Sync Error",
|
||||
modifier = modifier
|
||||
modifier = modifier.size(8.dp)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ fun StatusBadge(
|
|||
Image(
|
||||
painter = painterResource(R.drawable.ic_sync_grey_10),
|
||||
contentDescription = "Offline",
|
||||
modifier = modifier
|
||||
modifier = modifier.size(8.dp)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ fun StatusBadge(
|
|||
Image(
|
||||
painter = painterResource(R.drawable.ic_sync_slow_10),
|
||||
contentDescription = "Network Update Needed",
|
||||
modifier = modifier
|
||||
modifier = modifier.size(8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
12
core-ui/src/main/res/drawable/ic_date_arrow.xml
Normal file
12
core-ui/src/main/res/drawable/ic_date_arrow.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M9,5L16,12L9,19"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/glyph_active"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp">
|
||||
|
||||
<com.anytypeio.anytype.core_ui.widgets.ObjectIconWidget
|
||||
android:id="@+id/ivIcon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@string/content_desc_object_icon"
|
||||
app:checkboxSize="@dimen/list_item_object_half_checkbox_size"
|
||||
app:emojiSize="@dimen/list_item_object_half_emoji_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:hasEmojiRounded8Background="true"
|
||||
app:hasInitialRounded8Background="true"
|
||||
app:imageCornerRadius="@dimen/list_item_object_image_corner_radius"
|
||||
app:imageSize="24dp"
|
||||
app:initialTextSize="@dimen/list_item_object_half_initials_size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
style="@style/TextView.UXStyle.Titles.2.Regular"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:ellipsize="end"
|
||||
android:hint="@string/untitled"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="@string/select_date"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@drawable/divider_relations" />
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subheader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/dp_16"
|
||||
android:paddingBottom="8dp"
|
||||
android:textColor="@color/text_secondary"
|
||||
style="@style/TextView.UXStyle.Captions.1.Medium"
|
||||
android:layout_gravity="start|bottom"
|
||||
tools:text="Media"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -66,7 +66,7 @@ fun HeaderScreen(
|
|||
onDateEvent(DateEvent.Header.OnPreviousClick)
|
||||
},
|
||||
contentDescription = "Previous day",
|
||||
painter = painterResource(id = R.drawable.ic_arrow_disclosure_18),
|
||||
painter = painterResource(id = R.drawable.ic_date_arrow),
|
||||
contentScale = ContentScale.None
|
||||
)
|
||||
when (uiState) {
|
||||
|
@ -132,7 +132,7 @@ fun HeaderScreen(
|
|||
onDateEvent(DateEvent.Header.OnNextClick)
|
||||
},
|
||||
contentDescription = "Next day",
|
||||
painter = painterResource(id = R.drawable.ic_arrow_disclosure_18),
|
||||
painter = painterResource(id = R.drawable.ic_date_arrow),
|
||||
contentScale = ContentScale.None
|
||||
)
|
||||
}
|
||||
|
|
|
@ -9,11 +9,13 @@ import androidx.compose.foundation.layout.WindowInsets
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.ime
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.statusBars
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.layout.windowInsetsTopHeight
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SnackbarDuration
|
||||
|
@ -45,7 +47,7 @@ import com.anytypeio.anytype.feature_date.viewmodel.UiNavigationWidget
|
|||
import com.anytypeio.anytype.feature_date.viewmodel.UiObjectsListState
|
||||
import com.anytypeio.anytype.feature_date.viewmodel.UiSnackbarState
|
||||
import com.anytypeio.anytype.feature_date.viewmodel.UiSyncStatusBadgeState
|
||||
import com.anytypeio.anytype.feature_date.viewmodel.UiSyncStatusWidgetState
|
||||
import com.anytypeio.anytype.presentation.sync.SyncStatusWidgetState
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
@ -59,7 +61,7 @@ fun DateMainScreen(
|
|||
uiObjectsListState: UiObjectsListState,
|
||||
uiNavigationWidget: UiNavigationWidget,
|
||||
uiFieldsSheetState: UiFieldsSheetState,
|
||||
uiSyncStatusState: UiSyncStatusWidgetState,
|
||||
uiSyncStatusState: SyncStatusWidgetState,
|
||||
uiCalendarState: UiCalendarState,
|
||||
uiContentState: UiContentState,
|
||||
uiSnackbarState: UiSnackbarState,
|
||||
|
@ -126,7 +128,9 @@ fun DateMainScreen(
|
|||
modifier = Modifier.height(32.dp)
|
||||
)
|
||||
FieldsScreen(
|
||||
modifier = Modifier.fillMaxWidth().height(40.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(40.dp),
|
||||
uiState = uiFieldsState,
|
||||
onDateEvent = onDateEvent
|
||||
)
|
||||
|
@ -186,19 +190,23 @@ fun DateMainScreen(
|
|||
SnackbarHost(hostState = snackBarHostState)
|
||||
}
|
||||
)
|
||||
if (uiSyncStatusState is UiSyncStatusWidgetState.Visible) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
) {
|
||||
SpaceSyncStatusScreen(
|
||||
uiState = uiSyncStatusState.status,
|
||||
onDismiss = { onDateEvent(DateEvent.SyncStatusWidget.OnSyncStatusDismiss) },
|
||||
scope = scope,
|
||||
onUpdateAppClick = {}
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.BottomCenter
|
||||
) {
|
||||
SpaceSyncStatusScreen(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight()
|
||||
.windowInsetsPadding(WindowInsets.ime)
|
||||
.padding(bottom = 27.dp, start = 8.dp, end = 8.dp),
|
||||
uiState = uiSyncStatusState,
|
||||
onDismiss = { onDateEvent(DateEvent.SyncStatusWidget.OnSyncStatusDismiss) },
|
||||
scope = scope,
|
||||
onUpdateAppClick = {}
|
||||
)
|
||||
}
|
||||
|
||||
if (uiFieldsSheetState is UiFieldsSheetState.Visible) {
|
||||
FieldsSheetScreen(
|
||||
uiState = uiFieldsSheetState,
|
||||
|
|
|
@ -24,7 +24,8 @@ fun EmptyScreen() {
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.windowInsetsPadding(WindowInsets.ime)
|
||||
.fillMaxSize(),
|
||||
.fillMaxSize()
|
||||
.padding(bottom = 68.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
|
@ -32,7 +33,7 @@ fun EmptyScreen() {
|
|||
.fillMaxWidth()
|
||||
.padding(horizontal = 32.dp),
|
||||
text = title,
|
||||
color = colorResource(id = R.color.text_primary),
|
||||
color = colorResource(id = R.color.text_secondary),
|
||||
style = UXBody,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
|
|
@ -55,7 +55,6 @@ fun TopToolbarScreen(
|
|||
StatusBadge(
|
||||
status = uiSyncStatusBadgeState.status,
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.align(Alignment.Center)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.anytypeio.anytype.core_models.primitives.SpaceId
|
|||
import com.anytypeio.anytype.core_models.primitives.TimestampInSeconds
|
||||
import com.anytypeio.anytype.feature_date.viewmodel.UiFieldsItem.Loading
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
||||
import com.anytypeio.anytype.presentation.sync.SyncStatusWidgetState
|
||||
|
||||
data class DateObjectVmParams(
|
||||
val objectId: Id,
|
||||
|
@ -45,11 +44,6 @@ sealed class UiSyncStatusBadgeState {
|
|||
data class Visible(val status: SpaceSyncAndP2PStatusState) : UiSyncStatusBadgeState()
|
||||
}
|
||||
|
||||
sealed class UiSyncStatusWidgetState {
|
||||
data object Hidden : UiSyncStatusWidgetState()
|
||||
data class Visible(val status: SyncStatusWidgetState) : UiSyncStatusWidgetState()
|
||||
}
|
||||
|
||||
data class UiFieldsState(
|
||||
val items: List<UiFieldsItem>,
|
||||
val selectedRelationKey: RelationKey? = null,
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.anytypeio.anytype.feature_date.mapping.toUiObjectsListItem
|
|||
import com.anytypeio.anytype.feature_date.ui.models.DateEvent
|
||||
import com.anytypeio.anytype.feature_date.viewmodel.UiContentState.*
|
||||
import com.anytypeio.anytype.presentation.analytics.AnalyticSpaceHelperDelegate
|
||||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsAllContentScreen
|
||||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsClickDateBack
|
||||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsClickDateCalendarView
|
||||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsClickDateForward
|
||||
|
@ -46,6 +45,7 @@ import com.anytypeio.anytype.presentation.home.navigation
|
|||
import com.anytypeio.anytype.presentation.objects.getCreateObjectParams
|
||||
import com.anytypeio.anytype.presentation.search.GlobalSearchViewModel.Companion.DEFAULT_DEBOUNCE_DURATION
|
||||
import com.anytypeio.anytype.presentation.search.ObjectSearchConstants.defaultKeys
|
||||
import com.anytypeio.anytype.presentation.sync.SyncStatusWidgetState
|
||||
import com.anytypeio.anytype.presentation.sync.toSyncStatusWidgetState
|
||||
import kotlin.collections.map
|
||||
import kotlin.text.take
|
||||
|
@ -105,7 +105,7 @@ class DateObjectViewModel(
|
|||
val uiContentState = MutableStateFlow<UiContentState>(UiContentState.Idle())
|
||||
val uiCalendarState = MutableStateFlow<UiCalendarState>(UiCalendarState.Hidden)
|
||||
val uiSyncStatusWidgetState =
|
||||
MutableStateFlow<UiSyncStatusWidgetState>(UiSyncStatusWidgetState.Hidden)
|
||||
MutableStateFlow<SyncStatusWidgetState>(SyncStatusWidgetState.Hidden)
|
||||
val uiSnackbarState = MutableStateFlow<UiSnackbarState>(UiSnackbarState.Hidden)
|
||||
|
||||
val effects = MutableSharedFlow<DateObjectCommand>()
|
||||
|
@ -257,10 +257,8 @@ class DateObjectViewModel(
|
|||
uiSyncStatusBadgeState.value = UiSyncStatusBadgeState.Visible(syncAndP2pState)
|
||||
val state = uiSyncStatusWidgetState.value
|
||||
uiSyncStatusWidgetState.value = when (state) {
|
||||
UiSyncStatusWidgetState.Hidden -> UiSyncStatusWidgetState.Hidden
|
||||
is UiSyncStatusWidgetState.Visible -> state.copy(
|
||||
status = syncAndP2pState.toSyncStatusWidgetState()
|
||||
)
|
||||
SyncStatusWidgetState.Hidden -> SyncStatusWidgetState.Hidden
|
||||
else -> syncAndP2pState.toSyncStatusWidgetState()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +691,7 @@ class DateObjectViewModel(
|
|||
private fun onSyncStatusWidgetEvent(event: DateEvent.SyncStatusWidget) {
|
||||
when (event) {
|
||||
DateEvent.SyncStatusWidget.OnSyncStatusDismiss -> {
|
||||
uiSyncStatusWidgetState.value = UiSyncStatusWidgetState.Hidden
|
||||
uiSyncStatusWidgetState.value = SyncStatusWidgetState.Hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -719,9 +717,7 @@ class DateObjectViewModel(
|
|||
|
||||
is DateEvent.TopToolbar.OnSyncStatusClick -> {
|
||||
uiSyncStatusWidgetState.value =
|
||||
UiSyncStatusWidgetState.Visible(
|
||||
status = event.status.toSyncStatusWidgetState()
|
||||
)
|
||||
event.status.toSyncStatusWidgetState()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5123,6 +5123,11 @@ class EditorViewModel(
|
|||
onHideKeyboardClicked()
|
||||
addSimpleTableBlock(item)
|
||||
}
|
||||
is SlashItem.SelectDate -> {
|
||||
mentionDatePicker.value = EditorDatePickerState.Visible.Link(
|
||||
targetId = targetId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5472,11 +5477,6 @@ class EditorViewModel(
|
|||
onHideKeyboardClicked()
|
||||
proceedWithLinkToButtonClicked(block = targetId, position = slashStartIndex)
|
||||
}
|
||||
SlashItem.Actions.SelectDate -> {
|
||||
mentionDatePicker.value = EditorDatePickerState.Visible.Link(
|
||||
targetId = targetId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ object SlashExtensions {
|
|||
listOf(
|
||||
SlashItem.Subheader.ObjectTypeWithBlack,
|
||||
SlashItem.Actions.LinkTo,
|
||||
SlashItem.Actions.SelectDate
|
||||
SlashItem.SelectDate
|
||||
) + objectTypes.toSlashItemView()
|
||||
|
||||
fun getSlashWidgetRelationItems(relations: List<SlashRelationView>): List<SlashRelationView> =
|
||||
|
@ -203,7 +203,7 @@ object SlashExtensions {
|
|||
)
|
||||
val filteredObjects = filterObjectTypes(
|
||||
filter = filter,
|
||||
items = listOf(SlashItem.Actions.LinkTo, SlashItem.Actions.SelectDate) + objectTypes
|
||||
items = listOf(SlashItem.Actions.LinkTo, SlashItem.SelectDate) + objectTypes
|
||||
)
|
||||
val filteredRelations = filterRelations(
|
||||
filter = filter,
|
||||
|
@ -284,8 +284,12 @@ object SlashExtensions {
|
|||
searchBySubheadingOrName(
|
||||
filter = filter,
|
||||
subheading = SlashItem.Main.Objects.getSearchName(),
|
||||
name = if (item is SlashItem.ObjectType) item.objectTypeView.name
|
||||
else (item as SlashItem.Actions).getSearchName()
|
||||
name = when(item) {
|
||||
is SlashItem.ObjectType -> item.objectTypeView.name
|
||||
is SlashItem.Actions -> item.getSearchName()
|
||||
is SlashItem.SelectDate -> item.getSearchName()
|
||||
else -> ""
|
||||
}
|
||||
)
|
||||
}
|
||||
return updateWithSubheader(items = filtered)
|
||||
|
@ -346,6 +350,7 @@ object SlashExtensions {
|
|||
is SlashItem.ObjectType -> listOf(SlashItem.Subheader.ObjectType) + items
|
||||
is SlashItem.Other -> listOf(SlashItem.Subheader.Other) + items
|
||||
is SlashItem.Style -> listOf(SlashItem.Subheader.Style) + items
|
||||
is SlashItem.SelectDate -> listOf(SlashItem.Subheader.ObjectType) + items
|
||||
else -> items
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -396,13 +396,6 @@ sealed class SlashItem {
|
|||
override fun getSearchName(): String = SlashConst.SLASH_ACTION_LINK_TO
|
||||
override fun getAbbreviation(): List<String>? = null
|
||||
}
|
||||
|
||||
object SelectDate : Actions() {
|
||||
override fun getSearchName(): String = SlashConst.SLASH_ACTION_SELECT_DATE
|
||||
override fun getAbbreviation(): List<String>? = listOf(
|
||||
SLASH_ACTION_SELECT_DATE_ABBREVIATION
|
||||
)
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
||||
|
@ -445,4 +438,11 @@ sealed class SlashItem {
|
|||
) : Color()
|
||||
}
|
||||
//endregion
|
||||
|
||||
object SelectDate : SlashItem() {
|
||||
override fun getSearchName(): String = SlashConst.SLASH_ACTION_SELECT_DATE
|
||||
override fun getAbbreviation(): List<String>? = listOf(
|
||||
SLASH_ACTION_SELECT_DATE_ABBREVIATION
|
||||
)
|
||||
}
|
||||
}
|
|
@ -360,7 +360,7 @@ class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() {
|
|||
val expectedObjectItems = listOf(
|
||||
SlashItem.Subheader.ObjectTypeWithBlack,
|
||||
SlashItem.Actions.LinkTo,
|
||||
SlashItem.Actions.SelectDate,
|
||||
SlashItem.SelectDate,
|
||||
SlashItem.ObjectType(
|
||||
objectTypeView = ObjectTypeView(
|
||||
id = type1.id,
|
||||
|
|
|
@ -478,7 +478,7 @@ class EditorSlashWidgetFilterTest : EditorPresentationTestSetup() {
|
|||
val expectedItems = listOf(
|
||||
SlashItem.Subheader.Actions,
|
||||
SlashItem.Actions.LinkTo,
|
||||
SlashItem.Actions.SelectDate,
|
||||
SlashItem.SelectDate,
|
||||
SlashItem.ObjectType(
|
||||
objectTypeView = ObjectTypeView(
|
||||
id = type1.id,
|
||||
|
@ -1562,7 +1562,7 @@ class EditorSlashWidgetFilterTest : EditorPresentationTestSetup() {
|
|||
val expectedItems = listOf(
|
||||
SlashItem.Subheader.Actions,
|
||||
SlashItem.Actions.LinkTo,
|
||||
SlashItem.Actions.SelectDate,
|
||||
SlashItem.SelectDate,
|
||||
SlashItem.ObjectType(
|
||||
objectTypeView = ObjectTypeView(
|
||||
id = type1.id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue