Skip to content

Commit 3b35e3c

Browse files
leandroBorgesFerreiraLeandro Ferreira
andauthored
Removing folder transition (Writeopia#410)
* Removing folder transition * ktlint * version --------- Co-authored-by: Leandro Ferreira <[email protected]>
1 parent 7c2984b commit 3b35e3c

4 files changed

Lines changed: 107 additions & 106 deletions

File tree

application/core/resources/src/commonMain/composeResources/values-en/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<string name="download_models">Download Model</string>
5252
<string name="suggestions">Suggestions:</string>
5353
<string name="error_model_download">Error when downloading model.</string>
54-
<string name="version">"Version: alpha36 - Amado, Jorge"</string>
54+
<string name="version">"Version: alpha38 - Amado, Jorge"</string>
5555
<string name="light_theme">Light</string>
5656
<string name="dark_theme">Dark</string>
5757
<string name="system_theme">System</string>

application/core/resources/src/commonMain/composeResources/values-pt/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<string name="download_models">Baixar modelos</string>
5252
<string name="suggestions">Sugestões:</string>
5353
<string name="error_model_download">Error ao baixar modelo.</string>
54-
<string name="version">"Versão: alpha36 - Amado, Jorge"</string>
54+
<string name="version">"Versão: alpha38 - Amado, Jorge"</string>
5555
<string name="light_theme">Claro</string>
5656
<string name="dark_theme">Escuro</string>
5757
<string name="system_theme">Sistema</string>

application/core/resources/src/commonMain/composeResources/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<string name="download_models">Download Model</string>
5454
<string name="suggestions">Suggestions:</string>
5555
<string name="error_model_download">Error when downloading model.</string>
56-
<string name="version">Version: alpha36 - Amado, Jorge</string>
56+
<string name="version">Version: alpha38 - Amado, Jorge</string>
5757
<string name="light_theme">Light</string>
5858
<string name="dark_theme">Dark</string>
5959
<string name="system_theme">System</string>

application/features/note_menu/src/commonMain/kotlin/io/writeopia/notemenu/ui/screen/documents/NoteItems.kt

Lines changed: 104 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -434,127 +434,128 @@ private fun FolderItem(
434434
onDragIconClick: () -> Unit,
435435
modifier: Modifier = Modifier,
436436
) {
437-
sharedTransitionScope.run {
438-
Box(
439-
shadowModifier().sharedBounds(
440-
rememberSharedContentState(key = "folderTransition${folderUi.documentId}"),
441-
animatedVisibilityScope = animatedVisibilityScope,
442-
resizeMode = SharedTransitionScope.ResizeMode.RemeasureToBounds
443-
)
444-
) {
445-
DropTarget { inBound, data ->
446-
val menuItemUI = data?.info as? MenuItemUi
447-
if (inBound && menuItemUI != null) {
448-
LaunchedEffect(menuItemUI) {
449-
moveRequest(menuItemUI, folderUi.documentId)
450-
}
437+
// sharedTransitionScope.run {
438+
Box(
439+
shadowModifier()
440+
// .sharedBounds(
441+
// rememberSharedContentState(key = "folderTransition${folderUi.documentId}"),
442+
// animatedVisibilityScope = animatedVisibilityScope,
443+
// resizeMode = SharedTransitionScope.ResizeMode.RemeasureToBounds
444+
// )
445+
) {
446+
DropTarget { inBound, data ->
447+
val menuItemUI = data?.info as? MenuItemUi
448+
if (inBound && menuItemUI != null) {
449+
LaunchedEffect(menuItemUI) {
450+
moveRequest(menuItemUI, folderUi.documentId)
451451
}
452+
}
452453

453-
val bgColor =
454-
when {
455-
inBound && menuItemUI?.id != folderUi.id -> WriteopiaTheme.colorScheme.highlight
456-
folderUi.selected -> WriteopiaTheme.colorScheme.selectedBg
457-
else -> WriteopiaTheme.colorScheme.cardBg
458-
}
454+
val bgColor =
455+
when {
456+
inBound && menuItemUI?.id != folderUi.id -> WriteopiaTheme.colorScheme.highlight
457+
folderUi.selected -> WriteopiaTheme.colorScheme.selectedBg
458+
else -> WriteopiaTheme.colorScheme.cardBg
459+
}
460+
461+
val textColor = WriteopiaTheme.colorScheme.textLight
459462

460-
val textColor = WriteopiaTheme.colorScheme.textLight
461-
462-
SwipeBox(
463-
modifier = modifier
464-
.fillMaxWidth()
465-
.background(WriteopiaTheme.colorScheme.cardPlaceHolderBackground)
466-
.clip(MaterialTheme.shapes.large)
467-
.clickable {
468-
folderClick(folderUi.documentId)
469-
},
470-
isOnEditState = folderUi.selected,
471-
swipeListener = { state ->
472-
selectionListener(folderUi.documentId, state)
463+
SwipeBox(
464+
modifier = modifier
465+
.fillMaxWidth()
466+
.background(WriteopiaTheme.colorScheme.cardPlaceHolderBackground)
467+
.clip(MaterialTheme.shapes.large)
468+
.clickable {
469+
folderClick(folderUi.documentId)
473470
},
474-
cornersShape = MaterialTheme.shapes.large,
475-
defaultColor = WriteopiaTheme.colorScheme.cardBg,
476-
activeColor = bgColor,
477-
activeBorderColor = MaterialTheme.colorScheme.primary
471+
isOnEditState = folderUi.selected,
472+
swipeListener = { state ->
473+
selectionListener(folderUi.documentId, state)
474+
},
475+
cornersShape = MaterialTheme.shapes.large,
476+
defaultColor = WriteopiaTheme.colorScheme.cardBg,
477+
activeColor = bgColor,
478+
activeBorderColor = MaterialTheme.colorScheme.primary
479+
) {
480+
DragCardTarget(
481+
modifier = modifier.clip(MaterialTheme.shapes.large),
482+
position = position,
483+
dataToDrop = DropInfo(folderUi, position),
484+
iconTintOnHover = MaterialTheme.colorScheme.onBackground,
485+
onIconClick = onDragIconClick,
478486
) {
479-
DragCardTarget(
480-
modifier = modifier.clip(MaterialTheme.shapes.large),
481-
position = position,
482-
dataToDrop = DropInfo(folderUi, position),
483-
iconTintOnHover = MaterialTheme.colorScheme.onBackground,
484-
onIconClick = onDragIconClick,
487+
Column(
488+
modifier = Modifier
489+
.background(color = bgColor, shape = MaterialTheme.shapes.large)
490+
.fillMaxWidth()
491+
.padding(bottom = 26.dp, top = 10.dp)
492+
.align(Alignment.Center),
493+
horizontalAlignment = Alignment.CenterHorizontally
485494
) {
486-
Column(
487-
modifier = Modifier
488-
.background(color = bgColor, shape = MaterialTheme.shapes.large)
489-
.fillMaxWidth()
490-
.padding(bottom = 26.dp, top = 10.dp)
491-
.align(Alignment.Center),
492-
horizontalAlignment = Alignment.CenterHorizontally
493-
) {
494-
var showIconsOptions by remember { mutableStateOf(false) }
495-
val tint = folderUi.icon?.tint?.let(::Color)
496-
?: MaterialTheme.colorScheme.primary
497-
498-
Icon(
499-
modifier = Modifier
500-
.padding(6.dp)
501-
.clip(MaterialTheme.shapes.large)
502-
.clickable { showIconsOptions = !showIconsOptions }
503-
.size(56.dp)
504-
.padding(6.dp),
505-
imageVector = folderUi.icon?.label?.let(WrIcons::fromName)
506-
?: folder,
507-
contentDescription = "Folder",
508-
tint = tint
509-
)
495+
var showIconsOptions by remember { mutableStateOf(false) }
496+
val tint = folderUi.icon?.tint?.let(::Color)
497+
?: MaterialTheme.colorScheme.primary
510498

511-
DropdownMenu(
512-
expanded = showIconsOptions,
513-
onDismissRequest = { showIconsOptions = false },
514-
modifier = Modifier.background(WriteopiaTheme.colorScheme.cardBg),
515-
) {
516-
IconsPicker(
517-
iconSelect = { icon, tint ->
518-
changeIcon(
519-
folderUi.id,
520-
icon,
521-
tint
522-
)
523-
}
524-
)
525-
}
499+
Icon(
500+
modifier = Modifier
501+
.padding(6.dp)
502+
.clip(MaterialTheme.shapes.large)
503+
.clickable { showIconsOptions = !showIconsOptions }
504+
.size(56.dp)
505+
.padding(6.dp),
506+
imageVector = folderUi.icon?.label?.let(WrIcons::fromName)
507+
?: folder,
508+
contentDescription = "Folder",
509+
tint = tint
510+
)
526511

527-
Text(
528-
modifier = Modifier.padding(horizontal = 12.dp),
529-
text = folderUi.title,
530-
color = textColor,
531-
fontWeight = FontWeight.Bold,
532-
maxLines = 1,
533-
overflow = TextOverflow.Ellipsis
512+
DropdownMenu(
513+
expanded = showIconsOptions,
514+
onDismissRequest = { showIconsOptions = false },
515+
modifier = Modifier.background(WriteopiaTheme.colorScheme.cardBg),
516+
) {
517+
IconsPicker(
518+
iconSelect = { icon, tint ->
519+
changeIcon(
520+
folderUi.id,
521+
icon,
522+
tint
523+
)
524+
}
534525
)
526+
}
535527

536-
Spacer(modifier = Modifier.height(4.dp))
528+
Text(
529+
modifier = Modifier.padding(horizontal = 12.dp),
530+
text = folderUi.title,
531+
color = textColor,
532+
fontWeight = FontWeight.Bold,
533+
maxLines = 1,
534+
overflow = TextOverflow.Ellipsis
535+
)
537536

538-
Text(
539-
text = "${folderUi.itemsCount} items",
540-
color = textColor,
541-
style = MaterialTheme.typography.bodySmall
542-
)
543-
}
544-
}
537+
Spacer(modifier = Modifier.height(4.dp))
545538

546-
if (folderUi.isFavorite) {
547-
Icon(
548-
modifier = Modifier.align(Alignment.TopEnd).size(40.dp).padding(12.dp),
549-
imageVector = WrIcons.favorites,
550-
contentDescription = "Favorite",
551-
tint = MaterialTheme.colorScheme.onBackground
539+
Text(
540+
text = "${folderUi.itemsCount} items",
541+
color = textColor,
542+
style = MaterialTheme.typography.bodySmall
552543
)
553544
}
554545
}
546+
547+
if (folderUi.isFavorite) {
548+
Icon(
549+
modifier = Modifier.align(Alignment.TopEnd).size(40.dp).padding(12.dp),
550+
imageVector = WrIcons.favorites,
551+
contentDescription = "Favorite",
552+
tint = MaterialTheme.colorScheme.onBackground
553+
)
554+
}
555555
}
556556
}
557557
}
558+
// }
558559
}
559560

560561
@OptIn(ExperimentalSharedTransitionApi::class)

0 commit comments

Comments
 (0)