diff options
author | John Hoford <hoford@google.com> | 2013-09-26 14:44:35 -0700 |
---|---|---|
committer | John Hoford <hoford@google.com> | 2013-09-26 14:47:52 -0700 |
commit | 641be74bd9d3f96d8665b23121f40efb8df2ea83 (patch) | |
tree | 89472fe8b0498228edb17a3e3a0edb1cd2112e33 /src | |
parent | ef3cc52f473f15534f00b61b55b53e93931fef97 (diff) | |
download | android_packages_apps_Gallery2-641be74bd9d3f96d8665b23121f40efb8df2ea83.tar.gz android_packages_apps_Gallery2-641be74bd9d3f96d8665b23121f40efb8df2ea83.tar.bz2 android_packages_apps_Gallery2-641be74bd9d3f96d8665b23121f40efb8df2ea83.zip |
enable change in printing
Change-Id: Ibf819002d29b83b4a8d72e7916d04f1c88a6bef2
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/util/PrintJob.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/util/PrintJob.java b/src/com/android/gallery3d/util/PrintJob.java index a593c2d90..bd857738f 100644 --- a/src/com/android/gallery3d/util/PrintJob.java +++ b/src/com/android/gallery3d/util/PrintJob.java @@ -44,16 +44,27 @@ public class PrintJob { // will be <= 300 dpi on A4 (8.3×11.7) paper // with a worst case of 150 dpi private final static int MAX_PRINT_SIZE = 3500; + static Boolean sNoPrint = null; /** * @return true if the system supports print */ public static boolean systemSupportsPrint() { - return (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2); + // TODO change the code to call a support library + if (sNoPrint != null) { + return sNoPrint; + } + try { + Class c = Class.forName("android.print.PrintManager"); + sNoPrint = true; + } catch (ClassNotFoundException e) { + sNoPrint = false; + } + return sNoPrint; } public static void printBitmap(final Context context, final String jobName, - final Bitmap bitmap) { + final Bitmap bitmap) { if (bitmap == null) { return; } @@ -119,7 +130,7 @@ public class PrintJob { fileDescriptor.getFileDescriptor())); // Done. writeResultCallback.onWriteFinished( - new PageRange[] { PageRange.ALL_PAGES }); + new PageRange[]{PageRange.ALL_PAGES}); } catch (IOException ioe) { // Failed. Log.e(LOG_TAG, "Error writing printed content", ioe); |