Open doohab opened 3 years ago
I needed to call invalidate()
, although this just shows the checkmark suddenly not animating it, but better than nothing :),
I guess this should be mentioned ..
Kotlin:
binding.slider.onSlideCompleteListener = object : SlideToActView.OnSlideCompleteListener { override fun onSlideComplete(view: SlideToActView) { view.invalidate() } }
It asks for String not drawable.
What you mean "it asks for String"? The type of this attribute is set the reference
so it will work correctly if you set it as:
<com.ncorti.slidetoact.SlideToActView
android:id="@+id/slide_custom_icon"
app:complete_icon="@drawable/custom_complete_animated"/>
Also, setting this in code not working, no animation at slide completed:
Can you provide a reproducer? The sample app has exactly this code and it works fine:
I needed to call invalidate(), although this just shows the checkmark suddenly not animating it, but better than nothing :), I guess this should be mentioned ..
The checkmark is shown "by default", you should not set anything special to let it show. Can you please take a look at the examples in this repo to see how to configure the slider?
The checkmark is shown "by default", you should not set anything special to let it show
Not in my case :( . If I don't set complete_icon
in the xml layout file and in code, the checkmark is not showing at all at completion:
When I set @drawable/slidetoact_animated_ic_check
to complete_icon
, the checkmark also not showing and I get this error:
As for sample app, I just copied and pasted the part I need, so Android Studio convert it from Java to Koltin to be:
binding.cartSliderProceed.onSlideCompleteListener = object : SlideToActView.OnSlideCompleteListener {
override fun onSlideComplete(view: SlideToActView) {
// When I set completeIcon here, it shows but not animated
binding.cartSliderProceed.completeIcon = R.drawable.slidetoact_animated_ic_check // or view.completeIcon = ...
view.invalidate()
...
... }
}
I love your work btw, but I can't make it work the way you did in the example. I miss something somewhere.
Not in my case :( . If I don't set
complete_icon
in the xml layout file and in code, the checkmark is not showing at all at completion:
Have you tried in a emulator? Can you try to run the example app in this repo in your device?
I'm trying to understand if this is a problem of your device or of your configuration.
Have you tried in a emulator?
It works perfect on the emulator, both my app and the expample app
Can you try to run the example app in this repo in your device?
the example app not playing complete animation on my Huawei. But if I close the app and run it again, the checkmark is there.
So, it seems my phone is the problem.
I don't really know how to reproduce this at this point. It seems like a problem with the Huawei phone and the handling of AnimatedVectorDrawable
s
It seems like a problem with the Huawei phone and the handling of
AnimatedVectorDrawable
s
I don't think this is the case, because I have an animated drawable on another activity as a background for an ImageView, cast it as Animator and calling start() without problem.
XML layout:
app:complete_icon="@drawable/slidetoact_animated_ic_check"
It asks for String not drawable. Also, setting this in code not working, no animation at slide completed:
slide.completeIcon = R.drawable.slidetoact_animated_ic_check
Details