summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2013-11-15 21:42:12 -0800
committerThe Android Automerger <android-build@google.com>2013-11-19 17:35:44 -0800
commitee7d501ba3796d06ac3d040446621dcd128cf04c (patch)
tree604fc4274b035f74798540e35c4b9701244146a5
parent245408d29018fee4b1231e52f5da1edcc3283c4a (diff)
downloadbase-ee7d501ba3796d06ac3d040446621dcd128cf04c.tar.gz
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
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
index 88403a390629..c1c7a4e31dd1 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());
}