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

complete_icon attribute requires String not Drawable! #153

Open
doohab opened this issue Mar 9, 2021 · 7 comments
Open

complete_icon attribute requires String not Drawable! #153

doohab opened this issue Mar 9, 2021 · 7 comments

Comments

@doohab
Copy link

doohab commented Mar 9, 2021

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

  • Library Version. 0.9.0
  • Android Version. 11
  • Emulator/Device specs. Huawei p40
  • Logs/Crash reports/Stacktraces. nothing
  • Example Code/Link to repositories. N/A
@doohab doohab closed this as completed Mar 9, 2021
@doohab doohab reopened this Mar 9, 2021
@doohab doohab changed the title slide.completeIcon not setting anything! neither the attribute working! completeIcon not accepting animations! Attribute requires String not Drawable! Mar 10, 2021
@doohab
Copy link
Author

doohab commented Mar 10, 2021

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 ..

SVID_20210310_104307_11.mp4

Kotlin:
binding.slider.onSlideCompleteListener = object : SlideToActView.OnSlideCompleteListener { override fun onSlideComplete(view: SlideToActView) { view.invalidate() } }

@doohab doohab closed this as completed Mar 10, 2021
@doohab doohab reopened this Mar 10, 2021
@cortinico
Copy link
Owner

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:

slider.setCompleteIcon(R.drawable.custom_complete_animated);

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?

@doohab
Copy link
Author

doohab commented Mar 13, 2021

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:

test.mp4

When I set @drawable/slidetoact_animated_ic_check to complete_icon, the checkmark also not showing and I get this error:
Screen Shot 2021-03-13 at 5 43 25 AM

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.

@doohab doohab changed the title completeIcon not accepting animations! Attribute requires String not Drawable! complete_icon attribute requires String not Drawable! Mar 13, 2021
@cortinico
Copy link
Owner

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.

@doohab
Copy link
Author

doohab commented Mar 13, 2021

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.

@cortinico
Copy link
Owner

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 AnimatedVectorDrawables

@doohab
Copy link
Author

doohab commented Mar 13, 2021

It seems like a problem with the Huawei phone and the handling of AnimatedVectorDrawables

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.

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