1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-1075 Widgets | Fix | Do not allow expanding collection in tree widgets + Added icon for collection item in tree widgets (#3034)

This commit is contained in:
Evgenii Kozlov 2023-03-22 13:34:48 +01:00 committed by GitHub
parent 4b513fcd47
commit 1abf1db680
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 1 deletions

View file

@ -186,7 +186,13 @@ private fun TreeWidgetTreeItems(
painterResource(R.drawable.ic_widget_tree_set),
contentDescription = "Set icon",
modifier = Modifier.align(Alignment.CenterVertically)
)
}
is WidgetView.Tree.ElementIcon.Collection -> {
Image(
painterResource(R.drawable.ic_widget_tree_collection),
contentDescription = "Collection icon",
modifier = Modifier.align(Alignment.CenterVertically)
)
}
}

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M4.25,9.25L15.75,9.25A0.75,0.75 0,0 1,16.5 10L16.5,10A0.75,0.75 0,0 1,15.75 10.75L4.25,10.75A0.75,0.75 0,0 1,3.5 10L3.5,10A0.75,0.75 0,0 1,4.25 9.25z"
android:fillColor="@color/text_primary"/>
<path
android:pathData="M4.25,13.25L15.75,13.25A0.75,0.75 0,0 1,16.5 14L16.5,14A0.75,0.75 0,0 1,15.75 14.75L4.25,14.75A0.75,0.75 0,0 1,3.5 14L3.5,14A0.75,0.75 0,0 1,4.25 13.25z"
android:fillColor="@color/text_primary"/>
<path
android:pathData="M4.25,5.25L15.75,5.25A0.75,0.75 0,0 1,16.5 6L16.5,6A0.75,0.75 0,0 1,15.75 6.75L4.25,6.75A0.75,0.75 0,0 1,3.5 6L3.5,6A0.75,0.75 0,0 1,4.25 5.25z"
android:fillColor="@color/text_primary"/>
</vector>

View file

@ -202,6 +202,7 @@ class TreeWidgetContainer(
currentLinkPath: String
) = when {
obj.type.contains(ObjectTypeIds.SET) -> WidgetView.Tree.ElementIcon.Set
obj.type.contains(ObjectTypeIds.COLLECTION) -> WidgetView.Tree.ElementIcon.Collection
!isExpandable -> WidgetView.Tree.ElementIcon.Leaf
obj.links.isEmpty() -> WidgetView.Tree.ElementIcon.Leaf
else -> WidgetView.Tree.ElementIcon.Branch(

View file

@ -29,6 +29,7 @@ sealed class WidgetView {
data class Branch(val isExpanded: Boolean) : ElementIcon()
object Leaf : ElementIcon()
object Set : ElementIcon()
object Collection: ElementIcon()
}
}