OSDN Git Service

CMFileManager: Printing preview content is not show complete.
authorjing.zhao <jing.zhao@ck-telecom.com>
Fri, 17 Apr 2015 01:22:02 +0000 (09:22 +0800)
committerJorge Ruesga <jorge@ruesga.com>
Fri, 17 Apr 2015 10:10:37 +0000 (10:10 +0000)
fix the PageCount from int to double

Change-Id: I72f1577f22b563456b43dded4058572d328009c3
(cherry picked from commit ed63368d1d085d4021329d6720ab7a32765b7768)

src/com/cyanogenmod/filemanager/ui/policy/PrintActionPolicy.java

index 6f7087c..38e4494 100644 (file)
@@ -351,8 +351,8 @@ public final class PrintActionPolicy extends ActionsPolicy {
         }
 
         private int calculatePageCount(int rowsPerPage) {
-            int pages = mAdjustedLines.size() / rowsPerPage;
-            return pages <= 0 ? PrintDocumentInfo.PAGE_COUNT_UNKNOWN : pages;
+            double pages = (double) mAdjustedLines.size() / rowsPerPage;
+            return pages <= 0 ? PrintDocumentInfo.PAGE_COUNT_UNKNOWN : (int) Math.ceil(pages);
         }
 
         private int rowsPerPage(Rect pageContentRect) {