diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-11-26 09:30:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-11-26 09:30:51 +0100 |
commit | 33ab92fe567081c9f704262c2bc959f0498b06d5 (patch) | |
tree | 1ffcd2c441f7a006e8af45bffd2a7b88c315b969 /android/experimental/DocumentLoader | |
parent | 593e4a11edb42cf7311ee341b0dbb1e7b1497c1c (diff) |
android: make this a bit more readable
Change-Id: I765458daa808245ec736a3d184ba64c2dcd3a10b
Diffstat (limited to 'android/experimental/DocumentLoader')
-rw-r--r-- | android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java index 4817bac8cb73..96ae150e2aaf 100644 --- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java +++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java @@ -182,7 +182,9 @@ public class DocumentLoader flipper.showNext(); - getPageViewerAt((flipper.getDisplayedChild() + PAGECACHE_PLUSMINUS) % PAGECACHE_SIZE).display(getCurrentPageViewer().currentPageNumber + PAGECACHE_PLUSMINUS); + // The entry after the next, both child index and next is 0..PAGECACHE_SIZE. + int next = (flipper.getDisplayedChild() + PAGECACHE_PLUSMINUS) % PAGECACHE_SIZE; + getPageViewerAt(next).display(getCurrentPageViewer().currentPageNumber + PAGECACHE_PLUSMINUS); return true; } else if (event2.getX() - event1.getX() > 120) { if (getCurrentPageViewer().currentPageNumber == 0) @@ -201,7 +203,9 @@ public class DocumentLoader flipper.showPrevious(); - getPageViewerAt((flipper.getDisplayedChild() + PAGECACHE_SIZE - PAGECACHE_PLUSMINUS) % PAGECACHE_SIZE).display(getCurrentPageViewer().currentPageNumber - PAGECACHE_PLUSMINUS); + // The entry before the previous, both child index and previous is 0..PAGECACHE_SIZE. + int previous = (flipper.getDisplayedChild() + PAGECACHE_SIZE - PAGECACHE_PLUSMINUS) % PAGECACHE_SIZE; + getPageViewerAt(previous).display(getCurrentPageViewer().currentPageNumber - PAGECACHE_PLUSMINUS); return true; } |