Skip to content

Commit

Permalink
isExpanded added, version change.
Browse files Browse the repository at this point in the history
  • Loading branch information
commandiron committed Oct 13, 2022
1 parent 7dd1f37 commit e9535ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MainActivity : ComponentActivity() {
initialHorizontalPadding = 64.dp,
initialWidth = 240.dp,
targetWidth = maxWidth,
mainContent = { page ->
mainContent = { page, isExpanded ->
AsyncImage(
modifier = Modifier.fillMaxSize(),
model = ImageRequest.Builder(LocalContext.current)
Expand Down
2 changes: 1 addition & 1 deletion expandable-horizontal-pager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ afterEvaluate {

groupId = 'com.git.luolix.topmandiron'
artifactId = 'expandable-horizontal-pager'
version = '1.0.6'
version = '1.0.7'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun ExpandableHorizontalPager(
targetWidth: Dp = 300.dp,
aspectRatio: Float = 2 / 3f,
durationMillis: Int = 400,
mainContent: @Composable ColumnScope.(page: Int) -> Unit,
mainContent: @Composable ColumnScope.(page: Int, isExpanded: Boolean) -> Unit,
overMainContentCollapsed: @Composable ColumnScope.(page: Int) -> Unit,
overMainContentExpanded: @Composable ColumnScope.(page: Int) -> Unit,
hiddenContentBoxHeight: Dp = Dp.Unspecified,
Expand Down Expand Up @@ -288,14 +288,14 @@ fun ExpandableHorizontalPager(
shape = RoundedCornerShape(cornerSize)
) {
Box() {
val isExpanded = transformState == ExpandablePagerTransformState.TARGET ||
transformState == ExpandablePagerTransformState.INITIAL_TO_TARGET
Column() {
mainContent(page)
mainContent(page, isExpanded)
}
val isExpand = transformState == ExpandablePagerTransformState.TARGET ||
transformState == ExpandablePagerTransformState.INITIAL_TO_TARGET
Column() {
AnimatedVisibility(
visible = !isExpand,
visible = !isExpanded,
enter = fadeIn(tween(durationMillis)),
exit = fadeOut(tween(durationMillis))
) {
Expand All @@ -304,7 +304,7 @@ fun ExpandableHorizontalPager(
}
Column() {
AnimatedVisibility(
visible = isExpand,
visible = isExpanded,
enter = fadeIn(tween(durationMillis)),
exit = fadeOut(tween(durationMillis))
) {
Expand Down

0 comments on commit e9535ef

Please sign in to comment.