Methods Summary |
---|
private java.lang.String | colorModesToString()
StringBuilder builder = new StringBuilder();
builder.append('[");
int colorModes = mColorModes;
while (colorModes != 0) {
final int colorMode = 1 << Integer.numberOfTrailingZeros(colorModes);
colorModes &= ~colorMode;
if (builder.length() > 1) {
builder.append(", ");
}
builder.append(PrintAttributes.colorModeToString(colorMode));
}
builder.append(']");
return builder.toString();
|
public void | copyFrom(android.print.PrinterCapabilitiesInfo other)
if (this == other) {
return;
}
mMinMargins = other.mMinMargins;
if (other.mMediaSizes != null) {
if (mMediaSizes != null) {
mMediaSizes.clear();
mMediaSizes.addAll(other.mMediaSizes);
} else {
mMediaSizes = new ArrayList<MediaSize>(other.mMediaSizes);
}
} else {
mMediaSizes = null;
}
if (other.mResolutions != null) {
if (mResolutions != null) {
mResolutions.clear();
mResolutions.addAll(other.mResolutions);
} else {
mResolutions = new ArrayList<Resolution>(other.mResolutions);
}
} else {
mResolutions = null;
}
mColorModes = other.mColorModes;
final int defaultCount = other.mDefaults.length;
for (int i = 0; i < defaultCount; i++) {
mDefaults[i] = other.mDefaults[i];
}
|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object obj)
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
PrinterCapabilitiesInfo other = (PrinterCapabilitiesInfo) obj;
if (mMinMargins == null) {
if (other.mMinMargins != null) {
return false;
}
} else if (!mMinMargins.equals(other.mMinMargins)) {
return false;
}
if (mMediaSizes == null) {
if (other.mMediaSizes != null) {
return false;
}
} else if (!mMediaSizes.equals(other.mMediaSizes)) {
return false;
}
if (mResolutions == null) {
if (other.mResolutions != null) {
return false;
}
} else if (!mResolutions.equals(other.mResolutions)) {
return false;
}
if (mColorModes != other.mColorModes) {
return false;
}
if (!Arrays.equals(mDefaults, other.mDefaults)) {
return false;
}
return true;
|
public int | getColorModes()Gets the bit mask of supported color modes.
return mColorModes;
|
public PrintAttributes | getDefaults()Gets the default print attributes.
PrintAttributes.Builder builder = new PrintAttributes.Builder();
builder.setMinMargins(mMinMargins);
final int mediaSizeIndex = mDefaults[PROPERTY_MEDIA_SIZE];
if (mediaSizeIndex >= 0) {
builder.setMediaSize(mMediaSizes.get(mediaSizeIndex));
}
final int resolutionIndex = mDefaults[PROPERTY_RESOLUTION];
if (resolutionIndex >= 0) {
builder.setResolution(mResolutions.get(resolutionIndex));
}
final int colorMode = mDefaults[PROPERTY_COLOR_MODE];
if (colorMode > 0) {
builder.setColorMode(colorMode);
}
return builder.build();
|
public java.util.List | getMediaSizes()Gets the supported media sizes.
return Collections.unmodifiableList(mMediaSizes);
|
public android.print.PrintAttributes.Margins | getMinMargins()Gets the minimal margins. These are the minimal margins
the printer physically supports.
return mMinMargins;
|
public java.util.List | getResolutions()Gets the supported resolutions.
return Collections.unmodifiableList(mResolutions);
|
public int | hashCode()
final int prime = 31;
int result = 1;
result = prime * result + ((mMinMargins == null) ? 0 : mMinMargins.hashCode());
result = prime * result + ((mMediaSizes == null) ? 0 : mMediaSizes.hashCode());
result = prime * result + ((mResolutions == null) ? 0 : mResolutions.hashCode());
result = prime * result + mColorModes;
result = prime * result + Arrays.hashCode(mDefaults);
return result;
|
private void | readDefaults(android.os.Parcel parcel)
final int defaultCount = parcel.readInt();
for (int i = 0; i < defaultCount; i++) {
mDefaults[i] = parcel.readInt();
}
|
private android.print.PrintAttributes.Margins | readMargins(android.os.Parcel parcel)
return (parcel.readInt() == 1) ? Margins.createFromParcel(parcel) : null;
|
private void | readMediaSizes(android.os.Parcel parcel)
final int mediaSizeCount = parcel.readInt();
if (mediaSizeCount > 0 && mMediaSizes == null) {
mMediaSizes = new ArrayList<MediaSize>();
}
for (int i = 0; i < mediaSizeCount; i++) {
mMediaSizes.add(MediaSize.createFromParcel(parcel));
}
|
private void | readResolutions(android.os.Parcel parcel)
final int resolutionCount = parcel.readInt();
if (resolutionCount > 0 && mResolutions == null) {
mResolutions = new ArrayList<Resolution>();
}
for (int i = 0; i < resolutionCount; i++) {
mResolutions.add(Resolution.createFromParcel(parcel));
}
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder();
builder.append("PrinterInfo{");
builder.append("minMargins=").append(mMinMargins);
builder.append(", mediaSizes=").append(mMediaSizes);
builder.append(", resolutions=").append(mResolutions);
builder.append(", colorModes=").append(colorModesToString());
builder.append("\"}");
return builder.toString();
|
private void | writeDefaults(android.os.Parcel parcel)
final int defaultCount = mDefaults.length;
parcel.writeInt(defaultCount);
for (int i = 0; i < defaultCount; i++) {
parcel.writeInt(mDefaults[i]);
}
|
private void | writeMargins(android.print.PrintAttributes.Margins margins, android.os.Parcel parcel)
if (margins == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
margins.writeToParcel(parcel);
}
|
private void | writeMediaSizes(android.os.Parcel parcel)
if (mMediaSizes == null) {
parcel.writeInt(0);
return;
}
final int mediaSizeCount = mMediaSizes.size();
parcel.writeInt(mediaSizeCount);
for (int i = 0; i < mediaSizeCount; i++) {
mMediaSizes.get(i).writeToParcel(parcel);
}
|
private void | writeResolutions(android.os.Parcel parcel)
if (mResolutions == null) {
parcel.writeInt(0);
return;
}
final int resolutionCount = mResolutions.size();
parcel.writeInt(resolutionCount);
for (int i = 0; i < resolutionCount; i++) {
mResolutions.get(i).writeToParcel(parcel);
}
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
writeMargins(mMinMargins, parcel);
writeMediaSizes(parcel);
writeResolutions(parcel);
parcel.writeInt(mColorModes);
writeDefaults(parcel);
|