SDKLauncher-Android icon indicating copy to clipboard operation
SDKLauncher-Android copied to clipboard

page number indicator: migrate to new Javascript pagination API (see iOS launcher app)

Open danielweck opened this issue 11 years ago • 5 comments

danielweck avatar Nov 26 '14 08:11 danielweck

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

danielweck avatar Nov 26 '14 08:11 danielweck

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

danielweck avatar Nov 26 '14 10:11 danielweck

Addressed in this Pull Request: https://github.com/readium/SDKLauncher-Android/pull/40 (pending peer review...)

danielweck avatar Dec 02 '14 21:12 danielweck

@JCCR @danielweck I had a couple of questions regarding page numbers:

  1. 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?
  1. 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.

balaji24 avatar Sep 11 '15 05:09 balaji24

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.

danielweck avatar Sep 11 '15 08:09 danielweck