Skip to content

Commit

Permalink
Make header visible by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Aug 14, 2024
1 parent 36efc8c commit 0bca453
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
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

0 comments on commit 0bca453

Please sign in to comment.