Skip to content

Commit

Permalink
1.0.0-alpha08 release version with good integration with Material 3
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingermainbusiness committed May 31, 2022
1 parent b681fdf commit 83805d5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repositories {

```groovy
dependencies {
implementation 'com.github.germainkevinbusiness:CollapsingTopBarCompose:1.0.0-alpha07'
implementation 'com.github.germainkevinbusiness:CollapsingTopBarCompose:1.0.0-alpha08'
}
```

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0.0-alpha07"
versionName "1.0.0-alpha08"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class MainActivity : ComponentActivity() {
val scrollBehavior = remember {
CollapsingTopBarDefaults.scrollBehavior(
isAlwaysCollapsed = false,
isExpandedWhenFirstDisplayed = false,
isExpandedWhenFirstDisplayed = true,
expandedTopBarMaxHeight = 256.dp,
)
}
Expand Down
2 changes: 1 addition & 1 deletion collapsingtopbar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ afterEvaluate {
// You can then customize attributes of the publication as shown below.
groupId = 'com.germainkevin.collapsingtopbarcompose'
artifactId = 'collapsingtopbarcompose'
version = '1.0.0-alpha07'
version = '1.0.0-alpha08'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import androidx.compose.ui.unit.dp
* @param centeredTitleAndSubtitle Whether the [title] and [subtitle] section should be centered or
* at the start of the [CollapsingTopBar]
* @param colors [CollapsingTopBarColors] that will be used to resolve the colors used for this
* [CollapsingTopBar] in different states. See [CollapsingTopBarDefaults.collapsingTopBarColors].
* [CollapsingTopBar] in different states. See [CollapsingTopBarDefaults.colors].
* @param contentPadding The padding of the content inside the [CollapsingTopBar]
* @param elevation The size of the shadow below the [Surface]
* @param scrollBehavior [TopBarScrollBehavior] which holds certain values that will be applied by
Expand All @@ -56,7 +56,7 @@ fun CollapsingTopBar(
// Make sure the trackOffSetIsZero variable does not exceed the number 10
if (trackOffSetIsZero > 10) trackOffSetIsZero = 3
currentTopBarHeight = expandedTopBarMaxHeight + topBarOffset.dp
} else if (isExpandedWhenFirstDisplayed) {
} else if (isExpandedWhenFirstDisplayed && !isAlwaysCollapsed) {
currentTopBarHeight = expandedTopBarMaxHeight + topBarOffset.dp
}

Expand Down Expand Up @@ -118,7 +118,7 @@ fun CollapsingTopBar(
* @param actions the actions displayed at the end of the [CollapsingTopBar]. This should typically
* be [IconButton]s. The default layout here is a [Row], so icons inside will be placed horizontally.
* @param colors [CollapsingTopBarColors] that will be used to resolve the colors used for this
* [CollapsingTopBar] in different states. See [CollapsingTopBarDefaults.collapsingTopBarColors].
* [CollapsingTopBar] in different states. See [CollapsingTopBarDefaults.colors].
* @param contentPadding The padding of the content inside the [CollapsingTopBar]
* @param elevation The size of the shadow below the [Surface]
* @param currentTopBarHeight The current height of the [CollapsingTopBar]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ class DefaultBehaviorOnScroll(
override var trackOffSetIsZero: Int by mutableStateOf(0)

override var currentTopBarHeight: Dp by mutableStateOf(
if (isAlwaysCollapsed) collapsedTopBarHeight
else if (!isExpandedWhenFirstDisplayed) collapsedTopBarHeight
if (isAlwaysCollapsed && isExpandedWhenFirstDisplayed) collapsedTopBarHeight
else if (isAlwaysCollapsed && !isExpandedWhenFirstDisplayed) collapsedTopBarHeight
else if (!isAlwaysCollapsed && !isExpandedWhenFirstDisplayed) collapsedTopBarHeight
else if (!isAlwaysCollapsed && isExpandedWhenFirstDisplayed) expandedTopBarMaxHeight
else expandedTopBarMaxHeight
)
Expand Down

0 comments on commit 83805d5

Please sign in to comment.