mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-10 10:00:44 +09:00
771: Add block below (#810)
* #771: add text block below * #771: tests * Update workflow.yml
This commit is contained in:
parent
0bb0023696
commit
207013077b
4 changed files with 30 additions and 1 deletions
|
@ -385,7 +385,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
object ACTIONS {
|
||||
|
||||
val PAGE = listOf(
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.Delete,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Duplicate,
|
||||
|
@ -394,6 +395,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val TEXT = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.TurnInto,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Delete,
|
||||
|
@ -406,6 +409,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val CHECKBOX_CHECKED = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.TurnInto,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Delete,
|
||||
|
@ -418,6 +423,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val VIDEO_PICTURE = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.Delete,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Duplicate,
|
||||
|
@ -428,6 +435,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val FILE = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.Delete,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Duplicate,
|
||||
|
@ -438,6 +447,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val BOOKMARK = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.Delete,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Duplicate,
|
||||
|
@ -446,6 +457,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val CODE = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.TurnInto,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Delete,
|
||||
|
@ -456,6 +469,8 @@ abstract class BlockActionToolbar : Fragment() {
|
|||
)
|
||||
|
||||
val DIVIDER = listOf(
|
||||
ActionItemType.AddBelow,
|
||||
ActionItemType.DividerExtended,
|
||||
ActionItemType.Delete,
|
||||
ActionItemType.Divider,
|
||||
ActionItemType.Duplicate,
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.agileburo.anytype.core_ui.extensions.drawable
|
|||
import kotlinx.android.synthetic.main.action_item.view.*
|
||||
|
||||
sealed class ActionItemType {
|
||||
object AddBelow : ActionItemType()
|
||||
object TurnInto : ActionItemType()
|
||||
object Delete : ActionItemType()
|
||||
object Duplicate : ActionItemType()
|
||||
|
@ -35,6 +36,10 @@ class BlockActionBarItem @JvmOverloads constructor(
|
|||
|
||||
private fun updateView() {
|
||||
when (itemType) {
|
||||
ActionItemType.AddBelow -> updateContent(
|
||||
R.string.action_bar_add_below,
|
||||
R.drawable.ic_action_add_block_below
|
||||
)
|
||||
ActionItemType.TurnInto -> updateContent(
|
||||
R.string.action_bar_turn_into,
|
||||
R.drawable.ic_action_turn_into
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
<string-array name="certs">
|
||||
<item>MIIEqDCCA5CgAwIBAgIJA071MA0GCSqGSIb3DQEBBAUAMIGUMQsww...</item>
|
||||
</string-array>
|
||||
<string name="action_bar_add_below">Add block below</string>
|
||||
<string name="action_bar_turn_into">Turn into</string>
|
||||
<string name="action_bar_delete">Delete</string>
|
||||
<string name="action_bar_duplicate">Duplicate</string>
|
||||
|
|
|
@ -1012,6 +1012,14 @@ class PageViewModel(
|
|||
|
||||
fun onActionMenuItemClicked(id: String, action: ActionItemType) {
|
||||
when (action) {
|
||||
ActionItemType.AddBelow -> {
|
||||
onExitActionMode()
|
||||
dispatch(Command.PopBackStack)
|
||||
proceedWithCreatingNewTextBlock(
|
||||
id = id,
|
||||
style = Content.Text.Style.P
|
||||
)
|
||||
}
|
||||
ActionItemType.TurnInto -> {
|
||||
val excludedTypes = mutableListOf<String>()
|
||||
val target = blocks.first { it.id == id }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue