mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3612 Widgets | Icon fixes (#2371)
This commit is contained in:
parent
5c090be64a
commit
1f4a1c638d
8 changed files with 41 additions and 14 deletions
|
@ -176,7 +176,9 @@ fun CompactListWidgetList(
|
|||
.padding(start = 0.dp, end = 4.dp),
|
||||
onTaskIconClicked = { isChecked ->
|
||||
onObjectCheckboxClicked(element.obj.id, isChecked)
|
||||
}
|
||||
},
|
||||
iconWithoutBackgroundMaxSize = 200.dp,
|
||||
imageMultiplier = 1.0f
|
||||
)
|
||||
Text(
|
||||
text = element.getPrettyName(),
|
||||
|
|
|
@ -170,7 +170,8 @@ private fun TreeWidgetTreeItems(
|
|||
Modifier.noRippleClickable { onWidgetElementClicked(element.obj) }
|
||||
else
|
||||
Modifier
|
||||
)
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (element.indent > 0) {
|
||||
Spacer(
|
||||
|
@ -224,6 +225,8 @@ private fun TreeWidgetTreeItems(
|
|||
ListWidgetObjectIcon(
|
||||
iconSize = 18.dp,
|
||||
icon = element.objectIcon,
|
||||
imageMultiplier = 1.0f,
|
||||
iconWithoutBackgroundMaxSize = 200.dp,
|
||||
modifier = Modifier.align(Alignment.CenterVertically).padding(start = 8.dp, end = 4.dp),
|
||||
onTaskIconClicked = { isChecked ->
|
||||
onObjectCheckboxClicked(element.id, isChecked)
|
||||
|
|
|
@ -28,6 +28,8 @@ fun ListWidgetObjectIcon(
|
|||
icon: ObjectIcon,
|
||||
modifier: Modifier,
|
||||
iconSize: Dp = 48.dp,
|
||||
imageMultiplier: Float = 0.625f,
|
||||
iconWithoutBackgroundMaxSize: Dp = 20.dp,
|
||||
onTaskIconClicked: (Boolean) -> Unit = {},
|
||||
backgroundColor: Int = R.color.shape_tertiary
|
||||
) {
|
||||
|
@ -45,7 +47,9 @@ fun ListWidgetObjectIcon(
|
|||
icon = icon,
|
||||
backgroundSize = iconSize,
|
||||
modifier = modifier,
|
||||
backgroundColor = backgroundColor
|
||||
backgroundColor = backgroundColor,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -54,6 +58,8 @@ fun ListWidgetObjectIcon(
|
|||
icon = icon,
|
||||
backgroundSize = iconSize,
|
||||
modifier = modifier,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -61,7 +67,9 @@ fun ListWidgetObjectIcon(
|
|||
BookmarkIconView(
|
||||
modifier = modifier,
|
||||
icon = icon,
|
||||
backgroundSize = iconSize
|
||||
backgroundSize = iconSize,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -95,7 +103,9 @@ fun ListWidgetObjectIcon(
|
|||
icon = icon,
|
||||
backgroundSize = iconSize,
|
||||
modifier = modifier,
|
||||
backgroundColor = backgroundColor
|
||||
backgroundColor = backgroundColor,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
|
||||
is ObjectIcon.Checkbox -> {
|
||||
|
|
|
@ -19,7 +19,9 @@ import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
|||
fun BookmarkIconView(
|
||||
modifier: Modifier = Modifier,
|
||||
icon: ObjectIcon.Bookmark,
|
||||
imageMultiplier: Float,
|
||||
backgroundSize: Dp,
|
||||
iconWithoutBackgroundMaxSize: Dp
|
||||
) {
|
||||
|
||||
val painter = rememberAsyncImagePainter(model = icon.image)
|
||||
|
@ -37,7 +39,9 @@ fun BookmarkIconView(
|
|||
TypeIconView(
|
||||
modifier = modifier,
|
||||
icon = icon.fallback,
|
||||
backgroundSize = backgroundSize
|
||||
backgroundSize = backgroundSize,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
}
|
||||
is AsyncImagePainter.State.Success -> {
|
||||
|
|
|
@ -10,7 +10,6 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil3.compose.rememberAsyncImagePainter
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
import com.anytypeio.anytype.core_ui.widgets.cornerRadius
|
||||
|
@ -22,8 +21,8 @@ fun EmojiIconView(
|
|||
modifier: Modifier = Modifier,
|
||||
icon: ObjectIcon.Basic.Emoji,
|
||||
backgroundSize: Dp,
|
||||
iconWithoutBackgroundMaxSize: Dp = 20.dp,
|
||||
imageMultiplier: Float = 0.625f,
|
||||
iconWithoutBackgroundMaxSize: Dp,
|
||||
imageMultiplier: Float,
|
||||
backgroundColor: Int = R.color.shape_tertiary
|
||||
) {
|
||||
val (containerModifier, iconModifier) = if (backgroundSize > iconWithoutBackgroundMaxSize) {
|
||||
|
@ -60,7 +59,9 @@ fun EmojiIconView(
|
|||
TypeIconView(
|
||||
modifier = modifier,
|
||||
icon = icon.fallback,
|
||||
backgroundSize = backgroundSize
|
||||
backgroundSize = backgroundSize,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
}
|
||||
}
|
|
@ -21,6 +21,8 @@ import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
|
|||
fun ImageIconView(
|
||||
modifier: Modifier = Modifier,
|
||||
icon: ObjectIcon.Basic.Image,
|
||||
imageMultiplier: Float,
|
||||
iconWithoutBackgroundMaxSize: Dp,
|
||||
backgroundSize: Dp
|
||||
) {
|
||||
|
||||
|
@ -40,7 +42,9 @@ fun ImageIconView(
|
|||
TypeIconView(
|
||||
modifier = modifier,
|
||||
icon = icon.fallback,
|
||||
backgroundSize = backgroundSize
|
||||
backgroundSize = backgroundSize,
|
||||
imageMultiplier = imageMultiplier,
|
||||
iconWithoutBackgroundMaxSize = iconWithoutBackgroundMaxSize
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ fun TypeIconView(
|
|||
modifier: Modifier = Modifier,
|
||||
icon: ObjectIcon.TypeIcon,
|
||||
backgroundSize: Dp,
|
||||
iconWithoutBackgroundMaxSize: Dp = 20.dp,
|
||||
iconWithoutBackgroundMaxSize: Dp,
|
||||
imageMultiplier: Float,
|
||||
backgroundColor: Int = R.color.shape_tertiary
|
||||
) {
|
||||
when (icon) {
|
||||
|
@ -71,6 +72,7 @@ fun TypeIconView(
|
|||
icon = ObjectIcon.Basic.Emoji(unicode = icon.unicode),
|
||||
backgroundSize = backgroundSize,
|
||||
iconWithoutBackgroundMaxSize = 120.dp,
|
||||
imageMultiplier = imageMultiplier
|
||||
)
|
||||
} else {
|
||||
val (imageVector, tint) = getDefaultIconAndTint(icon)
|
||||
|
|
|
@ -6564,9 +6564,10 @@ class EditorViewModel(
|
|||
objectTypeKey = objType.uniqueKey
|
||||
)
|
||||
).fold(
|
||||
onFailure = {
|
||||
onFailure = { error ->
|
||||
sendToast("Error while updating object type: ${error.message}")
|
||||
Timber.e(
|
||||
it,
|
||||
error,
|
||||
"Error while updating object type: [${objType.uniqueKey}]"
|
||||
)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue