Skip to content

Commit

Permalink
Added animation for dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyassp002 committed Jan 9, 2025
1 parent ed96566 commit 02b9c36
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.listenbrainz.android.ui.screens.brainzplayer.overview

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -88,7 +93,11 @@ fun AlbumsOverViewScreen(
onPlayIconClick(album)
}
)
if (expandedAlbum == album) {
AnimatedVisibility(
visible = expandedAlbum == album,
enter = fadeIn() + expandVertically(),
exit = fadeOut() + shrinkVertically()
) {
val albumSongs = albumSongsMap[album]!!.sortedBy { it.trackNumber }
Row(modifier = Modifier.fillMaxWidth()) {
Spacer(modifier = Modifier.weight(0.5f))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.listenbrainz.android.ui.screens.brainzplayer.overview

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -111,7 +116,11 @@ fun ArtistsOverviewScreen(
onDropdownIconClick = { dropdownState = Pair(i, j - 1) },
dropDownState = dropdownState == Pair(i, j - 1)
)
if (expandedArtist == artist) {
AnimatedVisibility(
visible = expandedArtist == artist,
enter = fadeIn() + expandVertically(),
exit = fadeOut() + shrinkVertically()
) {
Row(modifier = Modifier.fillMaxWidth()) {
Spacer(modifier = Modifier.weight(0.5f))
Column(
Expand Down

0 comments on commit 02b9c36

Please sign in to comment.