test_class.declarator: savedQrCodeImage = new File(QR_CODE_FILEPATH)
test_class.modifier: private final
test_class.original_string: private final File savedQrCodeImage = new File(QR_CODE_FILEPATH);
test_class.type: File
test_class.var_name: savedQrCodeImage
test_class.declarator: md5File = new File(MD5_CACHE_PATH)
test_class.modifier: private final
test_class.original_string: private final File md5File = new File(MD5_CACHE_PATH);
test_class.type: File
test_class.var_name: md5File
test_class.file: collect_app/src/test/java/org/odk/collect/android/utilities/QRCodeUtilsTest.java
test_class.identifier: QRCodeUtilsTest
test_case.body: @Test
      public void readQRCodeFromDiskIfCacheExists() throws NoSuchAlgorithmException, IOException, WriterException {
          String expectedData = "{\"general\":{},\"admin\":{}}";
  
          // stubbing cache and bitmap files
          new File(Collect.SETTINGS).mkdirs();
          FileUtils.saveBitmapToFile(QRCodeUtils.generateQRBitMap(expectedData, 100), QR_CODE_FILEPATH);
          FileUtils.write(md5File, getDigest(expectedData.getBytes()));
  
          // verify that QRCode and md5 cache files exist
          assertTrue(savedQrCodeImage.exists());
          assertTrue(md5File.exists());
  
          final long lastModifiedQRCode = savedQrCodeImage.lastModified();
          final long lastModifiedCache = md5File.lastModified();
  
          final GenerationResults generationResults = new GenerationResults();
          generateQrCode(generationResults);
  
          // assert that files were not modified
          assertEquals(lastModifiedCache, md5File.lastModified());
          assertEquals(lastModifiedQRCode, savedQrCodeImage.lastModified());
  
          verifyCachedMd5Data(expectedData);
      }
