From 8e009d5495cc68472aa2693ccbec1599678013a7 Mon Sep 17 00:00:00 2001 From: Joseph Roque Date: Thu, 22 Aug 2024 21:21:46 -0700 Subject: [PATCH] feat(android): add animation to reordering lists --- .../bowlingcompanion/feature/alleyslist/ui/AlleysList.kt | 3 +++ .../bowlingcompanion/feature/bowlerslist/ui/BowlersList.kt | 3 +++ .../bowlingcompanion/feature/bowlerslist/ui/OpponentsList.kt | 3 +++ .../bowlingcompanion/feature/gameslist/ui/GamesList.kt | 3 +++ .../bowlingcompanion/feature/gearlist/ui/GearList.kt | 3 +++ .../bowlingcompanion/feature/leagueslist/ui/LeaguesList.kt | 3 +++ 6 files changed, 18 insertions(+) diff --git a/android/feature/alleyslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/alleyslist/ui/AlleysList.kt b/android/feature/alleyslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/alleyslist/ui/AlleysList.kt index b49f7692c..9460be9e9 100644 --- a/android/feature/alleyslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/alleyslist/ui/AlleysList.kt +++ b/android/feature/alleyslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/alleyslist/ui/AlleysList.kt @@ -1,5 +1,6 @@ package ca.josephroque.bowlingcompanion.feature.alleyslist.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items @@ -53,6 +54,7 @@ fun AlleysList( } } +@OptIn(ExperimentalFoundationApi::class) fun LazyListScope.alleysList( list: List, onAlleyClick: (AlleyListItem) -> Unit, @@ -84,6 +86,7 @@ fun LazyListScope.alleysList( SwipeableActionsBox( startActions = listOfNotNull(deleteAction), endActions = listOfNotNull(editAction), + modifier = Modifier.animateItemPlacement(), ) { AlleyRow( name = alley.name, diff --git a/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/BowlersList.kt b/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/BowlersList.kt index 07445600d..60a2ded91 100644 --- a/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/BowlersList.kt +++ b/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/BowlersList.kt @@ -1,5 +1,6 @@ package ca.josephroque.bowlingcompanion.feature.bowlerslist.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyItemScope @@ -70,6 +71,7 @@ fun BowlersList( } } +@OptIn(ExperimentalFoundationApi::class) fun LazyListScope.bowlersList( list: List, onBowlerClick: (BowlerListItem) -> Unit, @@ -97,6 +99,7 @@ fun LazyListScope.bowlersList( SwipeableActionsBox( startActions = listOf(archiveAction), endActions = listOf(editAction), + modifier = Modifier.animateItemPlacement(), ) { BowlerRow( name = it.name, diff --git a/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/OpponentsList.kt b/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/OpponentsList.kt index 75e8487fd..e6217ad8c 100644 --- a/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/OpponentsList.kt +++ b/android/feature/bowlerslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/bowlerslist/ui/OpponentsList.kt @@ -1,5 +1,6 @@ package ca.josephroque.bowlingcompanion.feature.bowlerslist.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.foundation.lazy.LazyListScope @@ -65,6 +66,7 @@ fun OpponentsList( } } +@OptIn(ExperimentalFoundationApi::class) fun LazyListScope.opponentsList( list: List, onOpponentClick: (OpponentListItem) -> Unit, @@ -92,6 +94,7 @@ fun LazyListScope.opponentsList( SwipeableActionsBox( startActions = listOf(archiveAction), endActions = listOf(editAction), + modifier = Modifier.animateItemPlacement(), ) { BowlerRow( name = it.name, diff --git a/android/feature/gameslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gameslist/ui/GamesList.kt b/android/feature/gameslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gameslist/ui/GamesList.kt index f640bc2ea..0bd5515ed 100644 --- a/android/feature/gameslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gameslist/ui/GamesList.kt +++ b/android/feature/gameslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gameslist/ui/GamesList.kt @@ -1,5 +1,6 @@ package ca.josephroque.bowlingcompanion.feature.gameslist.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.foundation.lazy.LazyListScope @@ -64,6 +65,7 @@ fun GamesList( } } +@OptIn(ExperimentalFoundationApi::class) fun LazyListScope.gamesList( list: List, onGameClick: (GameListItem) -> Unit, @@ -83,6 +85,7 @@ fun LazyListScope.gamesList( SwipeableActionsBox( startActions = listOf(archiveAction), + modifier = Modifier.animateItemPlacement(), ) { GameRow( index = it.index, diff --git a/android/feature/gearlist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gearlist/ui/GearList.kt b/android/feature/gearlist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gearlist/ui/GearList.kt index 6744c96c1..4764bbfd0 100644 --- a/android/feature/gearlist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gearlist/ui/GearList.kt +++ b/android/feature/gearlist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/gearlist/ui/GearList.kt @@ -1,5 +1,6 @@ package ca.josephroque.bowlingcompanion.feature.gearlist.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.items @@ -53,6 +54,7 @@ fun GearList( } } +@OptIn(ExperimentalFoundationApi::class) fun LazyListScope.gearList( list: List, onGearClick: (GearListItem) -> Unit, @@ -84,6 +86,7 @@ fun LazyListScope.gearList( SwipeableActionsBox( startActions = listOfNotNull(deleteAction), endActions = listOfNotNull(editAction), + modifier = Modifier.animateItemPlacement(), ) { GearRow( name = gear.name, diff --git a/android/feature/leagueslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/leagueslist/ui/LeaguesList.kt b/android/feature/leagueslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/leagueslist/ui/LeaguesList.kt index 2f758e55e..38f5ab553 100644 --- a/android/feature/leagueslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/leagueslist/ui/LeaguesList.kt +++ b/android/feature/leagueslist/ui/src/main/java/ca/josephroque/bowlingcompanion/feature/leagueslist/ui/LeaguesList.kt @@ -1,5 +1,6 @@ package ca.josephroque.bowlingcompanion.feature.leagueslist.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.foundation.lazy.LazyListScope @@ -66,6 +67,7 @@ fun LeaguesList( } } +@OptIn(ExperimentalFoundationApi::class) fun LazyListScope.leaguesList( list: List, onLeagueClick: (LeagueListItem) -> Unit, @@ -93,6 +95,7 @@ fun LazyListScope.leaguesList( SwipeableActionsBox( startActions = listOf(archiveAction), endActions = listOf(editAction), + modifier = Modifier.animateItemPlacement(), ) { LeagueRow( name = it.name,