mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3473 Sets | Enhancement | Changed Calendar view to Graph view in Object Set Fragment (#2170)
Co-authored-by: Evgenii Kozlov <enklave.mare.balticum@protonmail.com>
This commit is contained in:
parent
8c62746d07
commit
16a2c2b65a
4 changed files with 36 additions and 5 deletions
|
@ -846,6 +846,9 @@ open class ObjectSetFragment :
|
|||
listView.gone()
|
||||
listView.setViews(emptyList())
|
||||
when(viewer.type) {
|
||||
Viewer.Unsupported.TYPE_GRAPH -> {
|
||||
unsupportedViewError.setText(R.string.error_graph_view_not_supported)
|
||||
}
|
||||
Viewer.Unsupported.TYPE_CALENDAR -> {
|
||||
unsupportedViewError.setText(R.string.error_calendar_view_not_supported)
|
||||
}
|
||||
|
|
|
@ -1290,6 +1290,7 @@
|
|||
|
||||
<string name="error_kanban_view_not_supported">Kanban view is not available on mobile yet.\nChange view type (Settings -> View) or create a new one to access your data.</string>
|
||||
<string name="error_calendar_view_not_supported">Calendar view is not available on mobile yet.\nChange view type (Settings -> View) or create a new one to access your data.</string>
|
||||
<string name="error_graph_view_not_supported">Graph view is not available on mobile yet.\nChange view type (Settings -> View) or create a new one to access your data.</string>
|
||||
<string name="error_generic_view_not_supported">This view is not available on mobile yet.\nChange view type (Settings -> View) or create a new one to access your data.</string>
|
||||
|
||||
<string name="create_object_section_pinned">Pinned</string>
|
||||
|
|
|
@ -112,6 +112,7 @@ suspend fun DVViewer.render(
|
|||
largeCards = cardSize == DVViewerCardSize.LARGE
|
||||
)
|
||||
}
|
||||
|
||||
DVViewerType.LIST -> {
|
||||
val vmap = viewerRelations.associateBy { it.key }
|
||||
val visibleRelations = dataViewRelations.filter { relation ->
|
||||
|
@ -131,6 +132,7 @@ suspend fun DVViewer.render(
|
|||
title = name
|
||||
)
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (useFallbackView) {
|
||||
buildGridView(
|
||||
|
@ -145,10 +147,19 @@ suspend fun DVViewer.render(
|
|||
Viewer.Unsupported(
|
||||
id = id,
|
||||
title = name,
|
||||
type = if (type == DVViewerType.BOARD)
|
||||
Viewer.Unsupported.TYPE_KANBAN
|
||||
else
|
||||
Viewer.Unsupported.TYPE_CALENDAR
|
||||
type = when (type) {
|
||||
DVViewerType.BOARD -> Viewer.Unsupported.TYPE_KANBAN
|
||||
DVViewerType.CALENDAR -> {
|
||||
Viewer.Unsupported.TYPE_CALENDAR
|
||||
}
|
||||
DVViewerType.GRAPH -> {
|
||||
Viewer.Unsupported.TYPE_GRAPH
|
||||
}
|
||||
else -> {
|
||||
Viewer.Unsupported.TYPE_UNKNOWN
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +464,7 @@ suspend fun ObjectWrapper.Relation.toStatus(
|
|||
value: Any?,
|
||||
store: ObjectStore
|
||||
): StatusView? {
|
||||
val filter : Id? = value.values<Id>().firstOrNull()
|
||||
val filter: Id? = value.values<Id>().firstOrNull()
|
||||
return if (filter != null) {
|
||||
val option = store.get(filter)?.let { ObjectWrapper.Option(it.map) }
|
||||
if (option != null && option.isDeleted != true) {
|
||||
|
@ -490,6 +501,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.LONG_TEXT -> {
|
||||
FilterView.Expression.Text(
|
||||
id = id,
|
||||
|
@ -503,6 +515,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.URL -> {
|
||||
FilterView.Expression.Url(
|
||||
id = id,
|
||||
|
@ -516,6 +529,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.EMAIL -> {
|
||||
FilterView.Expression.Email(
|
||||
id = id,
|
||||
|
@ -529,6 +543,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.PHONE -> {
|
||||
FilterView.Expression.Phone(
|
||||
id = id,
|
||||
|
@ -542,6 +557,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.NUMBER -> {
|
||||
FilterView.Expression.Number(
|
||||
id = id,
|
||||
|
@ -555,6 +571,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.DATE -> {
|
||||
val fieldDate = fieldParser.toDate(any = value)
|
||||
FilterView.Expression.Date(
|
||||
|
@ -571,6 +588,7 @@ suspend fun DVFilter.toView(
|
|||
relativeDate = fieldDate?.relativeDate
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.STATUS -> {
|
||||
val updatedFilterValue = relation.toStatus(
|
||||
value = value,
|
||||
|
@ -588,6 +606,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.TAG -> {
|
||||
FilterView.Expression.Tag(
|
||||
id = id,
|
||||
|
@ -606,6 +625,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.OBJECT, Relation.Format.FILE -> {
|
||||
FilterView.Expression.Object(
|
||||
id = id,
|
||||
|
@ -626,6 +646,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
Relation.Format.CHECKBOX -> {
|
||||
FilterView.Expression.Checkbox(
|
||||
id = id,
|
||||
|
@ -639,6 +660,7 @@ suspend fun DVFilter.toView(
|
|||
isInEditMode = isInEditMode
|
||||
)
|
||||
}
|
||||
|
||||
else -> throw UnsupportedOperationException("Unsupported relation format:${relation.format}")
|
||||
}
|
||||
|
||||
|
@ -657,12 +679,14 @@ suspend fun ObjectWrapper.Relation.toFilterValue(
|
|||
store = store
|
||||
)
|
||||
)
|
||||
|
||||
Relation.Format.TAG -> FilterValue.Tag(
|
||||
toTags(
|
||||
value = value,
|
||||
store = store
|
||||
)
|
||||
)
|
||||
|
||||
Relation.Format.DATE -> FilterValue.Date(DateParser.parse(value))
|
||||
Relation.Format.URL -> FilterValue.Url(toText(value))
|
||||
Relation.Format.EMAIL -> FilterValue.Email(toText(value))
|
||||
|
@ -676,6 +700,7 @@ suspend fun ObjectWrapper.Relation.toFilterValue(
|
|||
)
|
||||
FilterValue.Object(obj)
|
||||
}
|
||||
|
||||
Relation.Format.CHECKBOX -> FilterValue.Check(toCheckbox(value))
|
||||
else -> throw UnsupportedOperationException("Unsupported relation format:${format}")
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ sealed class Viewer {
|
|||
companion object {
|
||||
const val TYPE_KANBAN = 0
|
||||
const val TYPE_CALENDAR = 1
|
||||
const val TYPE_GRAPH = 2
|
||||
const val TYPE_UNKNOWN = -1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue