@SuppressWarnings("deprecation") @TargetApi(13) @Override protected Void doInBackground(String... s) { String qrData = s[0]; Display display = activity.getWindowManager().getDefaultDisplay(); Point outSize = new Point(); int x, y, qrCodeDimension; /* lame, got to use both the new and old APIs here */ if (Build.VERSION.SDK_INT >= 13) { display.getSize(outSize); x = outSize.x; y = outSize.y; } else { x = display.getWidth(); y = display.getHeight(); } if (x < y) { qrCodeDimension = x; } else { qrCodeDimension = y; } Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension); QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension); try { qrBitmap = qrCodeEncoder.encodeAsBitmap(); } catch (WriterException e) { Log.e(TAG, "Could not encode QR as bitmap", e); } return null; }
@SuppressWarnings("deprecation") @TargetApi(13) @Override protected Void doInBackground(String... s) { String qrData = s[0]; Display display = activity.getWindowManager().getDefaultDisplay(); Point outSize = new Point(); int x, y, qrCodeDimension; /* lame, got to use both the new and old APIs here */ if (Build.VERSION.SDK_INT >= 13) { display.getSize(outSize); x = outSize.x; y = outSize.y; } else { x = display.getWidth(); y = display.getHeight(); } if (x < y) qrCodeDimension = x; else qrCodeDimension = y; Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension); QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension); try { qrBitmap = qrCodeEncoder.encodeAsBitmap(); } catch (WriterException e) { Log.e(TAG, "Could not encode QR as bitmap", e); } return null; }
@SuppressWarnings("deprecation") @TargetApi(13) @Override protected Void doInBackground(String... s) { String qrData = s[0]; Display display = activity.getWindowManager().getDefaultDisplay(); Point outSize = new Point(); int x, y, qrCodeDimension; /* lame, got to use both the new and old APIs here */ if (Build.VERSION.SDK_INT >= 13) { display.getSize(outSize); x = outSize.x; y = outSize.y; } else { x = display.getWidth(); y = display.getHeight(); } if (x < y) qrCodeDimension = x; else qrCodeDimension = y; Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension); QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension); try { qrBitmap = qrCodeEncoder.encodeAsBitmap(); } catch (WriterException e) { Log.e(TAG, e.getMessage()); } return (Void) null; }
@SuppressWarnings("deprecation") @TargetApi(13) @Override protected Void doInBackground(String... s) { String qrData = s[0]; /* //Display display = activity.getWindowManager().getDefaultDisplay(); Point outSize = new Point(); int x, y, qrCodeDimension; if (Build.VERSION.SDK_INT >= 13) { view.getSize(outSize); x = outSize.x; y = outSize.y; } else { x = display.getWidth(); y = display.getHeight(); } if (x < y) qrCodeDimension = x; else qrCodeDimension = y; **/ // Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension); QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension); try { qrBitmap = qrCodeEncoder.encodeAsBitmap(); } catch (WriterException e) { Log.e(TAG, e.getMessage()); } return null; }
@SuppressWarnings("deprecation") @TargetApi(13) @Override protected Bitmap doInBackground(String... s) { inviteLink = s[0]; message = new StringBuffer(); if (s.length > 0) { message.append(s[1]).append(": "); } message.append(inviteLink); message.append("\n\n"); message.append(activity.getString(R.string.action_tap_invite)); if (mShareQRCode) { Display display = activity.getWindowManager().getDefaultDisplay(); Point outSize = new Point(); int x, y, qrCodeDimension; /* lame, got to use both the new and old APIs here */ if (Build.VERSION.SDK_INT >= 13) { display.getSize(outSize); x = outSize.x; y = outSize.y; } else { x = display.getWidth(); y = display.getHeight(); } if (x < y) qrCodeDimension = x; else qrCodeDimension = y; Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension); QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(inviteLink, null, Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension); try { qrBitmap = qrCodeEncoder.encodeAsBitmap(); return qrBitmap; } catch (WriterException e) { Log.e(TAG, e.getMessage()); } } return null; }