is there a way that the Crouton dislays the out Animation when i cancel all croutons ?
Im using an custom layout to intercept touch events when user interacts again with the touch screen:
@Override
public boolean onInterceptTouchEvent(final MotionEvent ev)
{
Crouton.cancelAllCroutons();
return super.onInterceptTouchEvent(ev);
}
That Layout knows nothing about the Croutons displayed. It works this way, but instead of just make them disapear i want the out animation played (crouton going up).
I had a quick look in the source and the Builder can be used to create custom animation to show toast. When i customize the Crouton to play an fade in Animation it works like expected, only the out animation seems to be ignored when croutons get canceled
final View customMessage = LayoutInflater.from(getContext()).inflate(R.layout.custom_layout,null);
final Configuration croutonConfig = new Configuration.Builder().setDuration(Configuration.DURATION_INFINITE).setInAnimation(android.R.anim.fade_in).setOutAnimation(android.R.anim.fade_out).build();
Crouton.make(this.getActivity(),customMessage).setConfiguration(croutonConfig).show();
Anyone knows how this can be done ?
Not with
cancelAllCroutons()
, as it removes all potential current and queued Croutons immediately and without an Animation.You can call
Crouton.hide(...)
on your Crouton in order to remove it with the provided Animation. If you have set aLifecycleCallback
you'll get notified that the Crouton has been removed. Then you could remove all future Croutons.