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:
parent
4b513fcd47
commit
1abf1db680
4 changed files with 24 additions and 1 deletions
|
@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
15
core-ui/src/main/res/drawable/ic_widget_tree_collection.xml
Normal file
15
core-ui/src/main/res/drawable/ic_widget_tree_collection.xml
Normal 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>
|
|
@ -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(
|
||||
|
|
|
@ -29,6 +29,7 @@ sealed class WidgetView {
|
|||
data class Branch(val isExpanded: Boolean) : ElementIcon()
|
||||
object Leaf : ElementIcon()
|
||||
object Set : ElementIcon()
|
||||
object Collection: ElementIcon()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue