1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-07 21:37:02 +09:00

DROID-1818 Templates | Create object widget, create for types without templates (#447)

This commit is contained in:
Konstantin Ivanov 2023-10-20 13:04:58 +02:00 committed by GitHub
parent 60ab3a0872
commit 490e97589c
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View file

@ -593,14 +593,8 @@ open class ObjectSetFragment :
}
private fun setupNewButtons(isTemplatesAllowed: Boolean) {
if (isTemplatesAllowed) {
addNewButton.gone()
addNewIconButton.visible()
} else {
addNewButton.visible()
addNewButton.isEnabled = true
addNewIconButton.gone()
}
addNewButton.gone()
addNewIconButton.visible()
}
private fun setViewer(viewer: Viewer?) {

View file

@ -83,6 +83,7 @@ import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_ui.R
import com.anytypeio.anytype.core_ui.foundation.Divider
import com.anytypeio.anytype.core_ui.foundation.Dragger
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
import com.anytypeio.anytype.core_ui.foundation.noRippleThrottledClickable
import com.anytypeio.anytype.core_ui.views.BodyCalloutMedium
@ -192,8 +193,14 @@ fun TypeTemplatesWidget(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(bottom = 20.dp, top = 8.dp)
.padding(bottom = 20.dp)
) {
Box(modifier = Modifier
.fillMaxWidth()
.padding(top = 6.dp, bottom = 6.dp)
) {
Dragger(modifier = Modifier.align(Alignment.Center))
}
Box(
modifier = Modifier
.fillMaxWidth()

View file

@ -1753,8 +1753,10 @@ class ObjectSetViewModel(
val isTemplatesAllowed = viewerDefObjType.isTemplatesAllowed()
if (!isTemplatesAllowed) {
return emptyList()
val newTemplate = if (!isTemplatesAllowed) {
emptyList()
} else {
listOf(TemplateView.New(viewerDefObjType.id))
}
val blankTemplate = listOf(
@ -1768,7 +1770,7 @@ class ObjectSetViewModel(
coverImageHashProvider = coverImageHashProvider,
viewerDefTemplateId = viewerDefTemplateId,
)
} + listOf(TemplateView.New(viewerDefObjType.id))
} + newTemplate
}
private fun proceedWithCreatingTemplate(targetObjectType: Id) {