From 1a85d9fb243aae3750001094aa1514d4303cb3e0 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Fri, 15 Nov 2013 21:42:12 -0800 Subject: Fix incorrent page range parsing when custom print options used. We have APIs for a print service to declare an activity with custom print options. In this activity the service can add custom properties as well as change the standard ones such as pages to print. The ranges of selected pages from the custom activity was incorrectly parsed resulting in an off by one error in what is shown to the user and as a result getting an exception when trying to print. bug:11719051 Change-Id: Id04c94608178895f1d47381a63133f0eba7645e1 --- .../src/com/android/printspooler/PrintJobConfigActivity.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'packages/PrintSpooler') diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java index 88403a3..c1c7a4e 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java @@ -1529,9 +1529,13 @@ public class PrintJobConfigActivity extends Activity { builder.append(','); } PageRange pageRange = pageRanges[i]; - builder.append(pageRange.getStart()); - builder.append('-'); - builder.append(pageRange.getEnd()); + final int shownStartPage = pageRange.getStart() + 1; + final int shownEndPage = pageRange.getEnd() + 1; + builder.append(shownStartPage); + if (shownStartPage != shownEndPage) { + builder.append('-'); + builder.append(shownEndPage); + } } mPageRangeEditText.setText(builder.toString()); } -- cgit v1.1