test_case.class_method_signature: QRCodeUtilsTest.readQRCodeFromDiskIfCacheExists()
test_case.full_signature: @Test public void readQRCodeFromDiskIfCacheExists()
test_case.identifier: readQRCodeFromDiskIfCacheExists
test_case.invocations: mkdirs saveBitmapToFile generateQRBitMap write getDigest getBytes assertTrue exists assertTrue exists lastModified lastModified generateQrCode assertEquals lastModified assertEquals lastModified verifyCachedMd5Data
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void readQRCodeFromDiskIfCacheExists()
focal_class.declarator: QR_CODE_FILEPATH = Collect.SETTINGS + File.separator + "collect-settings.png"
focal_class.modifier: public static final
focal_class.original_string: public static final String QR_CODE_FILEPATH = Collect.SETTINGS + File.separator + "collect-settings.png";
focal_class.type: String
focal_class.var_name: QR_CODE_FILEPATH
focal_class.declarator: QR_CODE_SIDE_LENGTH = 400
focal_class.modifier: private static final
focal_class.original_string: private static final int QR_CODE_SIDE_LENGTH = 400;
focal_class.type: int
focal_class.var_name: QR_CODE_SIDE_LENGTH
focal_class.declarator: SETTINGS_MD5_FILE = ".collect-settings-hash"
focal_class.modifier: private static final
focal_class.original_string: private static final String SETTINGS_MD5_FILE = ".collect-settings-hash";
focal_class.type: String
focal_class.var_name: SETTINGS_MD5_FILE
focal_class.declarator: MD5_CACHE_PATH = Collect.SETTINGS + File.separator + SETTINGS_MD5_FILE
focal_class.modifier: static final
focal_class.original_string: static final String MD5_CACHE_PATH = Collect.SETTINGS + File.separator + SETTINGS_MD5_FILE;
focal_class.type: String
focal_class.var_name: MD5_CACHE_PATH
focal_class.file: collect_app/src/main/java/org/odk/collect/android/utilities/QRCodeUtils.java
focal_class.identifier: QRCodeUtils
focal_class.class_method_signature: QRCodeUtils.QRCodeUtils()
focal_class.full_signature: private  QRCodeUtils()
focal_class.identifier: QRCodeUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  QRCodeUtils()
focal_class.class_method_signature: QRCodeUtils.decodeFromBitmap(Bitmap bitmap)
focal_class.full_signature: public static String decodeFromBitmap(Bitmap bitmap)
focal_class.identifier: decodeFromBitmap
focal_class.modifiers: public static
focal_class.parameters: (Bitmap bitmap)
focal_class.return: String
focal_class.signature: String decodeFromBitmap(Bitmap bitmap)
focal_class.class_method_signature: QRCodeUtils.getBinaryBitmap(Bitmap bitmap)
focal_class.full_signature: @NonNull private static BinaryBitmap getBinaryBitmap(Bitmap bitmap)
focal_class.identifier: getBinaryBitmap
focal_class.modifiers: @NonNull private static
focal_class.parameters: (Bitmap bitmap)
focal_class.return: BinaryBitmap
focal_class.signature: BinaryBitmap getBinaryBitmap(Bitmap bitmap)
focal_class.class_method_signature: QRCodeUtils.generateQRBitMap(String data, int sideLength)
focal_class.full_signature: public static Bitmap generateQRBitMap(String data, int sideLength)
focal_class.identifier: generateQRBitMap
focal_class.modifiers: public static
focal_class.parameters: (String data, int sideLength)
focal_class.return: Bitmap
focal_class.signature: Bitmap generateQRBitMap(String data, int sideLength)
focal_class.class_method_signature: QRCodeUtils.getQRCodeGeneratorObservable(Collection<String> selectedPasswordKeys)
focal_class.full_signature: public static Observable<Bitmap> getQRCodeGeneratorObservable(Collection<String> selectedPasswordKeys)
focal_class.identifier: getQRCodeGeneratorObservable
focal_class.modifiers: public static
focal_class.parameters: (Collection<String> selectedPasswordKeys)
focal_class.return: Observable<Bitmap>
focal_class.signature: Observable<Bitmap> getQRCodeGeneratorObservable(Collection<String> selectedPasswordKeys)
focal_method.body: public static Bitmap generateQRBitMap(String data, int sideLength) throws IOException, WriterException {
          final long time = System.currentTimeMillis();
          String compressedData = CompressionUtils.compress(data);
  
          // Maximum capacity for QR Codes is 4,296 characters (Alphanumeric)
          if (compressedData.length() > 4000) {
              throw new IOException(Collect.getInstance().getString(R.string.encoding_max_limit));
          }
  
          Map<EncodeHintType, ErrorCorrectionLevel> hints = new HashMap<>();
          hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
          QRCodeWriter qrCodeWriter = new QRCodeWriter();
          BitMatrix bitMatrix = qrCodeWriter.encode(compressedData, BarcodeFormat.QR_CODE, sideLength, sideLength, hints);
  
          Bitmap bmp = Bitmap.createBitmap(sideLength, sideLength, Bitmap.Config.RGB_565);
          for (int x = 0; x < sideLength; x++) {
              for (int y = 0; y < sideLength; y++) {
                  bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
              }
          }
          Timber.i("QR Code generation took : %d ms", System.currentTimeMillis() - time);
          return bmp;
      }
focal_method.class_method_signature: QRCodeUtils.generateQRBitMap(String data, int sideLength)
focal_method.full_signature: public static Bitmap generateQRBitMap(String data, int sideLength)
focal_method.identifier: generateQRBitMap
focal_method.invocations: currentTimeMillis compress length getString getInstance put encode createBitmap setPixel get i currentTimeMillis
focal_method.modifiers: public static
focal_method.parameters: (String data, int sideLength)
focal_method.return: Bitmap
focal_method.signature: Bitmap generateQRBitMap(String data, int sideLength)