A project using Fragments, ViewPagers and TabLayouts to provide graceful access to multiple pages
of information. It sets up a Page Fragment and a ViewPager to allow users to swipe from one page to
another and a TabLayout to show users where they are and allow jumping to a specific page. I also
included clickable text navigation in each page to support jumping to specific sections on each page.
Adding the per page navigation was a bit tricky :
- I had to save the ArrayList position of the entries that started a new page section and then associate
them with a clickable TextView
- made use of smoothScrollToPositionFromTop() to scroll to needed positions when a navigation
TextView was clicked on
- highlighting the clicked navigation TextView was easy, but I also I had to save a pointer to it so it could be
grayed out when a new navigation TextView was clicked on
- Getting the navigation views to highlight automatically when a user scrolled down to a new page
section was a bit tricky, but it turned out really well. I had to send a callback to the ArrayAdapter
so it could tell my Fragment code when an element corresponding to a page section header was
inflated. Then the Fragment could highlight the corresponding navigation TextView.
- I figured out how to create a ListView of views with different formats. A page's ListView consisted of
section header views which consisted only of a TextView with short text in a large font size and info
sections which consisted of an ImageView and a larger amount of text in a smaller font size. My
ArrayAdapter had to dynamically decide which views to show and which to hide based on what type of
content it was showing