dimanche 23 septembre 2018

How to architect nested Fragments in a ViewPager?

I have a ViewPager, which holds 3 Fragments. One of the fragments is a ScrollView, with several distinct sections (an About Me screen with photo uploading, details, settings sections).

I'm decoupling business logic with using MVVM, but still the Fragment is quite large (700 lines of code), as all of the sections need a great deal of UI logic (RecyclerViews, reactive fields, onActivityResult-related stuff).

If the Fragment was an Activity instead, I could just add all 3 sections as separate Fragments and manage communication with the Activity, but since it's a Fragment I'm not sure how to organise these nested sections so that they are not in one class but can still communicate with each other.

Aucun commentaire:

Enregistrer un commentaire