field public static final int addPrintersActivity = 16843750; // 0x10103e6
field public static final int addStatesFromChildren = 16842992; // 0x10100f0
field public static final int adjustViewBounds = 16843038; // 0x101011e
+ field public static final int advancedPrintOptionsActivity = 16843761; // 0x10103f1
field public static final int alertDialogIcon = 16843605; // 0x1010355
field public static final int alertDialogStyle = 16842845; // 0x101005d
field public static final int alertDialogTheme = 16843529; // 0x1010309
field public static final int STATE_STARTED = 3; // 0x3
}
+ public static final class PrintJobInfo.Builder {
+ ctor public PrintJobInfo.Builder(android.print.PrintJobInfo);
+ method public android.print.PrintJobInfo build();
+ method public void putAdvancedOption(java.lang.String, java.lang.String);
+ method public void putAdvancedOption(java.lang.String, int);
+ method public void setAttributes(android.print.PrintAttributes);
+ method public void setCopies(int);
+ method public void setPages(android.print.PageRange[]);
+ }
+
public final class PrintManager {
method public java.util.List<android.print.PrintJob> getPrintJobs();
method public android.print.PrintJob print(java.lang.String, android.print.PrintDocumentAdapter, android.print.PrintAttributes);
method public boolean cancel();
method public boolean complete();
method public boolean fail(java.lang.String);
+ method public int getAdvancedIntOption(java.lang.String);
+ method public java.lang.String getAdvancedStringOption(java.lang.String);
method public android.printservice.PrintDocument getDocument();
method public android.print.PrintJobId getId();
method public android.print.PrintJobInfo getInfo();
method public java.lang.String getTag();
+ method public boolean hasAdvancedOption(java.lang.String);
method public boolean isBlocked();
method public boolean isCancelled();
method public boolean isCompleted();
method protected void onDisconnected();
method protected abstract void onPrintJobQueued(android.printservice.PrintJob);
method protected abstract void onRequestCancelPrintJob(android.printservice.PrintJob);
+ field public static final java.lang.String EXTRA_PRINT_JOB_INFO = "android.intent.extra.print.PRINT_JOB_INFO";
field public static final java.lang.String SERVICE_INTERFACE = "android.printservice.PrintService";
field public static final java.lang.String SERVICE_META_DATA = "android.printservice";
}
/**
* Sets the included pages.
*
- * @return The included pages.
+ * @param pageRanges The included pages.
*
* @hide
*/
}
}
+ /**
+ * Builder for creating a {@link PrintJobInfo}.
+ */
+ public static final class Builder {
+ private final PrintJobInfo mPrototype;
+
+ /**
+ * Constructor.
+ *
+ * @param prototype Prototype to use as a starting point.
+ * Can be null.
+ */
+ public Builder(PrintJobInfo prototype) {
+ mPrototype = (prototype != null)
+ ? new PrintJobInfo(prototype)
+ : new PrintJobInfo();
+ }
+
+ /**
+ * Sets the number of copies.
+ *
+ * @param copies The number of copies.
+ */
+ public void setCopies(int copies) {
+ mPrototype.mCopies = copies;
+ }
+
+ /**
+ * Sets the print job attributes.
+ *
+ * @param attributes The attributes.
+ */
+ public void setAttributes(PrintAttributes attributes) {
+ mPrototype.mAttributes = attributes;
+ }
+
+ /**
+ * Sets the included pages.
+ *
+ * @param pages The included pages.
+ */
+ public void setPages(PageRange[] pages) {
+ mPrototype.mPageRanges = pages;
+ }
+
+ /**
+ * Puts an advanced (printer specific) option.
+ *
+ * @param key The option key.
+ * @param value The option value.
+ */
+ public void putAdvancedOption(String key, String value) {
+
+ }
+
+ /**
+ * Puts an advanced (printer specific) option.
+ *
+ * @param key The option key.
+ * @param value The option value.
+ */
+ public void putAdvancedOption(String key, int value) {
+
+ }
+
+ /**
+ * Creates a new {@link PrintJobInfo} instance.
+ *
+ * @return The new instance.
+ */
+ public PrintJobInfo build() {
+ return mPrototype;
+ }
+ }
+
public static final Parcelable.Creator<PrintJobInfo> CREATOR =
new Creator<PrintJobInfo>() {
@Override
/**
* Gets the print job tag.
*
- * @return tag The tag or null.
+ * @return The tag or null.
*
* @see #setTag(String)
*/
return getInfo().getTag();
}
+ /**
+ * Gets the value of an advanced (printer specific) print option.
+ *
+ * @param key The option key.
+ * @return The option value.
+ */
+ public String getAdvancedStringOption(String key) {
+ PrintService.throwIfNotCalledOnMainThread();
+ return null;
+ }
+
+ /**
+ * Gets whether this job has a given advanced (printer specific) print
+ * option.
+ *
+ * @param key The option key.
+ * @return Whether the option is present.
+ */
+ public boolean hasAdvancedOption(String key) {
+ PrintService.throwIfNotCalledOnMainThread();
+ return false;
+ }
+
+ /**
+ * Gets the value of an advanced (printer specific) print option.
+ *
+ * @param key The option key.
+ * @return The option value.
+ */
+ public int getAdvancedIntOption(String key) {
+ PrintService.throwIfNotCalledOnMainThread();
+ return 0;
+ }
+
@Override
public boolean equals(Object obj) {
if (this == obj) {
package android.printservice;
+import android.R;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
*/
public static final String SERVICE_META_DATA = "android.printservice";
+ /**
+ * If you declared an optional activity with advanced print options via the
+ * {@link R.attr#advancedPrintOptionsActivity advancedPrintOptionsActivity}
+ * attribute, this extra is used to pass in the currently constructed {@link
+ * PrintJobInfo} to your activity allowing you to modify it. After you are
+ * done, you must return the modified {@link PrintJobInfo} via the same extra.
+ * <p>
+ * You cannot modify the passed in {@link PrintJobInfo} directly, rather you
+ * should build another one using the {@link PrintJobInfo.Builder} class. You
+ * can specify any standard properties and add advanced, printer specific,
+ * ones via {@link PrintJobInfo.Builder#putAdvancedOption(String, String)
+ * PrintJobInfo.Builder#putAdvancedOption(String, String)} and {@link
+ * PrintJobInfo.Builder#putAdvancedOption(String, int)
+ * PrintJobInfo.Builder#putAdvancedOption(String, int)}. The advanced options
+ * are not interpreted by the system, they will not be visible to applications,
+ * and can only be accessed by your print service via {@link
+ * PrintJob#getAdvancedStringOption(String) PrintJob.getAdvancedStringOption(String)}
+ * and {@link PrintJob#getAdvancedIntOption(String) PrintJob.getAdvancedIntOption(String)}.
+ * </p>
+ */
+ public static final String EXTRA_PRINT_JOB_INFO = "android.intent.extra.print.PRINT_JOB_INFO";
+
private Handler mHandler;
private IPrintServiceClient mClient;
<!-- Fully qualified class name of an activity that allows the user to manually
add printers to this print service. -->
<attr name="addPrintersActivity" format="string"/>
+ <!-- Fully qualified class name of an activity with advanced print options
+ specific to this print service. -->
+ <attr name="advancedPrintOptionsActivity" format="string"/>
<!-- The vendor name if this print service is vendor specific. -->
<attr name="vendor" format="string"/>
</declare-styleable>
<public type="attr" name="accessibilityLiveRegion" id="0x010103ee" />
<public type="attr" name="windowTranslucentStatus" id="0x010103ef" />
<public type="attr" name="windowTranslucentNavigation" id="0x010103f0" />
+ <public type="attr" name="advancedPrintOptionsActivity" id="0x10103f1"/>
<public type="style" name="Theme.Holo.NoActionBar.TranslucentDecor" id="0x010301e1" />
<public type="style" name="Theme.Holo.Light.NoActionBar.TranslucentDecor" id="0x010301e2" />