From 2ee309eb48b13d1d9516443383bff98898709f6c Mon Sep 17 00:00:00 2001 From: Mikhail Date: Mon, 15 Aug 2022 20:24:55 +0300 Subject: [PATCH] DROID-314 Dashboard | Fix | Show untitled for an empty new object (#2514) --- .../core_ui/features/objects/holders/ObjectTypeHolder.kt | 2 +- .../core_ui/widgets/FeaturedRelationGroupWidget.kt | 8 +++++++- core-ui/src/main/res/layout/item_object_type_item.xml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectTypeHolder.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectTypeHolder.kt index da2ad9d97e..23df44eb10 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectTypeHolder.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/objects/holders/ObjectTypeHolder.kt @@ -20,7 +20,7 @@ class ObjectTypeHolder( image = null, name = item.name ) - tvTitle.text = if (item.name == "") "Untitled" else item.name + tvTitle.text = item.name if (item.description.isNullOrBlank()) { tvSubtitle.gone() } else { diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/FeaturedRelationGroupWidget.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/FeaturedRelationGroupWidget.kt index 71e0a78794..fdd70bdd42 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/FeaturedRelationGroupWidget.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/FeaturedRelationGroupWidget.kt @@ -192,7 +192,12 @@ class FeaturedRelationGroupWidget : ConstraintLayout { if (color != null) { setTextColor(resources.dark(color, defaultTextColor)) setBackgroundResource(R.drawable.rect_dv_cell_tag_item) - background.setDrawableColor(resources.light(color, defaultBackground)) + background.setDrawableColor( + resources.light( + color, + defaultBackground + ) + ) } else { setTextColor(defaultTextColor) setBackgroundResource(R.drawable.rect_dv_cell_tag_item) @@ -215,6 +220,7 @@ class FeaturedRelationGroupWidget : ConstraintLayout { is DocumentRelationView.ObjectType -> { val view = TextView(context).apply { id = generateViewId() + hint = context.resources.getString(R.string.untitled) text = relation.name isSingleLine = true maxLines = 1 diff --git a/core-ui/src/main/res/layout/item_object_type_item.xml b/core-ui/src/main/res/layout/item_object_type_item.xml index 1d1989b309..00d91c1947 100644 --- a/core-ui/src/main/res/layout/item_object_type_item.xml +++ b/core-ui/src/main/res/layout/item_object_type_item.xml @@ -26,6 +26,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="12dp" + android:hint="@string/untitled" app:layout_constraintBottom_toTopOf="@+id/tvSubtitle" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.5"