mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-196 App | Enhancement | Remove Bookmark type from suggestions when 1) changing object type 2) in global search (#2481)
This commit is contained in:
parent
f101696dc8
commit
d96daa7fe9
8 changed files with 14 additions and 72 deletions
|
@ -1053,7 +1053,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
.navigate(
|
||||
R.id.objectTypeChangeScreen,
|
||||
bundleOf(
|
||||
ObjectTypeChangeFragment.ARG_SMART_BLOCK_TYPE to command.smartBlockType
|
||||
ObjectTypeChangeFragment.ARG_SMART_BLOCK_TYPE to command.smartBlockType,
|
||||
ObjectTypeChangeFragment.ARG_EXCLUDED_TYPES to command.excludedTypes
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package com.anytypeio.anytype.core_ui.menu
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.PopupMenu
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
|
||||
class DocumentPopUpMenu(
|
||||
context: Context,
|
||||
view: View,
|
||||
onArchiveClicked: () -> Unit,
|
||||
onRedoClicked: () -> Unit,
|
||||
onUndoClicked: () -> Unit,
|
||||
onEnterMultiSelect: () -> Unit,
|
||||
onSearchClicked: () -> Unit,
|
||||
onRelationsClicked: () -> Unit
|
||||
) : PopupMenu(context, view) {
|
||||
|
||||
init {
|
||||
menuInflater.inflate(R.menu.menu_page, menu)
|
||||
setOnMenuItemClickListener { item ->
|
||||
when(item.itemId) {
|
||||
R.id.archive -> onArchiveClicked()
|
||||
R.id.undo -> onUndoClicked()
|
||||
R.id.redo -> onRedoClicked()
|
||||
R.id.select -> onEnterMultiSelect()
|
||||
R.id.search -> onSearchClicked()
|
||||
R.id.relations -> onRelationsClicked()
|
||||
else -> throw IllegalStateException("Unexpected menu item: $item")
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package com.anytypeio.anytype.core_ui.menu
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.PopupMenu
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
|
||||
class ProfilePopUpMenu(
|
||||
context: Context,
|
||||
view: View,
|
||||
onRedoClicked: () -> Unit,
|
||||
onUndoClicked: () -> Unit,
|
||||
onEnterMultiSelect: () -> Unit,
|
||||
onSearchClicked: () -> Unit
|
||||
) : PopupMenu(context, view) {
|
||||
|
||||
init {
|
||||
menuInflater.inflate(R.menu.menu_profile, menu)
|
||||
setOnMenuItemClickListener { item ->
|
||||
when (item.itemId) {
|
||||
R.id.undo -> onUndoClicked()
|
||||
R.id.redo -> onRedoClicked()
|
||||
R.id.select -> onEnterMultiSelect()
|
||||
R.id.search -> onSearchClicked()
|
||||
else -> throw IllegalStateException("Unexpected menu item: $item")
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -228,7 +228,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout {
|
|||
context = context,
|
||||
view = it,
|
||||
onChangeTypeClicked = {
|
||||
click(ListenerType.Relation.ObjectType(type = relation.relationId))
|
||||
click(ListenerType.Relation.ChangeObjectType(type = relation.relationId))
|
||||
},
|
||||
onOpenSetClicked = {
|
||||
click(ListenerType.Relation.ObjectTypeOpenSet(type = relation.type))
|
||||
|
|
|
@ -3735,7 +3735,7 @@ class EditorViewModel(
|
|||
}
|
||||
}
|
||||
}
|
||||
is ListenerType.Relation.ObjectType -> {
|
||||
is ListenerType.Relation.ChangeObjectType -> {
|
||||
if (mode != EditorMode.Locked) {
|
||||
val restrictions = orchestrator.stores.objectRestrictions.current()
|
||||
if (restrictions.contains(ObjectRestriction.TYPE_CHANGE)) {
|
||||
|
@ -3746,7 +3746,8 @@ class EditorViewModel(
|
|||
dispatch(
|
||||
Command.OpenChangeObjectTypeScreen(
|
||||
ctx = context,
|
||||
smartBlockType = getObjectSmartBlockType()
|
||||
smartBlockType = getObjectSmartBlockType(),
|
||||
excludedTypes = listOf(ObjectType.BOOKMARK_TYPE)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
@ -5526,7 +5527,8 @@ class EditorViewModel(
|
|||
dispatch(
|
||||
Command.OpenChangeObjectTypeScreen(
|
||||
ctx = context,
|
||||
smartBlockType = getObjectSmartBlockType()
|
||||
smartBlockType = getObjectSmartBlockType(),
|
||||
excludedTypes = listOf(ObjectType.BOOKMARK_TYPE)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -107,7 +107,8 @@ sealed class Command {
|
|||
data class OpenChangeObjectTypeScreen(
|
||||
val ctx: Id,
|
||||
val smartBlockType: SmartBlockType,
|
||||
val isDraft: Boolean = false
|
||||
val excludedTypes: List<Id>,
|
||||
val isDraft: Boolean = false,
|
||||
) : Command()
|
||||
|
||||
data class OpenMoveToScreen(
|
||||
|
|
|
@ -62,7 +62,7 @@ sealed interface ListenerType {
|
|||
sealed class Relation : ListenerType {
|
||||
data class Placeholder(val target: Id) : Relation()
|
||||
data class Related(val value: BlockView.Relation) : Relation()
|
||||
data class ObjectType(val type: String) : Relation()
|
||||
data class ChangeObjectType(val type: String) : Relation()
|
||||
data class ObjectTypeOpenSet(val type: String) : Relation()
|
||||
data class Featured(val relation: DocumentRelationView) : Relation()
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.presentation.search
|
|||
|
||||
import com.anytypeio.anytype.core_models.*
|
||||
import com.anytypeio.anytype.core_models.ObjectType.Companion.AUDIO_URL
|
||||
import com.anytypeio.anytype.core_models.ObjectType.Companion.BOOKMARK_TYPE
|
||||
import com.anytypeio.anytype.core_models.ObjectType.Companion.DASHBOARD_TYPE
|
||||
import com.anytypeio.anytype.core_models.ObjectType.Companion.FILE_URL
|
||||
import com.anytypeio.anytype.core_models.ObjectType.Companion.IMAGE_URL
|
||||
|
@ -38,7 +39,8 @@ object ObjectSearchConstants {
|
|||
IMAGE_URL,
|
||||
FILE_URL,
|
||||
VIDEO_URL,
|
||||
AUDIO_URL
|
||||
AUDIO_URL,
|
||||
BOOKMARK_TYPE
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue