Skip to content

Commit 6fc50be

Browse files
committed
Fix last icon after text not showing
1 parent 25f0f94 commit 6fc50be

File tree

2 files changed

+11
-5
lines changed
  • indicator-fast-scroll/src

2 files changed

+11
-5
lines changed

indicator-fast-scroll/src/androidTest/java/com/reddit/indicatorfastscroll/Tests.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,24 @@ class Tests {
3838
TestActivity.ListItem("K"),
3939
TestActivity.ListItem("L"),
4040
TestActivity.ListItem("M"),
41-
TestActivity.ListItem("N")
41+
TestActivity.ListItem("N"),
42+
TestActivity.ListItem("O", android.R.drawable.ic_dialog_info)
4243
)
4344
val expectedTexts = listOf(
4445
"A", "C\nD", "F\nG\nH", "J\nK\nL\nM\nN"
4546
)
47+
val expectedIconCount = items.count { it.iconRes != null }
4648

4749
activity.runOnUiThread {
4850
activity.presentData(items)
4951
}
50-
onView(withId(R.id.test_fastscroller)).check(matches(
51-
allOf(expectedTexts.map { withChild(withText(it)) })
52-
))
52+
onView(withId(R.id.test_fastscroller))
53+
.check(matches(
54+
allOf(expectedTexts.map { withChild(withText(it)) })
55+
))
56+
.check(matches(
57+
hasChildCount(expectedTexts.size + expectedIconCount)
58+
))
5359
}
5460

5561
@Test

indicator-fast-scroll/src/main/java/com/reddit/indicatorfastscroll/FastScrollerView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class FastScrollerView @JvmOverloads constructor(
233233
val viewCreators = ArrayList<() -> View>()
234234
itemIndicators.run {
235235
var index = 0
236-
while (index < lastIndex) {
236+
while (index <= lastIndex) {
237237
@Suppress("UNCHECKED_CAST")
238238
val textIndicatorsBatch = subList(index, size)
239239
.takeWhile { it is FastScrollItemIndicator.Text }

0 commit comments

Comments
 (0)