Builder
class Builder
kotlin.Any | |
↳ | android.print.PrinterInfo.Builder |
Builder for creating of a PrinterInfo
.
Summary
Public constructors | |
---|---|
Constructor. |
|
Builder(other: PrinterInfo) Constructor. |
Public methods | |
---|---|
PrinterInfo |
build() Creates a new |
PrinterInfo.Builder |
setCapabilities(capabilities: PrinterCapabilitiesInfo) Sets the printer capabilities. |
PrinterInfo.Builder |
setDescription(description: String) Sets the localized printer description which is shown to the user |
PrinterInfo.Builder |
setHasCustomPrinterIcon(hasCustomPrinterIcon: Boolean) Declares that the print service can load a custom per printer's icon. |
PrinterInfo.Builder |
setIconResourceId(iconResourceId: Int) Set a drawable resource as icon for this printer. |
PrinterInfo.Builder |
setInfoIntent(infoIntent: PendingIntent) Sets the |
PrinterInfo.Builder |
Sets the localized printer name which is shown to the user |
PrinterInfo.Builder |
Sets the printer status. |
Public constructors
Builder
Builder(
printerId: PrinterId,
name: String,
status: Int)
Constructor.
Parameters | |
---|---|
printerId |
PrinterId: The printer id. Cannot be null. |
name |
String: The printer name. Cannot be empty. This value cannot be null . |
status |
Int: The printer status. Must be a valid status. Value is android.print.PrinterInfo#STATUS_IDLE , android.print.PrinterInfo#STATUS_BUSY , or android.print.PrinterInfo#STATUS_UNAVAILABLE |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If the printer id is null, or the printer name is empty or the status is not a valid one. |
Builder
Builder(other: PrinterInfo)
Constructor.
Parameters | |
---|---|
other |
PrinterInfo: Other info from which to start building. This value cannot be null . |
Public methods
build
fun build(): PrinterInfo
Creates a new PrinterInfo
.
Return | |
---|---|
PrinterInfo |
A new PrinterInfo . This value cannot be null . |
setCapabilities
fun setCapabilities(capabilities: PrinterCapabilitiesInfo): PrinterInfo.Builder
Sets the printer capabilities.
Parameters | |
---|---|
capabilities |
PrinterCapabilitiesInfo: The capabilities. This value cannot be null . |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |
setDescription
fun setDescription(description: String): PrinterInfo.Builder
Sets the localized printer description which is shown to the user
Parameters | |
---|---|
description |
String: The description. This value cannot be null . |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |
setHasCustomPrinterIcon
fun setHasCustomPrinterIcon(hasCustomPrinterIcon: Boolean): PrinterInfo.Builder
Declares that the print service can load a custom per printer's icon. If both PrinterInfo.Builder#setIconResourceId
and a custom icon are set the resource icon is shown while the custom icon loads but then the custom icon is used. If PrinterInfo.Builder#setIconResourceId
is not set the printer's service's icon is shown while loading.
The icon is requested asynchronously and only when needed via android.printservice.PrinterDiscoverySession#onRequestCustomPrinterIcon
.
Parameters | |
---|---|
hasCustomPrinterIcon |
Boolean: If the printer has a custom icon or not. |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |
setIconResourceId
fun setIconResourceId(iconResourceId: Int): PrinterInfo.Builder
Set a drawable resource as icon for this printer. If no icon is set the printer's service's icon is used for the printer.
Parameters | |
---|---|
iconResourceId |
Int: The resource ID of the icon. |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |
setInfoIntent
fun setInfoIntent(infoIntent: PendingIntent): PrinterInfo.Builder
Sets the PendingIntent
that launches an activity showing more information about the printer.
Parameters | |
---|---|
infoIntent |
PendingIntent: The intent . This value cannot be null . |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |
setName
fun setName(name: String): PrinterInfo.Builder
Sets the localized printer name which is shown to the user
Parameters | |
---|---|
name |
String: The name. This value cannot be null . |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |
setStatus
fun setStatus(status: Int): PrinterInfo.Builder
Sets the printer status.
Parameters | |
---|---|
status |
Int: The status. Value is android.print.PrinterInfo#STATUS_IDLE , android.print.PrinterInfo#STATUS_BUSY , or android.print.PrinterInfo#STATUS_UNAVAILABLE |
Return | |
---|---|
PrinterInfo.Builder |
This builder. This value cannot be null . |