summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorSvet Ganov <svetoslavganov@google.com>2014-10-01 17:49:16 -0700
committerSvetoslav <svetoslavganov@google.com>2014-10-07 15:32:31 -0700
commit2eb7fadcd64120f0e94ebb0f91188900e916c559 (patch)
tree23256d7ea3148dc2174660554fcd7538437d75dc /packages
parent18ab83e571e1ef7e4599d38cffc080dca704a06d (diff)
downloadframeworks_base-2eb7fadcd64120f0e94ebb0f91188900e916c559.zip
frameworks_base-2eb7fadcd64120f0e94ebb0f91188900e916c559.tar.gz
frameworks_base-2eb7fadcd64120f0e94ebb0f91188900e916c559.tar.bz2
Custom print settings cannot change resolution.
bug:17677133 Change-Id: Ib8a24101f12d431fe221c1e91711d93a6a517273
Diffstat (limited to 'packages')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java82
1 files changed, 51 insertions, 31 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index 84ada6f..dc76218 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -686,43 +686,63 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
PrintAttributes currAttributes = mPrintJob.getAttributes();
PrintAttributes newAttributes = printJobInfo.getAttributes();
- // Take the media size only if the current printer supports is.
- MediaSize oldMediaSize = currAttributes.getMediaSize();
- MediaSize newMediaSize = newAttributes.getMediaSize();
- if (!oldMediaSize.equals(newMediaSize)) {
- final int mediaSizeCount = mMediaSizeSpinnerAdapter.getCount();
- MediaSize newMediaSizePortrait = newAttributes.getMediaSize().asPortrait();
- for (int i = 0; i < mediaSizeCount; i++) {
- MediaSize supportedSizePortrait = mMediaSizeSpinnerAdapter.getItem(i)
- .value.asPortrait();
- if (supportedSizePortrait.equals(newMediaSizePortrait)) {
- currAttributes.setMediaSize(newMediaSize);
- mMediaSizeSpinner.setSelection(i);
- if (currAttributes.getMediaSize().isPortrait()) {
- if (mOrientationSpinner.getSelectedItemPosition() != 0) {
- mOrientationSpinner.setSelection(0);
+ if (newAttributes != null) {
+ // Take the media size only if the current printer supports is.
+ MediaSize oldMediaSize = currAttributes.getMediaSize();
+ MediaSize newMediaSize = newAttributes.getMediaSize();
+ if (!oldMediaSize.equals(newMediaSize)) {
+ final int mediaSizeCount = mMediaSizeSpinnerAdapter.getCount();
+ MediaSize newMediaSizePortrait = newAttributes.getMediaSize().asPortrait();
+ for (int i = 0; i < mediaSizeCount; i++) {
+ MediaSize supportedSizePortrait = mMediaSizeSpinnerAdapter.getItem(i)
+ .value.asPortrait();
+ if (supportedSizePortrait.equals(newMediaSizePortrait)) {
+ currAttributes.setMediaSize(newMediaSize);
+ mMediaSizeSpinner.setSelection(i);
+ if (currAttributes.getMediaSize().isPortrait()) {
+ if (mOrientationSpinner.getSelectedItemPosition() != 0) {
+ mOrientationSpinner.setSelection(0);
+ }
+ } else {
+ if (mOrientationSpinner.getSelectedItemPosition() != 1) {
+ mOrientationSpinner.setSelection(1);
+ }
}
- } else {
- if (mOrientationSpinner.getSelectedItemPosition() != 1) {
- mOrientationSpinner.setSelection(1);
+ break;
+ }
+ }
+ }
+
+ // Take the resolution only if the current printer supports is.
+ Resolution oldResolution = currAttributes.getResolution();
+ Resolution newResolution = newAttributes.getResolution();
+ if (!oldResolution.equals(newResolution)) {
+ PrinterCapabilitiesInfo capabilities = mCurrentPrinter.getCapabilities();
+ if (capabilities != null) {
+ List<Resolution> resolutions = capabilities.getResolutions();
+ final int resolutionCount = resolutions.size();
+ for (int i = 0; i < resolutionCount; i++) {
+ Resolution resolution = resolutions.get(i);
+ if (resolution.equals(newResolution)) {
+ currAttributes.setResolution(resolution);
+ break;
}
}
- break;
}
}
- }
- // Take the color mode only if the current printer supports it.
- final int currColorMode = currAttributes.getColorMode();
- final int newColorMode = newAttributes.getColorMode();
- if (currColorMode != newColorMode) {
- final int colorModeCount = mColorModeSpinner.getCount();
- for (int i = 0; i < colorModeCount; i++) {
- final int supportedColorMode = mColorModeSpinnerAdapter.getItem(i).value;
- if (supportedColorMode == newColorMode) {
- currAttributes.setColorMode(newColorMode);
- mColorModeSpinner.setSelection(i);
- break;
+ // Take the color mode only if the current printer supports it.
+ final int currColorMode = currAttributes.getColorMode();
+ final int newColorMode = newAttributes.getColorMode();
+ if (currColorMode != newColorMode) {
+ final int colorModeCount = mColorModeSpinner.getCount();
+ for (int i = 0; i < colorModeCount; i++) {
+ final int supportedColorMode = mColorModeSpinnerAdapter.getItem(i).value;
+ if (supportedColorMode == newColorMode) {
+ currAttributes.setColorMode(newColorMode);
+ mColorModeSpinner.setSelection(i);
+ break;
+ }
}
}
}