Skip to content

Commit

Permalink
Merge pull request #253 from rubensousa/1.4.0-alpha03
Browse files Browse the repository at this point in the history
Make header visible by default
  • Loading branch information
rubensousa authored Aug 14, 2024
2 parents b377caa + 99f008a commit f24ba3c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Version 1.4.0

### 1.4.0-alpha03

2024-08-14

#### Bug fixes

- Fix header not being initially shown sometimes with `DpadScrollableLayout` ([#253](https://github.com/rubensousa/DpadRecyclerView/pull/253))


### 1.4.0-alpha02

2024-08-14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,33 @@ class DpadScrollableLayoutTest {
Rect(0, headerHeight / 2, screenWidth, headerHeight / 2 + headerHeight)
)
assertThat(recyclerViewBounds).isEqualTo(
Rect(0, headerHeight / 2 + headerHeight, screenWidth, screenHeight + headerHeight / 2 + headerHeight)
Rect(
0,
headerHeight / 2 + headerHeight,
screenWidth,
screenHeight + headerHeight / 2 + headerHeight
)
)
}

@Test
fun testHeaderIsVisibleByDefault() {
// given
val headerHeight = getHeaderHeight()
val screenWidth = getWidth()
var actualVisibility = false

// when
fragmentScenario.onFragment { fragment ->
actualVisibility = fragment.scrollableLayout?.isHeaderVisible ?: false
}

// then
val header1Bounds = getViewBounds(R.id.header1)
assertThat(header1Bounds).isEqualTo(
Rect(0, 0, screenWidth, headerHeight)
)
assertThat(actualVisibility).isTrue()
}

private fun waitViewAtCoordinates(viewId: Int, top: Int, bottom: Int, timeout: Long = 4L) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DpadScrollableLayout @JvmOverloads constructor(
var headerHeight = 0
private set

var isHeaderVisible = false
var isHeaderVisible = true
private set

private var currentOffset = 0
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.enableR8.fullMode=true
LIBRARY_VERSION=1.4.0-alpha02
LIBRARY_VERSION=1.4.0-alpha03
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ theme:

extra:
dpadrecyclerview:
version: '1.4.0-alpha02'
version: '1.4.0-alpha03'
social:
- icon: 'fontawesome/brands/github'
link: 'https://github.com/rubensousa/DpadRecyclerView'
Expand Down

0 comments on commit f24ba3c

Please sign in to comment.