Skip to content

Commit

Permalink
feat(android): add animation to reordering lists
Browse files Browse the repository at this point in the history
  • Loading branch information
autoreleasefool committed Aug 23, 2024
1 parent 3296df6 commit 8e009d5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,6 +54,7 @@ fun AlleysList(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun LazyListScope.alleysList(
list: List<AlleyListItem>,
onAlleyClick: (AlleyListItem) -> Unit,
Expand Down Expand Up @@ -84,6 +86,7 @@ fun LazyListScope.alleysList(
SwipeableActionsBox(
startActions = listOfNotNull(deleteAction),
endActions = listOfNotNull(editAction),
modifier = Modifier.animateItemPlacement(),
) {
AlleyRow(
name = alley.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -70,6 +71,7 @@ fun BowlersList(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun LazyListScope.bowlersList(
list: List<BowlerListItem>,
onBowlerClick: (BowlerListItem) -> Unit,
Expand Down Expand Up @@ -97,6 +99,7 @@ fun LazyListScope.bowlersList(
SwipeableActionsBox(
startActions = listOf(archiveAction),
endActions = listOf(editAction),
modifier = Modifier.animateItemPlacement(),
) {
BowlerRow(
name = it.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -65,6 +66,7 @@ fun OpponentsList(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun LazyListScope.opponentsList(
list: List<OpponentListItem>,
onOpponentClick: (OpponentListItem) -> Unit,
Expand Down Expand Up @@ -92,6 +94,7 @@ fun LazyListScope.opponentsList(
SwipeableActionsBox(
startActions = listOf(archiveAction),
endActions = listOf(editAction),
modifier = Modifier.animateItemPlacement(),
) {
BowlerRow(
name = it.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -64,6 +65,7 @@ fun GamesList(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun LazyListScope.gamesList(
list: List<GameListItem>,
onGameClick: (GameListItem) -> Unit,
Expand All @@ -83,6 +85,7 @@ fun LazyListScope.gamesList(

SwipeableActionsBox(
startActions = listOf(archiveAction),
modifier = Modifier.animateItemPlacement(),
) {
GameRow(
index = it.index,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,6 +54,7 @@ fun GearList(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun LazyListScope.gearList(
list: List<GearListItem>,
onGearClick: (GearListItem) -> Unit,
Expand Down Expand Up @@ -84,6 +86,7 @@ fun LazyListScope.gearList(
SwipeableActionsBox(
startActions = listOfNotNull(deleteAction),
endActions = listOfNotNull(editAction),
modifier = Modifier.animateItemPlacement(),
) {
GearRow(
name = gear.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -66,6 +67,7 @@ fun LeaguesList(
}
}

@OptIn(ExperimentalFoundationApi::class)
fun LazyListScope.leaguesList(
list: List<LeagueListItem>,
onLeagueClick: (LeagueListItem) -> Unit,
Expand Down Expand Up @@ -93,6 +95,7 @@ fun LazyListScope.leaguesList(
SwipeableActionsBox(
startActions = listOf(archiveAction),
endActions = listOf(editAction),
modifier = Modifier.animateItemPlacement(),
) {
LeagueRow(
name = it.name,
Expand Down

0 comments on commit 8e009d5

Please sign in to comment.