To develop great UI the designer impliments different layouts for different breakpoints.
- orientation:vertical (1st break point) -
master_frag
anddetail_frag
are each in aFragmentActiity
- orientation:horizontal (2nd break point) -
master_detail_act.xml
incorpratingmaster_frag
anddetail_frag
fragments
- Detection is done in onCreate is testing for the articleView View in the detail fragment. if it is available we are in master/detail layout.
- This is stored in
mIsDualPane
-
Add a listener - only if the button is available (due to layout or due to API version)
-
We can use the onHeadlineSelected to implemet different behavior based on
mIsDualPane
** if dual - update the fragment. ** if not - start an intent. -
set the actionbar ** if dual - use tabs for navigation ** if not - use spinner
-
reuse of fragment in XML within in a layout
-
and again via code in a
FragmentActivity
-
using an interface to decouple activity and fragment
-
the fragment then uses the inerface to access the activity.
-
reacting to config change from single page detail to two pane master/detail.
-
using a strategy pattern to further simplify the handling different breakponits/layouts c.f. https://developer.android.com/training/multiscreen/adaptui