terrakok/Cicerone

Add support for new FragmentTransaction method

aasitnikov opened this issue · 0 comments

In androidx.fragment:fragment:1.2.0 there is new FragmentTransaction.replace() method overloads, that was added to better support new capabilities of FragmentFactory. This new overload accepts Class<out Fragment> and Bundle? instead of instance of Fragment, to let FragmentFactory do the instantiation.

The proposed solution is to add a new method to SupportAppScreen, that returns a tuple of class and bundle. This change won't break users unless they have a method with the same name in their SupportAppScreen subclass. SupportAppNavigator will call this method and execute new FragmentTransaction.replace() method, if returned tuple is not null.

I propose the class name FragmentParams for the tuple. It should be informative and concise, as users will be instantiating instances of this class quite often.