Skip to content

Commit

Permalink
Release 1.2.0 - Upgraded dependencies, Now when there's no navigation…
Browse files Browse the repository at this point in the history
…Icon, when the TopBar is expanded and its content are to the left, they will be placed on the same y axis as the topbar title
  • Loading branch information
kevingermainbusiness committed Jul 11, 2023
1 parent 8a74ffc commit e6d282b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repositories {

```groovy
dependencies {
implementation "com.github.germainkevinbusiness:CollapsingTopBarCompose:1.1.9"
implementation "com.github.germainkevinbusiness:CollapsingTopBarCompose:1.2.0"
}
```

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ dependencies {

implementation "androidx.core:core-ktx:$coreKtx"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.1'
implementation 'androidx.activity:activity-compose:1.7.2'

def composeBom = platform("androidx.compose:compose-bom:2023.04.01")
def composeBom = platform("androidx.compose:compose-bom:2023.05.01")
implementation composeBom
androidTestImplementation composeBom

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext {
coreKtx = '1.9.0'
libraryVersion ='1.1.9'
coreKtx = '1.10.1'
libraryVersion ='1.2.0'
timberVersion ='5.0.1'
}
repositories {
Expand All @@ -10,8 +10,8 @@ buildscript {

}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.1' apply false
id 'com.android.library' version '8.0.1' apply false
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import timber.log.Timber
import kotlin.math.max

/**
Expand Down Expand Up @@ -49,7 +50,7 @@ import kotlin.math.max
fun CollapsingTopBar(
modifier: Modifier = Modifier,
scrollBehavior: CollapsingTopBarScrollBehavior,
navigationIcon: @Composable () -> Unit = {},
navigationIcon: @Composable (() -> Unit)? = null,
title: @Composable () -> Unit,
expandedTitle: @Composable () -> Unit = title,
subtitle: @Composable () -> Unit = {},
Expand Down Expand Up @@ -78,7 +79,7 @@ private fun CollapsingTopBarLayout(
title: @Composable () -> Unit,
expandedTitle: @Composable () -> Unit,
subtitle: @Composable () -> Unit,
navigationIcon: @Composable () -> Unit,
navigationIcon: @Composable (() -> Unit)?,
mainAction: @Composable () -> Unit,
actions: @Composable RowScope.() -> Unit,
scrollBehavior: CollapsingTopBarScrollBehavior,
Expand Down Expand Up @@ -113,8 +114,8 @@ private fun CollapsingTopBarLayout(
.align(Alignment.TopStart)
.padding(
PaddingValues(
start = if (navigationIcon != {}) 56.dp - TopBarHorizontalPadding
else TopBarTitleInset,
start = if (navigationIcon == null) TopBarTitleInset
else 56.dp - TopBarHorizontalPadding,
end = TopBarHorizontalPadding,
)
)
Expand Down Expand Up @@ -156,7 +157,7 @@ private fun CollapsingTopBarLayout(
) {
CompositionLocalProvider(
LocalContentColor provides colors.contentColor,
content = navigationIcon
content = navigationIcon ?: {}
)
}
Box(
Expand Down Expand Up @@ -378,6 +379,7 @@ private fun simpleColumnMeasurePolicy(
Arrangement.Center -> {
(constraints.maxHeight - layoutMaxLength) / 2
}

else -> yPosition
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ internal fun CollapsingTopBarScrollBehavior.defineCurrentState() {
collapsedTopBarHeight -> {
CollapsingTopBarState.COLLAPSED
}

expandedTopBarMaxHeight -> {
CollapsingTopBarState.EXPANDED
}

else -> {
CollapsingTopBarState.MOVING
}
Expand Down

0 comments on commit e6d282b

Please sign in to comment.