page number indicator: migrate to new Javascript pagination API (see iOS launcher app)
see "pageDidChange" event:
https://github.com/readium/SDKLauncher-iOS/blob/develop/Classes/EPubViewController.m#L656
see updateToolbar:
https://github.com/readium/SDKLauncher-iOS/blob/develop/Classes/EPubViewController.m#L420
Current Android code:
onPaginationChanged callback: https://github.com/readium/SDKLauncher-Android/blob/develop/SDKLauncher-Android/src/org/readium/sdk/android/launcher/WebViewActivity.java#L497
PaginationInfo: https://github.com/readium/SDKLauncher-Android/blob/develop/SDKLauncher-Android/src/org/readium/sdk/android/launcher/model/PaginationInfo.java#L41
Page: https://github.com/readium/SDKLauncher-Android/blob/develop/SDKLauncher-Android/src/org/readium/sdk/android/launcher/model/Page.java#L35
Addressed in this Pull Request: https://github.com/readium/SDKLauncher-Android/pull/40 (pending peer review...)
@JCCR @danielweck I had a couple of questions regarding page numbers:
- Immediately after loading the book, how do I get the number of pages in each chapter?
- I see it in the onPaginationChanged callback, but that gives me only for that chapter and there is no easy way to access that data for all chapters or is there?
- Is there a way to get the total number of pages in the book? I know this question is a little on the harder side because of the whole reflowable and fixed layout types but I was just wondering if there is a simple way to calculate it.
The basic situation is to be able to have a scrubber at the bottom of the book reader and being able to go through the book quickly.
See how the PAGINATION_CHANGED event is captured in host_app_feedback.js:
https://github.com/readium/SDKLauncher-iOS/blob/develop/Resources/host_app_feedback.js#L137
This serialises the data into a JSON payload that can be consumed on the native application side:
https://github.com/readium/readium-shared-js/blob/develop/js/models/current_pages_info.js#L38
See for example how the iOS launcher app consumes / stores the data in native form:
https://github.com/readium/SDKLauncher-iOS/blob/develop/Classes/EPubViewController.m#L665
And see the updateToolbar function uses that information to display meaningful page context:
https://github.com/readium/SDKLauncher-iOS/blob/develop/Classes/EPubViewController.m#L429
Now, there is a Pull Request to adopt a similar design pattern in Android, but as you can see there are pending issues: https://github.com/readium/SDKLauncher-Android/pull/40 We need to get back to this PR, adjust and merge. It shouldn't be very hard.