public final class PrintJobInfo extends Object implements Parcelable
Modifier and Type | Class and Description |
---|---|
static class |
PrintJobInfo.Builder
Builder for creating a
PrintJobInfo . |
static interface |
PrintJobInfo.State |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<PrintJobInfo> |
CREATOR |
static int |
STATE_ANY
Constant for matching any print job state.
|
static int |
STATE_ANY_ACTIVE
Constant for matching any active print job state.
|
static int |
STATE_ANY_SCHEDULED
Constant for matching any scheduled, i.e. delivered to a print
service, print job state.
|
static int |
STATE_ANY_VISIBLE_TO_CLIENTS
Constant for matching any print job state.
|
static int |
STATE_BLOCKED
Print job state: The print job is blocked.
|
static int |
STATE_CANCELED
Print job state: The print job is canceled.
|
static int |
STATE_COMPLETED
Print job state: The print job is successfully printed.
|
static int |
STATE_CREATED
Print job state: The print job is being created but not yet
ready to be printed.
|
static int |
STATE_FAILED
Print job state: The print job was printing but printing failed.
|
static int |
STATE_QUEUED
Print job state: The print jobs is created, it is ready
to be printed and should be processed.
|
static int |
STATE_STARTED
Print job state: The print job is being printed.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
PrintJobInfo() |
PrintJobInfo(PrintJobInfo other) |
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
int |
getAdvancedIntOption(String key)
Gets the value of an advanced (printer specific) print option.
|
Bundle |
getAdvancedOptions()
Gets the advanced options.
|
String |
getAdvancedStringOption(String key)
Gets the value of an advanced (printer specific) print option.
|
int |
getAppId()
Sets the owning application id.
|
PrintAttributes |
getAttributes()
Gets the print job attributes.
|
int |
getCopies()
Gets the number of copies.
|
long |
getCreationTime()
Gets the wall time in millisecond when this print job was created.
|
PrintDocumentInfo |
getDocumentInfo()
Gets the info describing the printed document.
|
PrintJobId |
getId()
Gets the unique print job id.
|
String |
getLabel()
Gets the human readable job label.
|
PageRange[] |
getPages()
Gets the included pages.
|
PrinterId |
getPrinterId()
Gets the unique target printer id.
|
String |
getPrinterName()
Gets the name of the target printer.
|
float |
getProgress()
Get the progress that has been made printing this job.
|
int |
getState()
Gets the current job state.
|
CharSequence |
getStatus(PackageManager pm)
Get the status of this job.
|
String |
getTag()
Gets the optional tag assigned by a print service.
|
boolean |
hasAdvancedOption(String key)
Gets whether this job has a given advanced (printer specific) print
option.
|
boolean |
isCancelling()
Gets whether this print is being cancelled.
|
void |
setAdvancedOptions(Bundle options)
Sets the advanced options.
|
void |
setAppId(int appId)
Sets the owning application id.
|
void |
setAttributes(PrintAttributes attributes)
Sets the print job attributes.
|
void |
setCancelling(boolean cancelling)
Sets whether this print is being cancelled.
|
void |
setCopies(int copyCount)
Sets the number of copies.
|
void |
setCreationTime(long creationTime)
Sets the wall time in milliseconds when this print job was created.
|
void |
setDocumentInfo(PrintDocumentInfo info)
Sets the info describing the printed document.
|
void |
setId(PrintJobId id)
Sets the unique print job id.
|
void |
setLabel(String label)
Sets the human readable job label.
|
void |
setPages(PageRange[] pageRanges)
Sets the included pages.
|
void |
setPrinterId(PrinterId printerId)
Sets the unique target printer id.
|
void |
setPrinterName(String printerName)
Sets the name of the target printer.
|
void |
setProgress(float progress)
Sets the progress of the print job.
|
void |
setState(int state)
Sets the current job state.
|
void |
setStatus(CharSequence status)
Sets the status of the print job.
|
void |
setStatus(int status,
CharSequence appPackageName)
Sets the status of the print job.
|
void |
setTag(String tag)
Sets the optional tag assigned by a print service.
|
static String |
stateToString(int state) |
String |
toString()
Returns a string representation of the object.
|
void |
writeToParcel(Parcel parcel,
int flags)
Flatten this object in to a Parcel.
|
public static final int STATE_ANY
public static final int STATE_ANY_VISIBLE_TO_CLIENTS
public static final int STATE_ANY_ACTIVE
public static final int STATE_ANY_SCHEDULED
public static final int STATE_CREATED
Next valid states: STATE_QUEUED
public static final int STATE_QUEUED
Next valid states: STATE_STARTED
, STATE_FAILED
,
STATE_CANCELED
public static final int STATE_STARTED
Next valid states: STATE_COMPLETED
, STATE_FAILED
,
STATE_CANCELED
, STATE_BLOCKED
public static final int STATE_BLOCKED
Next valid states: STATE_FAILED
, STATE_CANCELED
,
STATE_STARTED
public static final int STATE_COMPLETED
Next valid states: None
public static final int STATE_FAILED
Next valid states: STATE_CANCELED
, STATE_STARTED
public static final int STATE_CANCELED
Next valid states: None
public static final Parcelable.Creator<PrintJobInfo> CREATOR
public PrintJobInfo()
public PrintJobInfo(PrintJobInfo other)
public PrintJobId getId()
public void setId(PrintJobId id)
id
- The job id.public String getLabel()
public void setLabel(String label)
label
- The label.public PrinterId getPrinterId()
public void setPrinterId(PrinterId printerId)
printerId
- The target printer id.public String getPrinterName()
public void setPrinterName(String printerName)
printerName
- The printer name.public int getState()
STATE_CREATED
,
STATE_QUEUED
,
STATE_STARTED
,
STATE_COMPLETED
,
STATE_BLOCKED
,
STATE_FAILED
,
STATE_CANCELED
public void setState(int state)
state
- The job state.public void setProgress(float progress)
progress
- the progress of the jobpublic void setStatus(CharSequence status)
status
- the status of the job, can be nullpublic void setStatus(@StringRes int status, CharSequence appPackageName)
status
- The new status as a string resourceappPackageName
- App package name the resource belongs topublic int getAppId()
public void setAppId(int appId)
appId
- The owning app id.public String getTag()
public void setTag(String tag)
tag
- The tag.public long getCreationTime()
public void setCreationTime(long creationTime)
creationTime
- The creation time in milliseconds.public int getCopies()
public void setCopies(int copyCount)
copyCount
- The number of copies.public PageRange[] getPages()
null
if not set.public void setPages(PageRange[] pageRanges)
pageRanges
- The included pages.public PrintAttributes getAttributes()
public void setAttributes(PrintAttributes attributes)
attributes
- The attributes.public PrintDocumentInfo getDocumentInfo()
public void setDocumentInfo(PrintDocumentInfo info)
info
- The document info.public boolean isCancelling()
public void setCancelling(boolean cancelling)
cancelling
- True if the print job is being cancelled.public boolean hasAdvancedOption(String key)
key
- The option key.public String getAdvancedStringOption(String key)
key
- The option key.public int getAdvancedIntOption(String key)
key
- The option key.public Bundle getAdvancedOptions()
public void setAdvancedOptions(Bundle options)
options
- The advanced options.public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel parcel, int flags)
Parcelable
writeToParcel
in interface Parcelable
parcel
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public static String stateToString(int state)
public float getProgress()
public CharSequence getStatus(PackageManager pm)
pm
- Package manager used to resolve the string