summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/print/PageRange.java24
-rw-r--r--core/java/android/print/PrintAttributes.java34
-rw-r--r--core/java/android/print/PrintManager.java2
3 files changed, 43 insertions, 17 deletions
diff --git a/core/java/android/print/PageRange.java b/core/java/android/print/PageRange.java
index d6320f0..8c229c5 100644
--- a/core/java/android/print/PageRange.java
+++ b/core/java/android/print/PageRange.java
@@ -78,6 +78,30 @@ public final class PageRange implements Parcelable {
return mEnd;
}
+ /**
+ * Gets whether a page range contains a a given page.
+ *
+ * @param pageIndex The page index.
+ * @return True if the page is within this range.
+ *
+ * @hide
+ */
+ public boolean contains(int pageIndex) {
+ return pageIndex >= mStart && pageIndex <= mEnd;
+ }
+
+ /**
+ * Get the size of this range which is the number of
+ * pages it contains.
+ *
+ * @return The size of the range.
+ *
+ * @hide
+ */
+ public int getSize() {
+ return mEnd - mStart + 1;
+ }
+
@Override
public int describeContents() {
return 0;
diff --git a/core/java/android/print/PrintAttributes.java b/core/java/android/print/PrintAttributes.java
index 2810d55..30f0c6a 100644
--- a/core/java/android/print/PrintAttributes.java
+++ b/core/java/android/print/PrintAttributes.java
@@ -105,6 +105,13 @@ public final class PrintAttributes implements Parcelable {
/**
* Gets the minimal margins. If the content does not fit
* these margins it will be clipped.
+ * <p>
+ * <strong>These margins are physically imposed by the printer and they
+ * are <em>not</em> rotated, i.e. they are the same for both portrait and
+ * landscape. For example, a printer may not be able to print in a stripe
+ * on both left and right sides of the page.
+ * </strong>
+ * </p>
*
* @return The margins or <code>null</code> if not set.
*/
@@ -115,6 +122,13 @@ public final class PrintAttributes implements Parcelable {
/**
* Sets the minimal margins. If the content does not fit
* these margins it will be clipped.
+ * <p>
+ * <strong>These margins are physically imposed by the printer and they
+ * are <em>not</em> rotated, i.e. they are the same for both portrait and
+ * landscape. For example, a printer may not be able to print in a stripe
+ * on both left and right sides of the page.
+ * </strong>
+ * </p>
*
* @param The margins.
*
@@ -193,14 +207,8 @@ public final class PrintAttributes implements Parcelable {
oldResolution.getHorizontalDpi());
attributes.setResolution(newResolution);
- // Rotate the physical margins.
- Margins oldMinMargins = getMinMargins();
- Margins newMinMargins = new Margins(
- oldMinMargins.getBottomMils(),
- oldMinMargins.getLeftMils(),
- oldMinMargins.getTopMils(),
- oldMinMargins.getRightMils());
- attributes.setMinMargins(newMinMargins);
+ // Do not rotate the physical margins.
+ attributes.setMinMargins(getMinMargins());
attributes.setColorMode(getColorMode());
@@ -236,14 +244,8 @@ public final class PrintAttributes implements Parcelable {
oldResolution.getHorizontalDpi());
attributes.setResolution(newResolution);
- // Rotate the physical margins.
- Margins oldMinMargins = getMinMargins();
- Margins newMargins = new Margins(
- oldMinMargins.getTopMils(),
- oldMinMargins.getRightMils(),
- oldMinMargins.getBottomMils(),
- oldMinMargins.getLeftMils());
- attributes.setMinMargins(newMargins);
+ // Do not rotate the physical margins.
+ attributes.setMinMargins(getMinMargins());
attributes.setColorMode(getColorMode());
diff --git a/core/java/android/print/PrintManager.java b/core/java/android/print/PrintManager.java
index 9361286..7ec838e 100644
--- a/core/java/android/print/PrintManager.java
+++ b/core/java/android/print/PrintManager.java
@@ -105,7 +105,7 @@ public final class PrintManager {
private static final String LOG_TAG = "PrintManager";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = true;
private static final int MSG_NOTIFY_PRINT_JOB_STATE_CHANGED = 1;