use of android.print.PrintAttributes.Margins in project platform_frameworks_base by android.
the class IPrintManagerParametersTest method createMockCallbacks.
/**
* Create mock print service callbacks.
*
* @return the callbacks
*/
private PrintServiceCallbacks createMockCallbacks() {
return createMockPrintServiceCallbacks(new Answer<PrinterDiscoverySessionCallbacks>() {
@Override
public PrinterDiscoverySessionCallbacks answer(InvocationOnMock invocation) {
return createMockPrinterDiscoverySessionCallbacks(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
// Get the session.
StubbablePrinterDiscoverySession session = ((PrinterDiscoverySessionCallbacks) invocation.getMock()).getSession();
if (session.getPrinters().isEmpty()) {
final String PRINTER_NAME = "good printer";
List<PrinterInfo> printers = new ArrayList<>();
// Add the printer.
mGoodPrinterId = session.getService().generatePrinterId(PRINTER_NAME);
PrinterCapabilitiesInfo capabilities = new PrinterCapabilitiesInfo.Builder(mGoodPrinterId).setMinMargins(new Margins(200, 200, 200, 200)).addMediaSize(MediaSize.ISO_A4, true).addResolution(new Resolution("300x300", "300x300", 300, 300), true).setColorModes(PrintAttributes.COLOR_MODE_COLOR, PrintAttributes.COLOR_MODE_COLOR).build();
PrinterInfo printer = new PrinterInfo.Builder(mGoodPrinterId, PRINTER_NAME, PrinterInfo.STATUS_IDLE).setCapabilities(capabilities).build();
printers.add(printer);
session.addPrinters(printers);
}
onPrinterDiscoverySessionStartCalled();
return null;
}
}, null, null, null, null, null, null);
}
}, null, null);
}
use of android.print.PrintAttributes.Margins in project android_frameworks_base by DirtyUnicorns.
the class IPrintManagerParametersTest method createMockCallbacks.
/**
* Create mock print service callbacks.
*
* @return the callbacks
*/
private PrintServiceCallbacks createMockCallbacks() {
return createMockPrintServiceCallbacks(new Answer<PrinterDiscoverySessionCallbacks>() {
@Override
public PrinterDiscoverySessionCallbacks answer(InvocationOnMock invocation) {
return createMockPrinterDiscoverySessionCallbacks(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
// Get the session.
StubbablePrinterDiscoverySession session = ((PrinterDiscoverySessionCallbacks) invocation.getMock()).getSession();
if (session.getPrinters().isEmpty()) {
final String PRINTER_NAME = "good printer";
List<PrinterInfo> printers = new ArrayList<>();
// Add the printer.
mGoodPrinterId = session.getService().generatePrinterId(PRINTER_NAME);
PrinterCapabilitiesInfo capabilities = new PrinterCapabilitiesInfo.Builder(mGoodPrinterId).setMinMargins(new Margins(200, 200, 200, 200)).addMediaSize(MediaSize.ISO_A4, true).addResolution(new Resolution("300x300", "300x300", 300, 300), true).setColorModes(PrintAttributes.COLOR_MODE_COLOR, PrintAttributes.COLOR_MODE_COLOR).build();
PrinterInfo printer = new PrinterInfo.Builder(mGoodPrinterId, PRINTER_NAME, PrinterInfo.STATUS_IDLE).setCapabilities(capabilities).build();
printers.add(printer);
session.addPrinters(printers);
}
onPrinterDiscoverySessionStartCalled();
return null;
}
}, null, null, null, null, null, null);
}
}, null, null);
}
use of android.print.PrintAttributes.Margins in project android_frameworks_base by ResurrectionRemix.
the class IPrintManagerParametersTest method createMockCallbacks.
/**
* Create mock print service callbacks.
*
* @return the callbacks
*/
private PrintServiceCallbacks createMockCallbacks() {
return createMockPrintServiceCallbacks(new Answer<PrinterDiscoverySessionCallbacks>() {
@Override
public PrinterDiscoverySessionCallbacks answer(InvocationOnMock invocation) {
return createMockPrinterDiscoverySessionCallbacks(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
// Get the session.
StubbablePrinterDiscoverySession session = ((PrinterDiscoverySessionCallbacks) invocation.getMock()).getSession();
if (session.getPrinters().isEmpty()) {
final String PRINTER_NAME = "good printer";
List<PrinterInfo> printers = new ArrayList<>();
// Add the printer.
mGoodPrinterId = session.getService().generatePrinterId(PRINTER_NAME);
PrinterCapabilitiesInfo capabilities = new PrinterCapabilitiesInfo.Builder(mGoodPrinterId).setMinMargins(new Margins(200, 200, 200, 200)).addMediaSize(MediaSize.ISO_A4, true).addResolution(new Resolution("300x300", "300x300", 300, 300), true).setColorModes(PrintAttributes.COLOR_MODE_COLOR, PrintAttributes.COLOR_MODE_COLOR).build();
PrinterInfo printer = new PrinterInfo.Builder(mGoodPrinterId, PRINTER_NAME, PrinterInfo.STATUS_IDLE).setCapabilities(capabilities).build();
printers.add(printer);
session.addPrinters(printers);
}
onPrinterDiscoverySessionStartCalled();
return null;
}
}, null, null, null, null, null, null);
}
}, null, null);
}
use of android.print.PrintAttributes.Margins in project android_frameworks_base by AOSPA.
the class IPrintManagerParametersTest method createMockCallbacks.
/**
* Create mock print service callbacks.
*
* @return the callbacks
*/
private PrintServiceCallbacks createMockCallbacks() {
return createMockPrintServiceCallbacks(new Answer<PrinterDiscoverySessionCallbacks>() {
@Override
public PrinterDiscoverySessionCallbacks answer(InvocationOnMock invocation) {
return createMockPrinterDiscoverySessionCallbacks(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
// Get the session.
StubbablePrinterDiscoverySession session = ((PrinterDiscoverySessionCallbacks) invocation.getMock()).getSession();
if (session.getPrinters().isEmpty()) {
final String PRINTER_NAME = "good printer";
List<PrinterInfo> printers = new ArrayList<>();
// Add the printer.
mGoodPrinterId = session.getService().generatePrinterId(PRINTER_NAME);
PrinterCapabilitiesInfo capabilities = new PrinterCapabilitiesInfo.Builder(mGoodPrinterId).setMinMargins(new Margins(200, 200, 200, 200)).addMediaSize(MediaSize.ISO_A4, true).addResolution(new Resolution("300x300", "300x300", 300, 300), true).setColorModes(PrintAttributes.COLOR_MODE_COLOR, PrintAttributes.COLOR_MODE_COLOR).build();
PrinterInfo printer = new PrinterInfo.Builder(mGoodPrinterId, PRINTER_NAME, PrinterInfo.STATUS_IDLE).setCapabilities(capabilities).build();
printers.add(printer);
session.addPrinters(printers);
}
onPrinterDiscoverySessionStartCalled();
return null;
}
}, null, null, null, null, null, null);
}
}, null, null);
}
use of android.print.PrintAttributes.Margins in project android_frameworks_base by crdroidandroid.
the class IPrintManagerParametersTest method createMockCallbacks.
/**
* Create mock print service callbacks.
*
* @return the callbacks
*/
private PrintServiceCallbacks createMockCallbacks() {
return createMockPrintServiceCallbacks(new Answer<PrinterDiscoverySessionCallbacks>() {
@Override
public PrinterDiscoverySessionCallbacks answer(InvocationOnMock invocation) {
return createMockPrinterDiscoverySessionCallbacks(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
// Get the session.
StubbablePrinterDiscoverySession session = ((PrinterDiscoverySessionCallbacks) invocation.getMock()).getSession();
if (session.getPrinters().isEmpty()) {
final String PRINTER_NAME = "good printer";
List<PrinterInfo> printers = new ArrayList<>();
// Add the printer.
mGoodPrinterId = session.getService().generatePrinterId(PRINTER_NAME);
PrinterCapabilitiesInfo capabilities = new PrinterCapabilitiesInfo.Builder(mGoodPrinterId).setMinMargins(new Margins(200, 200, 200, 200)).addMediaSize(MediaSize.ISO_A4, true).addResolution(new Resolution("300x300", "300x300", 300, 300), true).setColorModes(PrintAttributes.COLOR_MODE_COLOR, PrintAttributes.COLOR_MODE_COLOR).build();
PrinterInfo printer = new PrinterInfo.Builder(mGoodPrinterId, PRINTER_NAME, PrinterInfo.STATUS_IDLE).setCapabilities(capabilities).build();
printers.add(printer);
session.addPrinters(printers);
}
onPrinterDiscoverySessionStartCalled();
return null;
}
}, null, null, null, null, null, null);
}
}, null, null);
}
Aggregations