Speaker's notes here : http://bit.ly/and-nav
This is a feedback about user experience creation, following a simple Android app I had to create.
In this presentation I'll tell you about this story, trying to identify the points that will hep you to make the good choice on your own project.
36. Multi-screen UI
Use the system resources
res/layout/main.xml
res/layout-large/main_two_panes.xml
res/layout-sw600dp/main_two_panes.xml
37. Multi-screen UI
Use the system resources
res/layout/main.xml
res/layout-large/main_two_panes.xml
res/layout-sw600dp/main_two_panes.xml
Default
38. Multi-screen UI
Use the system resources
res/layout/main.xml
res/layout-large/main_two_panes.xml
res/layout-sw600dp/main_two_panes.xml
>= 7"
Default
39. Multi-screen UI
Use the system resources
res/layout/main.xml
res/layout-large/main_two_panes.xml
res/layout-sw600dp/main_two_panes.xml
>= 600dp
>= 7"
Default
41. Multi-screen UI
Avoid file duplication with aliases
res/layout/main.xml
res/layout/main_two_panes.xml
res/values-large/layout.xml
res/values-sw600dp/layout.xml
Define the 2 layouts
on the default folder
42. Multi-screen UI
Avoid file duplication with aliases
res/layout/main.xml
res/layout/main_two_panes.xml
res/values-large/layout.xml
res/values-sw600dp/layout.xml
Define aliases using
the filters
Define the 2 layouts
on the default folder
44. Multi-screen UI
Avoid file duplication with aliases
<resources>
<item name="main" type="layout">
@layout/main_two_panes
</item>
</resources>
Override main by main_two_panes
for large and sw600dp screens
46. Multi-screen UI
Fork the code
res/values/bools.xml
res/values-large/bools.xml
res/values-sw600dp/bools.xml
<resources>
<bool name="isTwoPanes">
true|false
</bool>
</resources>
Boolean values dealing
with the filters
47. Multi-screen UI
Fork the code
res/values/bools.xml
res/values-large/bools.xml
res/values-sw600dp/bools.xml
<resources>
<bool name="isTwoPanes">
true|false
</bool>
</resources>
true or false:
explicite definition
Boolean values dealing
with the filters
48. Multi-screen UI
Fork the code
boolean isTwoPanes = res.getBoolean(R.bool.isTwoPanes);
if (isTwoPanes)
// launch a tablet activity
else
// launch a phone activity
49. Multi-screen UI
Fork the code
boolean isTwoPanes = res.getBoolean(R.bool.isTwoPanes);
if (isTwoPanes)
// launch a tablet activity
else
// launch a phone activity
We fork the code based on
the isTwoPanes value