How to disable FinishAfterTransition support when exiting an action

I have an activity with which I live with transition animations, for example:

ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, view, transitionStr); ActivityCompat.startActivity(activity, intent, options.toBundle()); 

However, when I return, I do not want the animation to run in the reverse order. Is it possible? I am using AppCompatActivity from appcompat-v7: 23.1.1.

+5
source share
3 answers

Possible Duplicate Transition Override

 finish(); Details.this.overridePendingTransition(R.anim.nothing,R.anim.nothing); 

With this code snippet, you can override the animation of the completion of the current activity.

+4
source

If you never want this transition to return to parent activity, use

 finish(); 

You can wrap it around a condition if you sometimes want a transition on the way back to parent activity. An example of use is to disable the transition when displaying an interstitial ad:

 if (interstitialAdWasDisplayed) { finish(); } else { finishAfterTransition(); } 
+4
source

According to the answers to this question, you cannot start the animation in the reverse order. Instead, I would create another transition, which is basically the inverse of the transition that you use when starting the operation, and add it to an activity like this ( R.anim.inverseTransition is the created transition):

 finish(); Details.this.overridePendingTransition(R.anim.inverseTransition,R.anim.inverseTransition); 

(see. the answer for more information)

0
source

Source: https://habr.com/ru/post/1245126/


All Articles