I’m writing a single-action application and the routing here turned out to be too complicated and this activity started producing methods for switching between screens, because everyone has their own kind of transition, how to make the transition correctly in that case, I just have different navigation methods and a fragment of the activation methods, then this is not very conveniently. How correctly in the framework of mvp + pure architecture to make navigation for navigation between fragments

Closed due to the fact that the issue is too common for Kromster , 0xdb , Jarvis_J , Kosta B. , Edward participants 16 Jul '18 at 8:28 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Please reassign the question, it is absolutely incomprehensible and even with errors - Kostya M

1 answer 1

It is unlikely that you have N transitions with one activity. Most likely, in the main activation you will show the fragment No. 1. By clicking on different areas / buttons you should go from the current fragment to another, while staying within the framework of the same activation. Activation itself is engaged in something common for all fragments, for example, the organization of the menu. In this case, I do not see any problems. To replace a fragment, you have implemented something like this in the activation:

fun replaceFragment(fragment: Fragment, stackEnable: Boolean) { val tr = supportFragmentManager.beginTransaction() tr.setCustomAnimations(R.anim.right_animation_enter, R.anim.right_animation_leave) tr.replace(R.id.mainContainer, fragment, fragment.tag) if (stackEnable) tr.addToBackStack(null) tr.commit() } 

which you pull from your callback fragments.