use of android.support.v4.print.PrintHelper in project cw-omnibus by commonsguy.
the class MainActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == IMAGE_REQUEST_ID && resultCode == Activity.RESULT_OK) {
try {
PrintHelper help = new PrintHelper(this);
help.setScaleMode(PrintHelper.SCALE_MODE_FIT);
help.printBitmap("Photo!", data.getData());
} catch (FileNotFoundException e) {
Log.e(getClass().getSimpleName(), "Exception printing bitmap", e);
}
}
}
use of android.support.v4.print.PrintHelper in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method print.
public void print() {
Bitmap bitmap = MasterImage.getImage().getHighresImage();
PrintHelper printer = new PrintHelper(this);
printer.printBitmap("ImagePrint", bitmap);
}
use of android.support.v4.print.PrintHelper in project android_packages_apps_Gallery2 by LineageOS.
the class AbstractGalleryActivity method printSelectedImage.
public void printSelectedImage(Uri uri) {
if (uri == null) {
return;
}
String printJobName = getLastPathSegment(uri);
if (printJobName == null) {
printJobName = DEFAULT_PRINT_JOB_NAME;
}
PrintHelper printer = new PrintHelper(this);
try {
printer.printBitmap(printJobName, uri);
} catch (FileNotFoundException fnfe) {
Log.e(TAG, "Error printing an image", fnfe);
}
}
use of android.support.v4.print.PrintHelper in project Camera-Roll-Android-App by kollerlukas.
the class ItemActivity method printPhoto.
public void printPhoto() {
if (!(albumItem instanceof Photo)) {
Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();
return;
}
PrintHelper photoPrinter = new PrintHelper(this);
photoPrinter.setScaleMode(PrintHelper.SCALE_MODE_FIT);
try {
photoPrinter.printBitmap(albumItem.getPath(), albumItem.getUri(this));
} catch (FileNotFoundException e) {
Toast.makeText(this, "Error (FileNotFoundException)", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
use of android.support.v4.print.PrintHelper in project gh4a by slapperwan.
the class FileViewerActivity method handlePrintRequest.
@Override
protected boolean handlePrintRequest() {
if (!FileUtils.isImage(mPath)) {
return false;
}
String base64Data = mContent != null ? mContent.content() : null;
if (base64Data == null) {
return false;
}
byte[] decodedData = Base64.decode(base64Data, Base64.DEFAULT);
Bitmap bitmap = BitmapFactory.decodeByteArray(decodedData, 0, decodedData.length);
PrintHelper printHelper = new PrintHelper(this);
printHelper.setScaleMode(PrintHelper.SCALE_MODE_FIT);
printHelper.printBitmap(getDocumentTitle(), bitmap);
return true;
}
Aggregations