0

I have the Dialog fragment with dialog, that have such animation:

dialog.window.setWindowAnimations(R.style.RemoveWishlistAnimation)

In this style exit animation has long duration, so if user pressed HOME button, some part of animation will be shown on home screen. I must use this long animation, but is it exists any way to interrupt this animation in some kind of override fun onPause() {} function?

Yogesh Rathi
  • 6,331
  • 4
  • 51
  • 81

1 Answers1

0

You can put your piece of code inside a handler as follows:

new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.window.setWindowAnimations(R.style.RemoveWishlistAnimation);
            }
        }, 5000);
  • Sorry, but I can't understand, how this can help to interrupt an already running animation – Aleksandr Gilmanov Jan 30 '18 at 12:35
  • @AleksandrGilmanov, If you engulf the piece of code within the handler, then animation will delay by 5 seconds. I hope this is what you wanted. – Partha Chakraborty Jan 30 '18 at 12:43
  • I want to start animation after user make the choice - dialog is closing and starts animation that I set in `dialog.window.setWindowAnimations(R.style.RemoveWishlistAnimation);` But after animation started, and before animation ends user can press Home or Back button, and animation will be played on the home screen. It looks bad =( I hope to find way to interrupt this animation or hide. – Aleksandr Gilmanov Jan 30 '18 at 13:16