Skip to content

Commit

Permalink
Not squishy animation (bounds)
Browse files Browse the repository at this point in the history
  • Loading branch information
imashnake0 committed Feb 5, 2024
1 parent 902ab9a commit d34f6fb
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import android.net.Uri
import android.text.method.LinkMovementMethod
import android.util.Log
import android.widget.TextView
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand Down Expand Up @@ -170,6 +172,17 @@ fun MediaPage(
}
)

// TODO: https://developer.android.com/jetpack/compose/animation/quick-guide#concurrent-animations
val offset by animateDpAsState(
targetValue = if (scrollState.value == 0) {
0.dp
} else {
dimensionResource(R.dimen.media_card_height) - dimensionResource(R.dimen.media_details_height)
},
animationSpec = tween(durationMillis = 750),
label = "media_card_height"
)

MediaSmall(
image = media.coverImage,
label = null,
Expand All @@ -181,11 +194,15 @@ fun MediaPage(
top = dimensionResource(R.dimen.media_details_height)
+ LocalPaddings.current.medium
+ dimensionResource(coreR.dimen.banner_height)
- WindowInsets.statusBars.asPaddingValues().calculateTopPadding()
- dimensionResource(R.dimen.media_card_height),
- WindowInsets.statusBars
.asPaddingValues()
.calculateTopPadding()
- dimensionResource(R.dimen.media_card_height)
+ offset,
start = LocalPaddings.current.large
)
.landscapeCutoutPadding()
.height(dimensionResource(R.dimen.media_card_height) - offset)
.width(dimensionResource(R.dimen.media_card_width))
)
}
Expand Down

0 comments on commit d34f6fb

Please sign in to comment.