Update print preview when option is changed and clear ranges when they
layout changes
Before we updated the print preview when the paper size changed but not
when the page ranges changed. This is not consistent. We always change.
Also if there is a change to the options that changes the layout (i.e.
papersize, orientation, minMargins) then clear the selected ranges as
this does not make sense anymore.
This also fixes a bug that when having pages selected while we reduce
the number of pages in the preview we got a NPE.
Bonus: do not constantly re-update the options UI when range or copies
text is updated.
Bug: 27830850, 27741420
Change-Id: I7abe4a74b44ac5c5ee54d12cc0c1ca1540793f0e
diff --git a/core/java/android/print/PageRange.java b/core/java/android/print/PageRange.java
index 57c7718..2941283 100644
--- a/core/java/android/print/PageRange.java
+++ b/core/java/android/print/PageRange.java
@@ -32,6 +32,9 @@
*/
public static final PageRange ALL_PAGES = new PageRange(0, Integer.MAX_VALUE);
+ /** @hide */
+ public static final PageRange[] ALL_PAGES_ARRAY = new PageRange[]{PageRange.ALL_PAGES};
+
private final int mStart;
private final int mEnd;