Skip to content

Commit e6d282b

Browse files
Release 1.2.0 - Upgraded dependencies, Now when there's no navigationIcon, 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
1 parent 8a74ffc commit e6d282b

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ repositories {
3737

3838
```groovy
3939
dependencies {
40-
implementation "com.github.germainkevinbusiness:CollapsingTopBarCompose:1.1.9"
40+
implementation "com.github.germainkevinbusiness:CollapsingTopBarCompose:1.2.0"
4141
}
4242
```
4343

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ dependencies {
5353

5454
implementation "androidx.core:core-ktx:$coreKtx"
5555
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
56-
implementation 'androidx.activity:activity-compose:1.7.1'
56+
implementation 'androidx.activity:activity-compose:1.7.2'
5757

58-
def composeBom = platform("androidx.compose:compose-bom:2023.04.01")
58+
def composeBom = platform("androidx.compose:compose-bom:2023.05.01")
5959
implementation composeBom
6060
androidTestImplementation composeBom
6161

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
22
ext {
3-
coreKtx = '1.9.0'
4-
libraryVersion ='1.1.9'
3+
coreKtx = '1.10.1'
4+
libraryVersion ='1.2.0'
55
timberVersion ='5.0.1'
66
}
77
repositories {
@@ -10,8 +10,8 @@ buildscript {
1010

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

collapsingtopbar/src/main/java/com/germainkevin/collapsingtopbar/CollapsingTopBar.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import androidx.compose.ui.platform.LocalDensity
1313
import androidx.compose.ui.unit.Constraints
1414
import androidx.compose.ui.unit.Dp
1515
import androidx.compose.ui.unit.dp
16+
import timber.log.Timber
1617
import kotlin.math.max
1718

1819
/**
@@ -49,7 +50,7 @@ import kotlin.math.max
4950
fun CollapsingTopBar(
5051
modifier: Modifier = Modifier,
5152
scrollBehavior: CollapsingTopBarScrollBehavior,
52-
navigationIcon: @Composable () -> Unit = {},
53+
navigationIcon: @Composable (() -> Unit)? = null,
5354
title: @Composable () -> Unit,
5455
expandedTitle: @Composable () -> Unit = title,
5556
subtitle: @Composable () -> Unit = {},
@@ -78,7 +79,7 @@ private fun CollapsingTopBarLayout(
7879
title: @Composable () -> Unit,
7980
expandedTitle: @Composable () -> Unit,
8081
subtitle: @Composable () -> Unit,
81-
navigationIcon: @Composable () -> Unit,
82+
navigationIcon: @Composable (() -> Unit)?,
8283
mainAction: @Composable () -> Unit,
8384
actions: @Composable RowScope.() -> Unit,
8485
scrollBehavior: CollapsingTopBarScrollBehavior,
@@ -113,8 +114,8 @@ private fun CollapsingTopBarLayout(
113114
.align(Alignment.TopStart)
114115
.padding(
115116
PaddingValues(
116-
start = if (navigationIcon != {}) 56.dp - TopBarHorizontalPadding
117-
else TopBarTitleInset,
117+
start = if (navigationIcon == null) TopBarTitleInset
118+
else 56.dp - TopBarHorizontalPadding,
118119
end = TopBarHorizontalPadding,
119120
)
120121
)
@@ -156,7 +157,7 @@ private fun CollapsingTopBarLayout(
156157
) {
157158
CompositionLocalProvider(
158159
LocalContentColor provides colors.contentColor,
159-
content = navigationIcon
160+
content = navigationIcon ?: {}
160161
)
161162
}
162163
Box(
@@ -378,6 +379,7 @@ private fun simpleColumnMeasurePolicy(
378379
Arrangement.Center -> {
379380
(constraints.maxHeight - layoutMaxLength) / 2
380381
}
382+
381383
else -> yPosition
382384
}
383385
)

collapsingtopbar/src/main/java/com/germainkevin/collapsingtopbar/Internal&PrivateValues.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ internal fun CollapsingTopBarScrollBehavior.defineCurrentState() {
209209
collapsedTopBarHeight -> {
210210
CollapsingTopBarState.COLLAPSED
211211
}
212+
212213
expandedTopBarMaxHeight -> {
213214
CollapsingTopBarState.EXPANDED
214215
}
216+
215217
else -> {
216218
CollapsingTopBarState.MOVING
217219
}

0 commit comments

Comments
 (0)