public static final class PrinterInfo.Builder extends Object
PrinterInfo
.Constructor and Description |
---|
Builder(PrinterId printerId,
String name,
int status)
Constructor.
|
Builder(PrinterInfo other)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
PrinterInfo |
build()
Creates a new
PrinterInfo . |
PrinterInfo.Builder |
incCustomPrinterIconGen()
Increments the generation number of the custom printer icon.
|
PrinterInfo.Builder |
setCapabilities(PrinterCapabilitiesInfo capabilities)
Sets the printer capabilities.
|
PrinterInfo.Builder |
setDescription(String description)
Sets the localized printer description
which is shown to the user
|
PrinterInfo.Builder |
setHasCustomPrinterIcon(boolean hasCustomPrinterIcon)
Declares that the print service can load a custom per printer's icon.
|
PrinterInfo.Builder |
setIconResourceId(int iconResourceId)
Set a drawable resource as icon for this printer.
|
PrinterInfo.Builder |
setInfoIntent(PendingIntent infoIntent)
Sets the
PendingIntent that launches an activity showing more information about
the printer. |
PrinterInfo.Builder |
setName(String name)
Sets the localized printer name which
is shown to the user
|
PrinterInfo.Builder |
setStatus(int status)
Sets the printer status.
|
public Builder(PrinterId printerId, String name, int status)
printerId
- The printer id. Cannot be null.name
- The printer name. Cannot be empty.status
- The printer status. Must be a valid status.IllegalArgumentException
- If the printer id is null, or the
printer name is empty or the status is not a valid one.public Builder(PrinterInfo other)
other
- Other info from which to start building.public PrinterInfo.Builder setStatus(int status)
status
- The status.PrinterInfo.STATUS_IDLE
,
PrinterInfo.STATUS_BUSY
,
PrinterInfo.STATUS_UNAVAILABLE
public PrinterInfo.Builder setIconResourceId(@DrawableRes int iconResourceId)
iconResourceId
- The resource ID of the icon.setHasCustomPrinterIcon(boolean)
public PrinterInfo.Builder setHasCustomPrinterIcon(boolean hasCustomPrinterIcon)
setIconResourceId(int)
and a custom icon are set the resource icon
is shown while the custom icon loads but then the custom icon is used. If
setIconResourceId(int)
is not set the printer's service's icon is
shown while loading.
The icon is requested asynchronously and only when needed via
PrinterDiscoverySession.onRequestCustomPrinterIcon(android.print.PrinterId, android.os.CancellationSignal, android.printservice.CustomPrinterIconCallback)
.
hasCustomPrinterIcon
- If the printer has a custom icon or not.public PrinterInfo.Builder setName(String name)
name
- The name.public PrinterInfo.Builder setDescription(String description)
description
- The description.public PrinterInfo.Builder setInfoIntent(PendingIntent infoIntent)
PendingIntent
that launches an activity showing more information about
the printer.infoIntent
- The intent
.public PrinterInfo.Builder setCapabilities(PrinterCapabilitiesInfo capabilities)
capabilities
- The capabilities.public PrinterInfo build()
PrinterInfo
.PrinterInfo
.public PrinterInfo.Builder incCustomPrinterIconGen()
PrinterInfo
does not match the previous one anymore, users of the PrinterInfo
will reload the
icon if needed.