Skip to content
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

SlideToActView app:slider_icon doesn't accept databinding #156

Open
1 task
MohamedHashim opened this issue May 21, 2021 · 2 comments
Open
1 task

SlideToActView app:slider_icon doesn't accept databinding #156

MohamedHashim opened this issue May 21, 2021 · 2 comments

Comments

@MohamedHashim
Copy link

What kind of issue is this?

  • This is a functional bug :
    I tried to use databinding in app:slider_icon but it shows this message

Cannot find a setter for <com.ncorti.slidetoact.SlideToActView app:slider_icon> that accepts parameter type 'android.graphics.drawable.Drawable'
If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.

Details

  • Library Version : 0.9.0.
  • Example Code :

<com.ncorti.slidetoact.SlideToActView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:outer_color="@color/azul_two"
app:rotate_icon="false"
app:slider_height="44dp"
app:slider_icon="@{modelView.checkinType == true? @drawable/ic_check_in: @drawable/ic_check_out}"
app:slider_icon_color="@color/black"
/>

@MohamedHashim MohamedHashim changed the title SlideToActView app:slider icon doesn't accept databinding SlideToActView app:slider_icon doesn't accept databinding May 21, 2021
@cortinico
Copy link
Owner

Thanks for the report

Cannot find a setter for <com.ncorti.slidetoact.SlideToActView app:slider_icon> that accepts parameter type 'android.graphics.drawable.Drawable'
If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.

That's indeed true. The setter for slider_icon is of type Int and not Drawable:

/** Custom Slider Icon */
@DrawableRes
var sliderIcon: Int = R.drawable.slidetoact_ic_arrow
set(value) {
field = value
if (field != 0) {
ResourcesCompat.getDrawable(context.resources, value, context.theme)?.let {
mDrawableArrow = it
DrawableCompat.setTint(it, iconColor)
}
invalidate()
}
}

I'm unsure what would be the best approach to offer better support for Databinding here. Perhaps we need another setter of type Drawable.

Happy to review a PR if someone has the time to look into this 👍

@MohamedHashim
Copy link
Author

Thank you for your response, I'll try to look into this if I have some free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants