You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Java, the API is pretty much self explanatory:
ItemDecorationdividerDecoration = HorizontalDividerItemDecoration.Builder(this)
.sizeResId(R.dimen.item_divider_height)
.visibilityProvider(newVisibilityProvider() {
@OverridebooleanshouldHideDivider(intposition, RecyclerViewparent) {
// With the context of having the method name shown above, this is// obviously wrong.returntrue;
}
}
.build();
However, because VisibilityProvider is a SAM-type, Kotlin allows you to use a trailing closure, so the name of the method isn't shown anywhere. In this case, a user's first instinct might be to return true to show the divider and false to hide it (like I did), which is backwards:
val dividerDecoration =HorizontalDividerItemDecoration.Builder(this)
.sizeResId(R.dimen.item_divider_height)
.visibilityProvider { position, parent ->// This looked right to me (visibility -> true), but is backwards.true
}
.build()
I'd suggest inverting that API so it's more Kotlin-friendly:
When using Java, the API is pretty much self explanatory:
However, because
VisibilityProvider
is a SAM-type, Kotlin allows you to use a trailing closure, so the name of the method isn't shown anywhere. In this case, a user's first instinct might be to returntrue
to show the divider andfalse
to hide it (like I did), which is backwards:I'd suggest inverting that API so it's more Kotlin-friendly:
This issue may apply to other APIs, but I haven't run into any others yet, or had time to look.
The text was updated successfully, but these errors were encountered: