Fix NPE in PrintActivity.
It is possible that the orientation is chosen before the media size. The code handling orientation change was wrognly expecting to have a selected media size all the time resulting in a NPE. bug:15512333 Change-Id: I9f2786af314641144a24c1d1363c8d2590b0df57
This commit is contained in:
@@ -1735,10 +1735,12 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
|
||||
} else if (spinner == mOrientationSpinner) {
|
||||
SpinnerItem<Integer> orientationItem = mOrientationSpinnerAdapter.getItem(position);
|
||||
PrintAttributes attributes = mPrintJob.getAttributes();
|
||||
if (orientationItem.value == ORIENTATION_PORTRAIT) {
|
||||
attributes.copyFrom(attributes.asPortrait());
|
||||
} else {
|
||||
attributes.copyFrom(attributes.asLandscape());
|
||||
if (mMediaSizeSpinner.getSelectedItem() != null) {
|
||||
if (orientationItem.value == ORIENTATION_PORTRAIT) {
|
||||
attributes.copyFrom(attributes.asPortrait());
|
||||
} else {
|
||||
attributes.copyFrom(attributes.asLandscape());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user