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

Bug in animation on successive toast calls #21

Open
suyashmahar opened this issue Jan 21, 2017 · 7 comments
Open

Bug in animation on successive toast calls #21

suyashmahar opened this issue Jan 21, 2017 · 7 comments
Assignees
Labels

Comments

@suyashmahar
Copy link

Animation of toast gets finished by the time it is displayed in case multiple toast are called successively.

Following gif shows finished animation when second toast is displayed.
Bug Details

@yadav-rahul
Copy link
Owner

Thanks for pointing this out. I got what you are trying to say.
Actually that's the way Toasts work in Android i.e. if you want to show another Toast just after previous one then you can call .cancel() method on Toast first and then show second one.

You can apply same concept on TastyToast too. When you do TastyToast.makeText(), this method returns a Toast object(check this https://github.com/yadav-rahul/TastyToast/blob/lib/tastytoast/src/main/java/com/sdsmdg/tastytoast/TastyToast.java#L145). Then you can call .cancel() to cancel previous Toast and can show new one.
For example: This will solve your issue

  • First create a new object like this
    Toast tastyToast = TastyToast.makeText(getApplicationContext(), "Hello World !", TastyToast.LENGTH_LONG, TastyToast.WARNING);
  • After it whenever you want to dismiss it call
    tastyToast.cancel();

@suyashmahar Try it once and do report if this issue still persists.

@suyashmahar
Copy link
Author

Strange the copy of code which I had, makeText() was declared as static. Anyways I changed that.

I used this:

    Toast toast =  TastyToast.makeText(getApplicationContext(), "Download Successful !", TastyToast.LENGTH_LONG, TastyToast.SUCCESS);
    toast.cancel();
    toast =  TastyToast.makeText(getApplicationContext(), "Download Successful !", TastyToast.LENGTH_LONG, TastyToast.WARNING);

Issue with animation not being played is still not resolved, now just first toast gets dismissed. Animations on second toast are still not played.
I think I noticed another bug regarding animation. Animation doesn't play when previous toast was canceled.

@yadav-rahul
Copy link
Owner

@suyashmahar Seems like a bug to me. Would you like to work upon it?

@suyashmahar
Copy link
Author

Should I start developing a Toast Manager class to handle all toasts? So that developer can create a toast and send it to toast manager. After which rest would be handled by the class.

@yadav-rahul
Copy link
Owner

@suyashmahar Yes, It would be good idea. Go ahead and make PR for it.

@yadav-rahul
Copy link
Owner

@suyashmahar Any updates on this?

@lucazin
Copy link

lucazin commented Jun 10, 2019

its not working in android 9, but 8.1 and 7 is ok, i have in my project the gradle 0.1.1 but in android pie not work.

Can u help me ?

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

No branches or pull requests

3 participants