-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use android.R.attr.listDivider as the default Drawable #45
Comments
Just released the version 3.2.0 which uses |
And in code, like this: RecyclerViewDivider.with(context).addTo(this) Meaning no need for this: fun RecyclerView.setDefaultDividers() {
val context = this.context
context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider)).use { typedArray ->
typedArray.getDrawable(0)
?.let { RecyclerViewDivider.with(context).drawable(it).hideLastDivider().build().addTo(this) }
}
} ? |
The You can replace this whole function: fun RecyclerView.setDefaultDividers() {
val context = this.context
context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider)).use { typedArray ->
typedArray.getDrawable(0)
?.let { RecyclerViewDivider.with(context).drawable(it).hideLastDivider().build().addTo(this) }
}
} With just: recyclerView.addDivider() Because:
|
Seems not working for me on dark theme for some reason, while working fine on normal theme. Can you test, or should I try on POC ? At least using the old method I've made seems to still work as before. |
I'll try it soon, thanks! |
Please let me know about it. |
@AndroidDeveloperLB I reproduced it and I found the line of code which causes it. DrawableCompat.setTintList(wrappedDrawable, null) This line is necessary to reset the tint of the single divider to avoid the tint color to propagate to the other dividers. Now I have to understand why it changes the |
It's very similar to this issue on Android: https://issuetracker.google.com/issues/141678225 The problem is tinting a I'll replace the call to |
OK for now I will use the previous method. It still works fine. |
Is there a shorter workaround than using what I wrote, BTW? |
You can probably change the value of |
I need in code. Anyway, please let me know when you fix this. |
Yes, I'll notify you for any update |
Thank you. If you with, this is my app that uses this repository. |
@AndroidDeveloperLB Released the version 3.2.1 containing the fix. Can you let me know if |
I think now it's indeed fixed and working well. BTW, why add extension function? |
Nice, to hear. I added the extension function to create a divider using the shortest syntax and made it more accessible for Kotlin users of this library since creating the divider is the core API of this library (other APIs like I honestly think it's more a matter of personal taste than something objective in general. (I'm closing this issue since the bug was fixed) |
OK your choice. Are there more extension functions on the library now? |
Since the version 3.2.0 (the one with new APIs) there are these 4 extensions, all 4 on
|
ok thanks. |
Related to #41
The text was updated successfully, but these errors were encountered: