I have a little uncommon fragment navigation, because I want to have app responsive. Due to that I use almost only show/hide methods with fragments.
Whenever I want to navigate to another fragment and go back with the back key, I add this transaction to the backstack. With that, I also set the transition animation to that transaction, so that when a user presses back, it shows a reversal animation (the effect of popBackStackImmiediate()), when user goes to previous fragment.
I add these animations by:
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
Lets call it A -> B -> A navigation. So when A is moved to B, an opening animation is shown, and then when we go back to A, a reversal animation is shown.
However the problem arrises, when I have a situation where I need to go from A to B adding this transaction to back stack (to be able to return to A with back button), and then from B to C (not adding this transaction to back stack), and from C to A when pressing back button. The problem in this scenario is that I want the user to be brought immidietly to A fragment when pressing back button on that C fragment. However, because there was animation added to transaction from A to B, and that transaction was added to back stack, when user presses back button on fragment C, the reversal transaction A->B is being shown (in effect, the fragment B flashes for a fraction of a second on a screen, before fragment A is displayed).
It would all run beautifully if I was able to get to the transaction object in A->B transaction and disable that transition animation. However it seems this operation has no effect after a commit() has been done.
Is there anyway I can disable that animation?