diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bd847d466..9735e04280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### New features & enhancements 🚀 * Editor | Latex block in experimental mode. Based on WebView. (#1814) +* Objects | Menu | Select a layout, which best suits your object: Note, Basic, Profile, or Task (#1894) * Sets | Delete a relation from your set (#1890) ### Design & UX 🔳 diff --git a/app/src/main/res/layout/fragment_object_layout.xml b/app/src/main/res/layout/fragment_object_layout.xml index ef9b297d6d..00232ef8ca 100644 --- a/app/src/main/res/layout/fragment_object_layout.xml +++ b/app/src/main/res/layout/fragment_object_layout.xml @@ -35,6 +35,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="16dp" + android:paddingBottom="40dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvRelationHeader" diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectLayoutHolder.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectLayoutHolder.kt index 5d10bb808f..f23c8b87aa 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectLayoutHolder.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectLayoutHolder.kt @@ -1,6 +1,7 @@ package com.anytypeio.anytype.core_ui.features.objects.holders import android.view.View +import com.anytypeio.anytype.core_ui.R import com.anytypeio.anytype.core_ui.common.AbstractViewHolder import com.anytypeio.anytype.core_ui.extensions.getIconSize24 import com.anytypeio.anytype.core_ui.extensions.getName @@ -12,18 +13,32 @@ import kotlinx.android.synthetic.main.item_layout.view.* class ObjectLayoutHolder(view: View) : AbstractViewHolder(view) { override fun bind(item: ObjectLayoutView) { - val icon = item.getIconSize24() - val name = item.getName() - if (icon != null) { - itemView.ivIcon.setImageResource(icon) - } else { - itemView.ivIcon.setImageDrawable(null) - } - if (name != null) { - itemView.tvTitle.setText(name) - } else { - itemView.tvTitle.text = null + when(item) { + is ObjectLayoutView.Basic -> { + itemView.ivIcon.setImageResource(R.drawable.ic_layout_basic) + itemView.tvTitle.setText(R.string.layout_basic_name) + itemView.tvSubtitle.setText(R.string.layout_basic_description) + } + is ObjectLayoutView.Note -> { + itemView.ivIcon.setImageResource(R.drawable.ic_layout_note) + itemView.tvTitle.setText(R.string.layout_note_name) + itemView.tvSubtitle.setText(R.string.layout_note_description) + } + is ObjectLayoutView.Profile -> { + itemView.ivIcon.setImageResource(R.drawable.ic_layout_profile) + itemView.tvTitle.setText(R.string.layout_profile_name) + itemView.tvSubtitle.setText(R.string.layout_profile_description) + } + is ObjectLayoutView.Todo -> { + itemView.ivIcon.setImageResource(R.drawable.ic_layout_task) + itemView.tvTitle.setText(R.string.layout_todo_name) + itemView.tvSubtitle.setText(R.string.layout_todo_description) + } + else -> { + // TODO + } } + if (item.isSelected) { itemView.ivChecked.visible() } else { diff --git a/core-ui/src/main/res/drawable/ic_layout_basic.xml b/core-ui/src/main/res/drawable/ic_layout_basic.xml index 89f153c9b2..b3fe5183aa 100644 --- a/core-ui/src/main/res/drawable/ic_layout_basic.xml +++ b/core-ui/src/main/res/drawable/ic_layout_basic.xml @@ -1,19 +1,20 @@ + android:width="44dp" + android:height="44dp" + android:viewportWidth="44" + android:viewportHeight="44"> + android:strokeWidth="1" + android:pathData="M8,0.5L36,0.5A7.5,7.5 0,0 1,43.5 8L43.5,36A7.5,7.5 0,0 1,36 43.5L8,43.5A7.5,7.5 0,0 1,0.5 36L0.5,8A7.5,7.5 0,0 1,8 0.5z" + android:fillColor="#00000000" + android:strokeColor="#DFDDD0"/> + android:pathData="M12,9L18,9A4,4 0,0 1,22 13L22,19A4,4 0,0 1,18 23L12,23A4,4 0,0 1,8 19L8,13A4,4 0,0 1,12 9z" + android:fillColor="#FFD15B"/> + android:pathData="M8.5,27L35.5,27A0.5,0.5 0,0 1,36 27.5L36,29.5A0.5,0.5 0,0 1,35.5 30L8.5,30A0.5,0.5 0,0 1,8 29.5L8,27.5A0.5,0.5 0,0 1,8.5 27z" + android:fillColor="#DFDDD0"/> + android:pathData="M8.5,33L25.5,33A0.5,0.5 0,0 1,26 33.5L26,34.5A0.5,0.5 0,0 1,25.5 35L8.5,35A0.5,0.5 0,0 1,8 34.5L8,33.5A0.5,0.5 0,0 1,8.5 33z" + android:fillColor="#DFDDD0"/> diff --git a/core-ui/src/main/res/drawable/ic_layout_note.xml b/core-ui/src/main/res/drawable/ic_layout_note.xml new file mode 100644 index 0000000000..24467751cd --- /dev/null +++ b/core-ui/src/main/res/drawable/ic_layout_note.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/core-ui/src/main/res/drawable/ic_layout_profile.xml b/core-ui/src/main/res/drawable/ic_layout_profile.xml index 3a036bcc1e..d3a9d9188d 100644 --- a/core-ui/src/main/res/drawable/ic_layout_profile.xml +++ b/core-ui/src/main/res/drawable/ic_layout_profile.xml @@ -1,17 +1,22 @@ + android:width="44dp" + android:height="44dp" + android:viewportWidth="44" + android:viewportHeight="44"> + android:strokeWidth="1" + android:pathData="M8,0.5L36,0.5A7.5,7.5 0,0 1,43.5 8L43.5,36A7.5,7.5 0,0 1,36 43.5L8,43.5A7.5,7.5 0,0 1,0.5 36L0.5,8A7.5,7.5 0,0 1,8 0.5z" + android:fillColor="#00000000" + android:strokeColor="#DFDDD0"/> + android:pathData="M22,8L22,8A8,8 0,0 1,30 16L30,16A8,8 0,0 1,22 24L22,24A8,8 0,0 1,14 16L14,16A8,8 0,0 1,22 8z" + android:strokeAlpha="0.5" + android:fillColor="#2AA7EE" + android:fillAlpha="0.5"/> + android:pathData="M8.5,27L35.5,27A0.5,0.5 0,0 1,36 27.5L36,29.5A0.5,0.5 0,0 1,35.5 30L8.5,30A0.5,0.5 0,0 1,8 29.5L8,27.5A0.5,0.5 0,0 1,8.5 27z" + android:fillColor="#DFDDD0"/> + diff --git a/core-ui/src/main/res/drawable/ic_layout_task.xml b/core-ui/src/main/res/drawable/ic_layout_task.xml index 3baa093b37..195af682d6 100644 --- a/core-ui/src/main/res/drawable/ic_layout_task.xml +++ b/core-ui/src/main/res/drawable/ic_layout_task.xml @@ -1,14 +1,27 @@ + android:width="44dp" + android:height="44dp" + android:viewportWidth="44" + android:viewportHeight="44"> + android:strokeWidth="1" + android:pathData="M8,0.5L36,0.5A7.5,7.5 0,0 1,43.5 8L43.5,36A7.5,7.5 0,0 1,36 43.5L8,43.5A7.5,7.5 0,0 1,0.5 36L0.5,8A7.5,7.5 0,0 1,8 0.5z" + android:fillColor="#00000000" + android:strokeColor="#DFDDD0"/> + + + + diff --git a/core-ui/src/main/res/layout/item_layout.xml b/core-ui/src/main/res/layout/item_layout.xml index d7dfa24aaa..ca0355a8c1 100644 --- a/core-ui/src/main/res/layout/item_layout.xml +++ b/core-ui/src/main/res/layout/item_layout.xml @@ -1,41 +1,60 @@ - + android:background="@drawable/default_ripple" + android:layout_height="wrap_content" + android:orientation="horizontal"> - + android:layout_gravity="center_vertical" + android:layout_marginStart="12dp" + android:layout_weight="1" + android:orientation="vertical"> + + + + + + + tools:visibility="visible" /> - \ No newline at end of file + \ No newline at end of file diff --git a/core-ui/src/main/res/values/colors.xml b/core-ui/src/main/res/values/colors.xml index ec727ee14d..6b5de7f3ca 100644 --- a/core-ui/src/main/res/values/colors.xml +++ b/core-ui/src/main/res/values/colors.xml @@ -135,4 +135,7 @@ #FFB522 #CBC9BD + + #929082 + diff --git a/core-ui/src/main/res/values/strings.xml b/core-ui/src/main/res/values/strings.xml index a310e2c9f8..9dc1b40e40 100644 --- a/core-ui/src/main/res/values/strings.xml +++ b/core-ui/src/main/res/values/strings.xml @@ -442,5 +442,13 @@ Deleted Paste link or search objects Create object \"%1$s\" + Basic + Standard layout for canvas blocks + Note + Designed to capture thoughts quickly + Profile + Companies, contacts, friends, and family + Task + Action-focused layout with a checkbox diff --git a/core-ui/src/main/res/values/styles.xml b/core-ui/src/main/res/values/styles.xml index 9c2248cf91..c2117d896c 100644 --- a/core-ui/src/main/res/values/styles.xml +++ b/core-ui/src/main/res/values/styles.xml @@ -829,10 +829,22 @@ 11sp - + + \ No newline at end of file diff --git a/domain/src/main/java/com/anytypeio/anytype/domain/layout/GetSupportedObjectLayouts.kt b/domain/src/main/java/com/anytypeio/anytype/domain/layout/GetSupportedObjectLayouts.kt index 0977171c02..13c5f07c84 100644 --- a/domain/src/main/java/com/anytypeio/anytype/domain/layout/GetSupportedObjectLayouts.kt +++ b/domain/src/main/java/com/anytypeio/anytype/domain/layout/GetSupportedObjectLayouts.kt @@ -8,12 +8,12 @@ import com.anytypeio.anytype.domain.base.Either class GetSupportedObjectLayouts : BaseUseCase, GetSupportedObjectLayouts.Params>() { - override suspend fun run(params: Params): Either> = safe { + override suspend fun run(params: Params) = safe { listOf( + ObjectType.Layout.NOTE, ObjectType.Layout.BASIC, ObjectType.Layout.PROFILE, ObjectType.Layout.TODO, - ObjectType.Layout.NOTE ) } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectLayoutView.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectLayoutView.kt index 8692431de8..ceebf9dd60 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectLayoutView.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectLayoutView.kt @@ -16,8 +16,7 @@ sealed class ObjectLayoutView { data class Profile( override val id: Int, override val isSelected: Boolean - ) : - ObjectLayoutView() { + ) : ObjectLayoutView() { override fun copy(isSelected: Boolean) = copy(id = id, isSelected = isSelected) }