From 78bc5053a15ef218cce394b0d0e012f1700f760a Mon Sep 17 00:00:00 2001 From: Ximeng Zu Date: Wed, 5 Apr 2017 23:37:12 -0500 Subject: tdf#96764 - Android Viewer does not show page count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added page number display in text documents. The page nunmber calculation in handled on Java side and the work only involves calls to LOKit when necessary. Majority of the work is done in DocumentOverlayView. java, including calculation and displaying. The page number information is updated whenever a page number change callback is caught (from LOkit). Change-Id: I52014806cd647fa805b329825ac29b0e337c11a1 Reviewed-on: https://gerrit.libreoffice.org/36178 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- .../org/libreoffice/overlay/DocumentOverlay.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java') diff --git a/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java b/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java index 8d90ef09fa4a..d9d2b372b714 100644 --- a/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java +++ b/android/source/src/java/org/libreoffice/overlay/DocumentOverlay.java @@ -32,6 +32,8 @@ public class DocumentOverlay { private final DocumentOverlayView mDocumentOverlayView; private final DocumentOverlayLayer mDocumentOverlayLayer; + private final long hidePageNumberRectDelayInMilliseconds = 500; + /** * DocumentOverlayLayer responsibility is to get the changes to the viewport * and report them to DocumentOverlayView. @@ -74,6 +76,10 @@ public class DocumentOverlay { mDocumentOverlayView.initialize(layerView); } + public void setPartPageRectangles(List rectangles) { + mDocumentOverlayView.setPartPageRectangles(rectangles); + } + /** * Show the cursor at the defined cursor position on the overlay. */ @@ -96,6 +102,28 @@ public class DocumentOverlay { }); } + /** + * Show the page number rectangle on the overlay. + */ + public void showPageNumberRect() { + LOKitShell.getMainHandler().post(new Runnable() { + public void run() { + mDocumentOverlayView.showPageNumberRect(); + } + }); + } + + /** + * Hide the page number rectangle on the overlay. + */ + public void hidePageNumberRect() { + LOKitShell.getMainHandler().postDelayed(new Runnable() { + public void run() { + mDocumentOverlayView.hidePageNumberRect(); + } + }, hidePageNumberRectDelayInMilliseconds); + } + /** * Position the cursor to the input position on the overlay. */ -- cgit