Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update all Java code to use Java 6

git-svn-id: http://zxing.googlecode.com/svn/trunk@2002 59b500cc-1b3d-0410-9834-0bbf25fbcc57
  • Loading branch information...
commit 64ca0195ab8e903e6cf688f1a9b551e28ce72779 1 parent 490f301
srowen authored
Showing with 3,108 additions and 8,032 deletions.
  1. +0 −11 README
  2. +2 −2 android-integration/build.xml
  3. +1 −1  android-integration/pom.xml
  4. +3 −1 android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java
  5. +1 −1  android/assets/html-en/scanning.html
  6. +1 −0  android/src/com/google/zxing/client/android/BeepManager.java
  7. +21 −29 android/src/com/google/zxing/client/android/CaptureActivity.java
  8. +4 −3 android/src/com/google/zxing/client/android/CaptureActivityHandler.java
  9. +20 −25 android/src/com/google/zxing/client/android/DecodeFormatManager.java
  10. +2 −2 android/src/com/google/zxing/client/android/DecodeHandler.java
  11. +8 −6 android/src/com/google/zxing/client/android/DecodeThread.java
  12. +3 −0  android/src/com/google/zxing/client/android/FinishListener.java
  13. +3 −0  android/src/com/google/zxing/client/android/HelpActivity.java
  14. +4 −3 android/src/com/google/zxing/client/android/HttpHelper.java
  15. +10 −7 android/src/com/google/zxing/client/android/InactivityTimer.java
  16. +1 −0  android/src/com/google/zxing/client/android/PreferencesActivity.java
  17. +1 −0  android/src/com/google/zxing/client/android/ViewfinderResultPointCallback.java
  18. +1 −0  android/src/com/google/zxing/client/android/book/BrowseBookListener.java
  19. +2 −0  android/src/com/google/zxing/client/android/book/SearchBookContentsActivity.java
  20. +1 −0  android/src/com/google/zxing/client/android/camera/AutoFocusCallback.java
  21. +1 −0  android/src/com/google/zxing/client/android/camera/PreviewCallback.java
  22. +5 −4 android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
  23. +2 −0  android/src/com/google/zxing/client/android/history/HistoryClickListener.java
  24. +6 −5 android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java
  25. +5 −4 android/src/com/google/zxing/client/android/result/CalendarResultHandler.java
  26. +2 −0  android/src/com/google/zxing/client/android/result/ISBNResultHandler.java
  27. +2 −0  android/src/com/google/zxing/client/android/result/ProductResultHandler.java
  28. +1 −0  android/src/com/google/zxing/client/android/result/ResultButtonListener.java
  29. +8 −3 android/src/com/google/zxing/client/android/result/ResultHandler.java
  30. +24 −27 android/src/com/google/zxing/client/android/result/ResultHandlerFactory.java
  31. +1 −1  android/src/com/google/zxing/client/android/result/SMSResultHandler.java
  32. +1 −1  android/src/com/google/zxing/client/android/result/WifiResultHandler.java
  33. +1 −0  android/src/com/google/zxing/client/android/result/supplement/KillerCallable.java
  34. +3 −0  android/src/com/google/zxing/client/android/result/supplement/SupplementalInfoRetriever.java
  35. +8 −4 android/src/com/google/zxing/client/android/share/BookmarkAdapter.java
  36. +1 −0  android/src/com/google/zxing/client/android/share/LoadPackagesAsyncTask.java
  37. +5 −0 android/src/com/google/zxing/client/android/share/ShareActivity.java
  38. +1 −0  android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java
  39. +19 −18 androidtest/src/com/google/zxing/client/androidtest/BenchmarkActivity.java
  40. +21 −30 androidtest/src/com/google/zxing/client/androidtest/BenchmarkItem.java
  41. +16 −16 androidtest/src/com/google/zxing/client/androidtest/BenchmarkThread.java
  42. +11 −26 androidtest/src/com/google/zxing/client/androidtest/CameraManager.java
  43. +37 −26 androidtest/src/com/google/zxing/client/androidtest/CameraTestActivity.java
  44. +7 −2 androidtest/src/com/google/zxing/client/androidtest/RGBLuminanceSource.java
  45. +5 −5 androidtest/src/com/google/zxing/client/androidtest/SaveThread.java
  46. +26 −26 androidtest/src/com/google/zxing/client/androidtest/ViewfinderView.java
  47. +37 −20 androidtest/src/com/google/zxing/client/androidtest/ZXingTestActivity.java
  48. +0 −76 bug/build.xml
  49. +0 −201 bug/lib/osgi-LICENSE.txt
  50. BIN  bug/lib/osgi.jar
  51. +0 −94 bug/src/com/google/zxing/client/bug/AWTImageLuminanceSource.java
  52. +0 −49 bug/src/com/google/zxing/client/bug/Activator.java
  53. +0 −73 bug/src/com/google/zxing/client/bug/ImageCanvas.java
  54. +0 −122 bug/src/com/google/zxing/client/bug/app/BugBarcodeApp.java
  55. +0 −79 bug/src/com/google/zxing/client/bug/servicetracker/BugBarcodeServiceTracker.java
  56. +1 −24 build.properties
  57. +1 −24 build.xml
  58. +2 −12 core/build.xml
  59. +18 −50 core/src/com/google/zxing/BarcodeFormat.java
  60. +8 −0 core/src/com/google/zxing/Binarizer.java
  61. +2 −3 core/src/com/google/zxing/BinaryBitmap.java
  62. +11 −16 core/src/com/google/zxing/DecodeHintType.java
  63. +3 −6 core/src/com/google/zxing/EncodeHintType.java
  64. +4 −3 core/src/com/google/zxing/LuminanceSource.java
  65. +40 −39 core/src/com/google/zxing/MultiFormatReader.java
  66. +41 −26 core/src/com/google/zxing/MultiFormatWriter.java
  67. +4 −3 core/src/com/google/zxing/Reader.java
  68. +1 −59 core/src/com/google/zxing/ReaderException.java
  69. +16 −20 core/src/com/google/zxing/Result.java
  70. +9 −43 core/src/com/google/zxing/ResultMetadataType.java
  71. +9 −4 core/src/com/google/zxing/ResultPoint.java
  72. +6 −2 core/src/com/google/zxing/Writer.java
  73. +0 −1  core/src/com/google/zxing/WriterException.java
  74. +5 −1 core/src/com/google/zxing/aztec/AztecDetectorResult.java
  75. +9 −6 core/src/com/google/zxing/aztec/AztecReader.java
  76. +29 −36 core/src/com/google/zxing/aztec/decoder/Decoder.java
  77. +14 −11 core/src/com/google/zxing/aztec/detector/Detector.java
  78. +10 −8 core/src/com/google/zxing/client/result/AddressBookAUResultParser.java
  79. +3 −2 core/src/com/google/zxing/client/result/AddressBookDoCoMoResultParser.java
  80. +3 −2 core/src/com/google/zxing/client/result/AddressBookParsedResult.java
  81. +13 −13 core/src/com/google/zxing/client/result/BizcardResultParser.java
  82. +4 −9 core/src/com/google/zxing/client/result/BookmarkDoCoMoResultParser.java
  83. +4 −3 core/src/com/google/zxing/client/result/CalendarParsedResult.java
  84. +6 −2 core/src/com/google/zxing/client/result/EmailAddressParsedResult.java
  85. +8 −7 core/src/com/google/zxing/client/result/EmailAddressResultParser.java
  86. +8 −32 core/src/com/google/zxing/client/result/EmailDoCoMoResultParser.java
  87. +8 −5 core/src/com/google/zxing/client/result/ExpandedProductParsedResult.java
  88. +9 −12 core/src/com/google/zxing/client/result/ExpandedProductResultParser.java
  89. +3 −34 core/src/com/google/zxing/client/result/GeoParsedResult.java
  90. +26 −28 core/src/com/google/zxing/client/result/GeoResultParser.java
  91. +1 −0  core/src/com/google/zxing/client/result/ISBNParsedResult.java
  92. +7 −8 core/src/com/google/zxing/client/result/ISBNResultParser.java
  93. +6 −5 core/src/com/google/zxing/client/result/ParsedResult.java
  94. +12 −26 core/src/com/google/zxing/client/result/ParsedResultType.java
  95. +1 −0  core/src/com/google/zxing/client/result/ProductParsedResult.java
  96. +6 −8 core/src/com/google/zxing/client/result/ProductResultParser.java
  97. +89 −178 core/src/com/google/zxing/client/result/ResultParser.java
  98. +23 −18 core/src/com/google/zxing/client/result/SMSMMSResultParser.java
  99. +11 −4 core/src/com/google/zxing/client/result/SMSParsedResult.java
  100. +4 −6 core/src/com/google/zxing/client/result/SMSTOMMSTOResultParser.java
  101. +4 −6 core/src/com/google/zxing/client/result/SMTPResultParser.java
  102. +2 −1  core/src/com/google/zxing/client/result/TelParsedResult.java
  103. +3 −5 core/src/com/google/zxing/client/result/TelResultParser.java
  104. +1 −0  core/src/com/google/zxing/client/result/TextParsedResult.java
  105. +9 −20 core/src/com/google/zxing/client/result/URIParsedResult.java
  106. +9 −17 core/src/com/google/zxing/client/result/URIResultParser.java
  107. +3 −5 core/src/com/google/zxing/client/result/URLTOResultParser.java
  108. +96 −180 core/src/com/google/zxing/client/result/VCardResultParser.java
  109. +9 −10 core/src/com/google/zxing/client/result/VEventResultParser.java
  110. +3 −1 core/src/com/google/zxing/client/result/WifiParsedResult.java
  111. +3 −6 core/src/com/google/zxing/client/result/WifiResultParser.java
  112. +0 −45 core/src/com/google/zxing/client/result/optional/AbstractNDEFResultParser.java
  113. +0 −87 core/src/com/google/zxing/client/result/optional/NDEFRecord.java
  114. +0 −63 core/src/com/google/zxing/client/result/optional/NDEFSmartPosterParsedResult.java
  115. +0 −81 core/src/com/google/zxing/client/result/optional/NDEFSmartPosterResultParser.java
  116. +0 −57 core/src/com/google/zxing/client/result/optional/NDEFTextResultParser.java
  117. +0 −95 core/src/com/google/zxing/client/result/optional/NDEFURIResultParser.java
  118. +7 −9 core/src/com/google/zxing/common/BitArray.java
  119. +15 −12 core/src/com/google/zxing/common/BitMatrix.java
  120. +43 −46 core/src/com/google/zxing/common/CharacterSetECI.java
  121. +0 −53 core/src/com/google/zxing/common/Collections.java
  122. +7 −4 core/src/com/google/zxing/common/DecoderResult.java
  123. +2 −0  core/src/com/google/zxing/common/DefaultGridSampler.java
  124. +0 −52 core/src/com/google/zxing/common/ECI.java
  125. +8 −3 core/src/com/google/zxing/common/GlobalHistogramBinarizer.java
  126. +2 −1  core/src/com/google/zxing/common/GridSampler.java
  127. +2 −0  core/src/com/google/zxing/common/HybridBinarizer.java
  128. +9 −1 core/src/com/google/zxing/common/PerspectiveTransform.java
  129. +2 −2 core/src/com/google/zxing/common/StringUtils.java
  130. +10 −4 core/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java
  131. +2 −2 core/src/com/google/zxing/common/reedsolomon/GenericGF.java
  132. +2 −1  core/src/com/google/zxing/common/reedsolomon/GenericGFPoly.java
  133. +3 −1 core/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoder.java
  134. +8 −7 core/src/com/google/zxing/common/reedsolomon/ReedSolomonEncoder.java
  135. +12 −6 core/src/com/google/zxing/datamatrix/DataMatrixReader.java
  136. +3 −4 core/src/com/google/zxing/datamatrix/decoder/DataBlock.java
  137. +45 −35 core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java
  138. +2 −2 core/src/com/google/zxing/datamatrix/decoder/Version.java
  139. +42 −35 core/src/com/google/zxing/datamatrix/detector/Detector.java
  140. +8 −4 core/src/com/google/zxing/maxicode/MaxiCodeReader.java
  141. +90 −90 core/src/com/google/zxing/maxicode/decoder/BitMatrixParser.java
  142. +7 −6 core/src/com/google/zxing/maxicode/decoder/DecodedBitStreamParser.java
  143. +9 −11 core/src/com/google/zxing/maxicode/decoder/Decoder.java
  144. +6 −2 core/src/com/google/zxing/multi/ByQuadrantReader.java
  145. +16 −19 core/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java
  146. +4 −2 core/src/com/google/zxing/multi/MultipleBarcodeReader.java
  147. +16 −16 core/src/com/google/zxing/multi/qrcode/QRCodeMultiReader.java
  148. +11 −13 core/src/com/google/zxing/multi/qrcode/detector/MultiDetector.java
  149. +28 −35 core/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java
  150. +14 −13 core/src/com/google/zxing/oned/CodaBarReader.java
  151. +1 −0  core/src/com/google/zxing/oned/CodaBarWriter.java
  152. +15 −13 core/src/com/google/zxing/oned/Code128Reader.java
  153. +17 −18 core/src/com/google/zxing/oned/Code128Writer.java
  154. +12 −12 core/src/com/google/zxing/oned/Code39Reader.java
  155. +8 −4 core/src/com/google/zxing/oned/Code39Writer.java
  156. +13 −13 core/src/com/google/zxing/oned/Code93Reader.java
  157. +10 −7 core/src/com/google/zxing/oned/EAN13Reader.java
  158. +9 −4 core/src/com/google/zxing/oned/EAN13Writer.java
  159. +9 −6 core/src/com/google/zxing/oned/EAN8Reader.java
  160. +9 −3 core/src/com/google/zxing/oned/EAN8Writer.java
  161. +8 −7 core/src/com/google/zxing/oned/EANManufacturerOrgSupport.java
  162. +19 −17 core/src/com/google/zxing/oned/ITFReader.java
  163. +6 −2 core/src/com/google/zxing/oned/ITFWriter.java
  164. +32 −30 core/src/com/google/zxing/oned/MultiFormatOneDReader.java
  165. +27 −24 core/src/com/google/zxing/oned/MultiFormatUPCEANReader.java
  166. +23 −19 core/src/com/google/zxing/oned/OneDReader.java
  167. +7 −4 core/src/com/google/zxing/oned/OneDimensionalCodeWriter.java
  168. +16 −5 core/src/com/google/zxing/oned/UPCAReader.java
  169. +9 −3 core/src/com/google/zxing/oned/UPCAWriter.java
  170. +16 −13 core/src/com/google/zxing/oned/UPCEANExtensionSupport.java
  171. +24 −21 core/src/com/google/zxing/oned/UPCEANReader.java
  172. +0 −2  core/src/com/google/zxing/oned/UPCEANWriter.java
  173. +9 −5 core/src/com/google/zxing/oned/UPCEReader.java
  174. +34 −11 core/src/com/google/zxing/oned/rss/AbstractRSSReader.java
  175. +36 −39 core/src/com/google/zxing/oned/rss/RSS14Reader.java
  176. +2 −2 core/src/com/google/zxing/oned/rss/RSSUtils.java
  177. +6 −6 core/src/com/google/zxing/oned/rss/expanded/BitArrayBuilder.java
  178. +4 −1 core/src/com/google/zxing/oned/rss/expanded/ExpandedPair.java
  179. +59 −50 core/src/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
  180. +3 −1 core/src/com/google/zxing/oned/rss/expanded/decoders/AI013103decoder.java
  181. +3 −1 core/src/com/google/zxing/oned/rss/expanded/decoders/AI01320xDecoder.java
  182. +5 −4 core/src/com/google/zxing/oned/rss/expanded/decoders/AI01392xDecoder.java
  183. +6 −5 core/src/com/google/zxing/oned/rss/expanded/decoders/AI01393xDecoder.java
  184. +9 −6 core/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0x1xDecoder.java
  185. +3 −2 core/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0xDecoder.java
  186. +4 −3 core/src/com/google/zxing/oned/rss/expanded/decoders/AI01AndOtherAIs.java
  187. +4 −4 core/src/com/google/zxing/oned/rss/expanded/decoders/AI01decoder.java
  188. +3 −3 core/src/com/google/zxing/oned/rss/expanded/decoders/AI01weightDecoder.java
  189. +11 −5 core/src/com/google/zxing/oned/rss/expanded/decoders/AbstractExpandedDecoder.java
  190. +3 −2 core/src/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoder.java
  191. +1 −1  core/src/com/google/zxing/oned/rss/expanded/decoders/BlockParsedResult.java
  192. +30 −16 core/src/com/google/zxing/oned/rss/expanded/decoders/CurrentParsingState.java
  193. +5 −4 core/src/com/google/zxing/oned/rss/expanded/decoders/DecodedInformation.java
  194. +1 −1  core/src/com/google/zxing/oned/rss/expanded/decoders/DecodedObject.java
  195. +145 −144 core/src/com/google/zxing/oned/rss/expanded/decoders/FieldParser.java
  196. +153 −97 core/src/com/google/zxing/oned/rss/expanded/decoders/GeneralAppIdDecoder.java
  197. +6 −2 core/src/com/google/zxing/pdf417/PDF417Reader.java
  198. +0 −214 core/src/com/google/zxing/pdf417/decoder/BitMatrixParser.java
  199. +55 −164 core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java
  200. +3 −2 core/src/com/google/zxing/pdf417/decoder/Decoder.java
  201. +21 −21 core/src/com/google/zxing/pdf417/detector/Detector.java
  202. +13 −9 core/src/com/google/zxing/pdf417/encoder/PDF417.java
  203. +2 −2 core/src/com/google/zxing/pdf417/encoder/PDF417ErrorCorrection.java
  204. +24 −43 core/src/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java
  205. +23 −12 core/src/com/google/zxing/pdf417/encoder/PDF417Writer.java
  206. +8 −5 core/src/com/google/zxing/qrcode/QRCodeReader.java
  207. +8 −3 core/src/com/google/zxing/qrcode/QRCodeWriter.java
  208. +3 −4 core/src/com/google/zxing/qrcode/decoder/DataBlock.java
  209. +8 −0 core/src/com/google/zxing/qrcode/decoder/DataMask.java
  210. +35 −30 core/src/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java
  211. +9 −7 core/src/com/google/zxing/qrcode/decoder/Decoder.java
  212. +10 −36 core/src/com/google/zxing/qrcode/decoder/ErrorCorrectionLevel.java
  213. +4 −3 core/src/com/google/zxing/qrcode/decoder/FormatInformation.java
  214. +12 −24 core/src/com/google/zxing/qrcode/decoder/Mode.java
  215. +10 −18 core/src/com/google/zxing/qrcode/decoder/Version.java
  216. +9 −11 core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java
  217. +6 −4 core/src/com/google/zxing/qrcode/detector/Detector.java
  218. +1 −1  core/src/com/google/zxing/qrcode/detector/FinderPattern.java
  219. +42 −42 core/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java
  220. +2 −1  core/src/com/google/zxing/qrcode/encoder/ByteMatrix.java
  221. +59 −40 core/src/com/google/zxing/qrcode/encoder/Encoder.java
  222. +12 −8 core/src/com/google/zxing/qrcode/encoder/MatrixUtil.java
  223. +3 −3 core/src/com/google/zxing/qrcode/encoder/QRCode.java
  224. +2 −74 core/test/src/com/google/zxing/AllPositiveBlackBoxTester.java
  225. +124 −0 core/test/src/com/google/zxing/BufferedImageLuminanceSource.java
  226. +6 −0 core/test/src/com/google/zxing/client/result/AddressBookParsedResultTestCase.java
  227. +4 −1 core/test/src/com/google/zxing/client/result/EmailAddressParsedResultTestCase.java
  228. +20 −33 core/test/src/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java
  229. +1 −0  core/test/src/com/google/zxing/client/result/GeoParsedResultTestCase.java
  230. +6 −2 core/test/src/com/google/zxing/client/result/ParsedReaderResultTestCase.java
  231. +10 −2 core/test/src/com/google/zxing/client/result/SMSMMSParsedResultTestCase.java
  232. +24 −15 core/test/src/com/google/zxing/client/result/URIParsedResultTestCase.java
  233. +43 −98 core/test/src/com/google/zxing/common/AbstractBlackBoxTestCase.java
  234. +7 −2 core/test/src/com/google/zxing/common/AbstractNegativeBlackBoxTestCase.java
  235. +0 −47 core/test/src/com/google/zxing/common/CollectionsTestCase.java
  236. +49 −0 core/test/src/com/google/zxing/common/SummaryResults.java
  237. +24 −8 core/{src/com/google/zxing/common/Comparator.java → test/src/com/google/zxing/common/TestResult.java}
  238. +7 −2 core/test/src/com/google/zxing/common/reedsolomon/AbstractReedSolomonTestCase.java
  239. +16 −29 core/test/src/com/google/zxing/oned/rss/expanded/BinaryUtil.java
  240. +7 −3 core/test/src/com/google/zxing/oned/rss/expanded/BinaryUtilTest.java
  241. +5 −7 core/test/src/com/google/zxing/oned/rss/expanded/BitArrayBuilderTest.java
  242. +3 −3 core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java
  243. +8 −6 core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java
  244. +2 −3 core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java
  245. +5 −4 core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedInternalTestCase.java
  246. +3 −11 core/test/src/com/google/zxing/oned/rss/expanded/decoders/AI01_3103_DecoderTest.java
  247. +2 −2 core/test/src/com/google/zxing/oned/rss/expanded/decoders/AbstractDecoderTest.java
  248. +0 −13 core/test/src/com/google/zxing/pdf417/PDF417BlackBox1TestCase.java
  249. +0 −13 core/test/src/com/google/zxing/pdf417/PDF417BlackBox2TestCase.java
  250. +7 −4 core/test/src/com/google/zxing/qrcode/QRCodeWriterTestCase.java
  251. +8 −0 core/test/src/com/google/zxing/qrcode/decoder/DataMaskTestCase.java
  252. +1 −1  core/test/src/com/google/zxing/qrcode/decoder/VersionTestCase.java
  253. +1 −1  core/test/src/com/google/zxing/qrcode/encoder/QRCodeTestCase.java
  254. +0 −12 javame/BarcodeReader.jad.template
  255. +0 −196 javame/build.xml
  256. BIN  javame/res/zxing-icon.png
  257. +0 −144 javame/src/com/google/zxing/client/j2me/AdvancedMultimediaManager.java
  258. +0 −40 javame/src/com/google/zxing/client/j2me/DefaultMultimediaManager.java
  259. +0 −153 javame/src/com/google/zxing/client/j2me/LCDUIImageLuminanceSource.java
  260. +0 −11 javame/src/com/google/zxing/client/j2me/MANIFEST.MF.template
  261. +0 −96 javame/src/com/google/zxing/client/j2me/Menu.java
  262. +0 −39 javame/src/com/google/zxing/client/j2me/MultimediaManager.java
  263. +0 −143 javame/src/com/google/zxing/client/j2me/SnapshotThread.java
  264. +0 −125 javame/src/com/google/zxing/client/j2me/SplashThread.java
  265. +0 −71 javame/src/com/google/zxing/client/j2me/VideoCanvas.java
  266. +0 −293 javame/src/com/google/zxing/client/j2me/ZXingMIDlet.java
  267. +2 −2 javase/build.xml
  268. +2 −2 javase/pom.xml
  269. +2 −1  javase/src/com/google/zxing/HtmlAssetTranslator.java
  270. +7 −4 javase/src/com/google/zxing/StringsResourceTranslator.java
  271. +27 −25 javase/src/com/google/zxing/client/j2se/CommandLineRunner.java
  272. +4 −4 javase/src/com/google/zxing/client/j2se/Config.java
  273. +12 −14 javase/src/com/google/zxing/client/j2se/DecodeThread.java
  274. +2 −2 javase/src/com/google/zxing/client/j2se/MatrixToImageWriter.java
  275. BIN  jruby/lib/core.jar
  276. BIN  jruby/lib/javase.jar
  277. +0 −11 rim/BarcodeReader.alx.template
  278. +0 −11 rim/BarcodeReader.jad.template
  279. +0 −125 rim/build.xml
  280. BIN  rim/res/zxing-icon.png
  281. +0 −67 rim/src/com/google/zxing/client/rim/AboutScreen.java
  282. +0 −67 rim/src/com/google/zxing/client/rim/AppPermissionsManager.java
  283. +0 −213 rim/src/com/google/zxing/client/rim/Camera.java
  284. +0 −65 rim/src/com/google/zxing/client/rim/HelpScreen.java
  285. +0 −81 rim/src/com/google/zxing/client/rim/HistoryScreen.java
  286. +0 −51 rim/src/com/google/zxing/client/rim/QRCapturedJournalListener.java
  287. +0 −104 rim/src/com/google/zxing/client/rim/SettingsScreen.java
  288. +0 −335 rim/src/com/google/zxing/client/rim/ZXingLMMainScreen.java
  289. +0 −44 rim/src/com/google/zxing/client/rim/ZXingUiApplication.java
  290. +0 −100 rim/src/com/google/zxing/client/rim/persistence/AppSettings.java
  291. +0 −101 rim/src/com/google/zxing/client/rim/persistence/history/DecodeHistory.java
  292. +0 −60 rim/src/com/google/zxing/client/rim/persistence/history/DecodeHistoryItem.java
  293. +0 −83 rim/src/com/google/zxing/client/rim/util/Log.java
  294. +0 −75 rim/src/com/google/zxing/client/rim/util/ReasonableTimer.java
  295. +0 −84 rim/src/com/google/zxing/client/rim/util/URLDecoder.java
  296. +2 −2 zxingorg/build.xml
  297. +0 −50 zxingorg/src/com/google/zxing/web/DecodeEmailListener.java
  298. +0 −194 zxingorg/src/com/google/zxing/web/DecodeEmailTask.java
  299. +13 −27 zxingorg/src/com/google/zxing/web/DecodeServlet.java
  300. +3 −0  zxingorg/src/com/google/zxing/web/DoSFilter.java
Sorry, we could not display the entire diff because too many files (320) changed.
View
11 README
@@ -1,11 +0,0 @@
-Please refer to the project page for more information:
-http://code.google.com/p/zxing/
-in particular:
-http://code.google.com/p/zxing/wiki/GettingStarted
-
-To get started, you can try building and running the command-line client;
-you will need to have Apache's Ant tool installed to run this:
-
-ant -f core/build.xml
-ant -f javase/build.xml
-java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner [URL]
View
4 android-integration/build.xml
@@ -28,8 +28,8 @@
<mkdir dir="build"/>
<javac srcdir="src"
destdir="build"
- source="1.5"
- target="1.5"
+ source="6"
+ target="6"
optimize="true"
debug="true"
deprecation="true"
View
2  android-integration/pom.xml
@@ -20,7 +20,7 @@
<artifactId>android-integration</artifactId>
<packaging>jar</packaging>
<name>ZXing Android Integration lib</name>
- <version>1.6-SNAPSHOT</version>
+ <version>2.0-SNAPSHOT</version>
<description>Integration helper classes for Android applications wanting to create/scan bar codes</description>
<url>http://code.google.com/p/zxing/</url>
<inceptionYear>2007</inceptionYear>
View
4 android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java
@@ -103,7 +103,7 @@
static {
Method temp;
try {
- temp = Intent.class.getMethod("setPackage", new Class[] {String.class});
+ temp = Intent.class.getMethod("setPackage", String.class);
} catch (NoSuchMethodException nsme) {
temp = null;
}
@@ -212,6 +212,7 @@ private static AlertDialog showDownloadDialog(final Activity activity,
downloadDialog.setTitle(stringTitle);
downloadDialog.setMessage(stringMessage);
downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
Uri uri = Uri.parse("market://search?q=pname:" + PACKAGE);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -224,6 +225,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
}
});
downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {}
});
return downloadDialog.show();
View
2  android/assets/html-en/scanning.html
@@ -4,7 +4,7 @@
<link rel="stylesheet" href="../style.css" type="text/css"/>
</head>
<body>
-<p>Barcode Scanner continuously scans a square region shown on your screen &mdash; just line up the
+<p>Barcode Scanner continuously scans a square region shown on your screen -- just line up the
phone so the barcode is completely inside the viewfinder rectangle:</p>
<p style="text-align:center">
<img src="../images/demo-yes.png" alt="Yes"/>&nbsp;&nbsp;&nbsp;<img src="../images/demo-no.png" alt="No"/>
View
1  android/src/com/google/zxing/client/android/BeepManager.java
@@ -88,6 +88,7 @@ private static MediaPlayer buildMediaPlayer(Context activity) {
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
// When the beep has finished playing, rewind to queue up another one.
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+ @Override
public void onCompletion(MediaPlayer player) {
player.seekTo(0);
}
View
50 android/src/com/google/zxing/client/android/CaptureActivity.java
@@ -63,11 +63,11 @@
import java.io.IOException;
import java.text.DateFormat;
+import java.util.Collection;
import java.util.Date;
-import java.util.HashSet;
+import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
/**
* This activity opens the camera and does the actual scanning on a background thread. It draws a
@@ -97,14 +97,11 @@
private static final String RETURN_CODE_PLACEHOLDER = "{CODE}";
private static final String RETURN_URL_PARAM = "ret";
- private static final Set<ResultMetadataType> DISPLAYABLE_METADATA_TYPES;
- static {
- DISPLAYABLE_METADATA_TYPES = new HashSet<ResultMetadataType>(5);
- DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.ISSUE_NUMBER);
- DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.SUGGESTED_PRICE);
- DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.ERROR_CORRECTION_LEVEL);
- DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.POSSIBLE_COUNTRY);
- }
+ private static final Set<ResultMetadataType> DISPLAYABLE_METADATA_TYPES =
+ EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
+ ResultMetadataType.SUGGESTED_PRICE,
+ ResultMetadataType.ERROR_CORRECTION_LEVEL,
+ ResultMetadataType.POSSIBLE_COUNTRY);
private enum Source {
NATIVE_APP_INTENT,
@@ -123,7 +120,7 @@
private Source source;
private String sourceUrl;
private String returnUrlTemplate;
- private Vector<BarcodeFormat> decodeFormats;
+ private Collection<BarcodeFormat> decodeFormats;
private String characterSet;
private String versionName;
private HistoryManager historyManager;
@@ -132,6 +129,7 @@
private final DialogInterface.OnClickListener aboutListener =
new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.zxing_url)));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
@@ -313,33 +311,25 @@ public boolean onPrepareOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
switch (item.getItemId()) {
- case SHARE_ID: {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+ case SHARE_ID:
intent.setClassName(this, ShareActivity.class.getName());
startActivity(intent);
break;
- }
- case HISTORY_ID: {
+ case HISTORY_ID:
AlertDialog historyAlert = historyManager.buildAlert();
historyAlert.show();
break;
- }
- case SETTINGS_ID: {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+ case SETTINGS_ID:
intent.setClassName(this, PreferencesActivity.class.getName());
startActivity(intent);
break;
- }
- case HELP_ID: {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+ case HELP_ID:
intent.setClassName(this, HelpActivity.class.getName());
startActivity(intent);
break;
- }
case ABOUT_ID:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.title_about) + versionName);
@@ -353,6 +343,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
+ @Override
public void surfaceCreated(SurfaceHolder holder) {
if (holder == null) {
Log.e(TAG, "*** WARNING *** surfaceCreated() gave us a null surface!");
@@ -363,10 +354,12 @@ public void surfaceCreated(SurfaceHolder holder) {
}
}
+ @Override
public void surfaceDestroyed(SurfaceHolder holder) {
hasSurface = false;
}
+ @Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@@ -440,8 +433,8 @@ private void drawResultPoints(Bitmap barcode, Result rawResult) {
paint.setStrokeWidth(4.0f);
drawLine(canvas, paint, points[0], points[1]);
} else if (points.length == 4 &&
- (rawResult.getBarcodeFormat().equals(BarcodeFormat.UPC_A) ||
- rawResult.getBarcodeFormat().equals(BarcodeFormat.EAN_13))) {
+ (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A ||
+ rawResult.getBarcodeFormat() == BarcodeFormat.EAN_13)) {
// Hacky special case -- draw two lines, for the barcode and metadata
drawLine(canvas, paint, points[0], points[1]);
drawLine(canvas, paint, points[2], points[3]);
@@ -488,8 +481,7 @@ private void handleDecodeInternally(Result rawResult, ResultHandler resultHandle
View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
metaTextView.setVisibility(View.GONE);
metaTextViewLabel.setVisibility(View.GONE);
- Map<ResultMetadataType,Object> metadata =
- (Map<ResultMetadataType,Object>) rawResult.getResultMetadata();
+ Map<ResultMetadataType,Object> metadata = rawResult.getResultMetadata();
if (metadata != null) {
StringBuilder metadataText = new StringBuilder(20);
for (Map.Entry<ResultMetadataType,Object> entry : metadata.entrySet()) {
View
7 android/src/com/google/zxing/client/android/CaptureActivityHandler.java
@@ -29,7 +29,7 @@
import android.os.Message;
import android.util.Log;
-import java.util.Vector;
+import java.util.Collection;
/**
* This class handles all the messaging which comprises the state machine for capture.
@@ -50,7 +50,7 @@
DONE
}
- CaptureActivityHandler(CaptureActivity activity, Vector<BarcodeFormat> decodeFormats,
+ CaptureActivityHandler(CaptureActivity activity, Collection<BarcodeFormat> decodeFormats,
String characterSet) {
this.activity = activity;
decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
@@ -112,7 +112,8 @@ public void quitSynchronously() {
Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
quit.sendToTarget();
try {
- decodeThread.join();
+ // Wait at most half a second; should be enough time, and onPause() will timeout quickly
+ decodeThread.join(500L);
} catch (InterruptedException e) {
// continue
}
View
45 android/src/com/google/zxing/client/android/DecodeFormatManager.java
@@ -17,8 +17,9 @@
package com.google.zxing.client.android;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumSet;
import java.util.List;
-import java.util.Vector;
import java.util.regex.Pattern;
import android.content.Intent;
@@ -29,32 +30,26 @@
private static final Pattern COMMA_PATTERN = Pattern.compile(",");
- static final Vector<BarcodeFormat> PRODUCT_FORMATS;
- static final Vector<BarcodeFormat> ONE_D_FORMATS;
- static final Vector<BarcodeFormat> QR_CODE_FORMATS;
- static final Vector<BarcodeFormat> DATA_MATRIX_FORMATS;
+ static final Collection<BarcodeFormat> PRODUCT_FORMATS;
+ static final Collection<BarcodeFormat> ONE_D_FORMATS;
+ static final Collection<BarcodeFormat> QR_CODE_FORMATS = EnumSet.of(BarcodeFormat.QR_CODE);
+ static final Collection<BarcodeFormat> DATA_MATRIX_FORMATS = EnumSet.of(BarcodeFormat.DATA_MATRIX);
static {
- PRODUCT_FORMATS = new Vector<BarcodeFormat>(5);
- PRODUCT_FORMATS.add(BarcodeFormat.UPC_A);
- PRODUCT_FORMATS.add(BarcodeFormat.UPC_E);
- PRODUCT_FORMATS.add(BarcodeFormat.EAN_13);
- PRODUCT_FORMATS.add(BarcodeFormat.EAN_8);
- PRODUCT_FORMATS.add(BarcodeFormat.RSS_14);
- ONE_D_FORMATS = new Vector<BarcodeFormat>(PRODUCT_FORMATS.size() + 4);
+ PRODUCT_FORMATS = EnumSet.of(BarcodeFormat.UPC_A,
+ BarcodeFormat.UPC_E,
+ BarcodeFormat.EAN_13,
+ BarcodeFormat.EAN_8,
+ BarcodeFormat.RSS_14);
+ ONE_D_FORMATS = EnumSet.of(BarcodeFormat.CODE_39,
+ BarcodeFormat.CODE_93,
+ BarcodeFormat.CODE_128,
+ BarcodeFormat.ITF);
ONE_D_FORMATS.addAll(PRODUCT_FORMATS);
- ONE_D_FORMATS.add(BarcodeFormat.CODE_39);
- ONE_D_FORMATS.add(BarcodeFormat.CODE_93);
- ONE_D_FORMATS.add(BarcodeFormat.CODE_128);
- ONE_D_FORMATS.add(BarcodeFormat.ITF);
- QR_CODE_FORMATS = new Vector<BarcodeFormat>(1);
- QR_CODE_FORMATS.add(BarcodeFormat.QR_CODE);
- DATA_MATRIX_FORMATS = new Vector<BarcodeFormat>(1);
- DATA_MATRIX_FORMATS.add(BarcodeFormat.DATA_MATRIX);
}
private DecodeFormatManager() {}
- static Vector<BarcodeFormat> parseDecodeFormats(Intent intent) {
+ static Collection<BarcodeFormat> parseDecodeFormats(Intent intent) {
List<String> scanFormats = null;
String scanFormatsString = intent.getStringExtra(Intents.Scan.FORMATS);
if (scanFormatsString != null) {
@@ -63,7 +58,7 @@ private DecodeFormatManager() {}
return parseDecodeFormats(scanFormats, intent.getStringExtra(Intents.Scan.MODE));
}
- static Vector<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
+ static Collection<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
List<String> formats = inputUri.getQueryParameters(Intents.Scan.FORMATS);
if (formats != null && formats.size() == 1 && formats.get(0) != null){
formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0)));
@@ -71,10 +66,10 @@ private DecodeFormatManager() {}
return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
}
- private static Vector<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats,
- String decodeMode) {
+ private static Collection<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats,
+ String decodeMode) {
if (scanFormats != null) {
- Vector<BarcodeFormat> formats = new Vector<BarcodeFormat>();
+ Collection<BarcodeFormat> formats = EnumSet.noneOf(BarcodeFormat.class);
try {
for (String format : scanFormats) {
formats.add(BarcodeFormat.valueOf(format));
View
4 android/src/com/google/zxing/client/android/DecodeHandler.java
@@ -30,7 +30,7 @@
import android.os.Message;
import android.util.Log;
-import java.util.Hashtable;
+import java.util.Map;
final class DecodeHandler extends Handler {
@@ -40,7 +40,7 @@
private final MultiFormatReader multiFormatReader;
private boolean running = true;
- DecodeHandler(CaptureActivity activity, Hashtable<DecodeHintType, Object> hints) {
+ DecodeHandler(CaptureActivity activity, Map<DecodeHintType,Object> hints) {
multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(hints);
this.activity = activity;
View
14 android/src/com/google/zxing/client/android/DecodeThread.java
@@ -25,8 +25,10 @@
import android.os.Looper;
import android.preference.PreferenceManager;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.Map;
import java.util.concurrent.CountDownLatch;
/**
@@ -39,24 +41,24 @@
public static final String BARCODE_BITMAP = "barcode_bitmap";
private final CaptureActivity activity;
- private final Hashtable<DecodeHintType, Object> hints;
+ private final Map<DecodeHintType,Object> hints;
private Handler handler;
private final CountDownLatch handlerInitLatch;
DecodeThread(CaptureActivity activity,
- Vector<BarcodeFormat> decodeFormats,
+ Collection<BarcodeFormat> decodeFormats,
String characterSet,
ResultPointCallback resultPointCallback) {
this.activity = activity;
handlerInitLatch = new CountDownLatch(1);
- hints = new Hashtable<DecodeHintType, Object>(3);
+ hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
// The prefs can't change while the thread is running, so pick them up once here.
if (decodeFormats == null || decodeFormats.isEmpty()) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
- decodeFormats = new Vector<BarcodeFormat>();
+ decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D, true)) {
decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
}
View
3  android/src/com/google/zxing/client/android/FinishListener.java
@@ -33,14 +33,17 @@ public FinishListener(Activity activityToFinish) {
this.activityToFinish = activityToFinish;
}
+ @Override
public void onCancel(DialogInterface dialogInterface) {
run();
}
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
run();
}
+ @Override
public void run() {
activityToFinish.finish();
}
View
3  android/src/com/google/zxing/client/android/HelpActivity.java
@@ -64,12 +64,14 @@
private Button backButton;
private final Button.OnClickListener backListener = new Button.OnClickListener() {
+ @Override
public void onClick(View view) {
webView.goBack();
}
};
private final Button.OnClickListener doneListener = new Button.OnClickListener() {
+ @Override
public void onClick(View view) {
finish();
}
@@ -77,6 +79,7 @@ public void onClick(View view) {
private final DialogInterface.OnClickListener groupsListener =
new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(Intent.ACTION_VIEW, BUGGY_URI);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
View
7 android/src/com/google/zxing/client/android/HttpHelper.java
@@ -24,6 +24,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.URLConnection;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -41,7 +42,7 @@
private HttpHelper() {
}
-
+
public enum ContentType {
/** HTML-like content type, including HTML, XHTML, etc. */
HTML,
@@ -90,7 +91,7 @@ private static String downloadViaHttp(String uri, String contentTypes) throws IO
}
}
- private static String getEncoding(HttpURLConnection connection) {
+ private static String getEncoding(URLConnection connection) {
String contentTypeHeader = connection.getHeaderField("Content-Type");
if (contentTypeHeader != null) {
int charsetStart = contentTypeHeader.indexOf("charset=");
@@ -101,7 +102,7 @@ private static String getEncoding(HttpURLConnection connection) {
return "UTF-8";
}
- private static String consume(HttpURLConnection connection) throws IOException {
+ private static String consume(URLConnection connection) throws IOException {
String encoding = getEncoding(connection);
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = connection.getInputStream();
View
17 android/src/com/google/zxing/client/android/InactivityTimer.java
@@ -40,7 +40,7 @@
Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory());
private final Activity activity;
private ScheduledFuture<?> inactivityFuture = null;
- private final PowerStatusReceiver powerStatusReceiver = new PowerStatusReceiver();
+ private final BroadcastReceiver powerStatusReceiver = new PowerStatusReceiver();
InactivityTimer(Activity activity) {
this.activity = activity;
@@ -61,17 +61,20 @@ void onActivity() {
}
}
- public void onPause(){
+ public void onPause() {
+ cancel();
activity.unregisterReceiver(powerStatusReceiver);
}
public void onResume(){
activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ onActivity();
}
private void cancel() {
- if (inactivityFuture != null) {
- inactivityFuture.cancel(true);
+ ScheduledFuture<?> future = inactivityFuture;
+ if (future != null) {
+ future.cancel(true);
inactivityFuture = null;
}
}
@@ -82,6 +85,7 @@ void shutdown() {
}
private static final class DaemonThreadFactory implements ThreadFactory {
+ @Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
thread.setDaemon(true);
@@ -95,9 +99,8 @@ public void onReceive(Context context, Intent intent){
if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
// 0 indicates that we're on battery
// In Android 2.0+, use BatteryManager.EXTRA_PLUGGED
- if (intent.getIntExtra("plugged", -1) == 0) {
- InactivityTimer.this.onActivity();
- } else {
+ int batteryPlugged = intent.getIntExtra("plugged", -1);
+ if (batteryPlugged > 0) {
InactivityTimer.this.cancel();
}
}
View
1  android/src/com/google/zxing/client/android/PreferencesActivity.java
@@ -68,6 +68,7 @@ protected void onCreate(Bundle icicle) {
disableLastCheckedPref();
}
+ @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
disableLastCheckedPref();
}
View
1  android/src/com/google/zxing/client/android/ViewfinderResultPointCallback.java
@@ -27,6 +27,7 @@
this.viewfinderView = viewfinderView;
}
+ @Override
public void foundPossibleResultPoint(ResultPoint point) {
viewfinderView.addPossibleResultPoint(point);
}
View
1  android/src/com/google/zxing/client/android/book/BrowseBookListener.java
@@ -34,6 +34,7 @@
this.items = items;
}
+ @Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
if (position < 1) {
// Clicked header, ignore it
View
2  android/src/com/google/zxing/client/android/book/SearchBookContentsActivity.java
@@ -82,12 +82,14 @@ public void handleMessage(Message message) {
};
private final Button.OnClickListener buttonListener = new Button.OnClickListener() {
+ @Override
public void onClick(View view) {
launchSearch();
}
};
private final View.OnKeyListener keyListener = new View.OnKeyListener() {
+ @Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
launchSearch();
View
1  android/src/com/google/zxing/client/android/camera/AutoFocusCallback.java
@@ -35,6 +35,7 @@ void setHandler(Handler autoFocusHandler, int autoFocusMessage) {
this.autoFocusMessage = autoFocusMessage;
}
+ @Override
public void onAutoFocus(boolean success, Camera camera) {
if (autoFocusHandler != null) {
Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
View
1  android/src/com/google/zxing/client/android/camera/PreviewCallback.java
@@ -41,6 +41,7 @@ void setHandler(Handler previewHandler, int previewMessage) {
this.previewMessage = previewMessage;
}
+ @Override
public void onPreviewFrame(byte[] data, Camera camera) {
Point cameraResolution = configManager.getCameraResolution();
if (!useOneShotPreviewCallback) {
View
9 android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
@@ -42,8 +42,9 @@
import java.io.InputStream;
import java.util.Collection;
import java.util.Collections;
+import java.util.EnumMap;
import java.util.HashSet;
-import java.util.Hashtable;
+import java.util.Map;
/**
* This class does the work of decoding the user's request and extracting all the data
@@ -104,7 +105,7 @@ private boolean encodeContentsFromZXingIntent(Intent intent) {
// Ignore it then
format = null;
}
- if (format == null || BarcodeFormat.QR_CODE.equals(format)) {
+ if (format == null || format == BarcodeFormat.QR_CODE) {
String type = intent.getStringExtra(Intents.Encode.TYPE);
if (type == null || type.length() == 0) {
return false;
@@ -379,10 +380,10 @@ private boolean encodeQRCodeContents(AddressBookParsedResult contact) {
}
Bitmap encodeAsBitmap() throws WriterException {
- Hashtable<EncodeHintType,Object> hints = null;
+ Map<EncodeHintType,Object> hints = null;
String encoding = guessAppropriateEncoding(contents);
if (encoding != null) {
- hints = new Hashtable<EncodeHintType,Object>(2);
+ hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
hints.put(EncodeHintType.CHARACTER_SET, encoding);
}
MultiFormatWriter writer = new MultiFormatWriter();
View
2  android/src/com/google/zxing/client/android/history/HistoryClickListener.java
@@ -46,6 +46,7 @@
this.items = items;
}
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == items.size()) {
// Share history.
@@ -71,6 +72,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
builder.setMessage(R.string.msg_sure);
builder.setCancelable(true);
builder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface2, int i2) {
historyManager.clearHistory();
}
View
11 android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java
@@ -30,6 +30,7 @@
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;
/**
* Handles address book entries.
@@ -39,10 +40,10 @@
public final class AddressBookResultHandler extends ResultHandler {
private static final DateFormat[] DATE_FORMATS = {
- new SimpleDateFormat("yyyyMMdd"),
- new SimpleDateFormat("yyyyMMdd'T'HHmmss"),
- new SimpleDateFormat("yyyy-MM-dd"),
- new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"),
+ new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH),
+ new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH),
+ new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH),
+ new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH),
};
private final boolean[] fields;
@@ -167,7 +168,7 @@ private static Date parseDate(String s) {
@Override
public CharSequence getDisplayContents() {
AddressBookParsedResult result = (AddressBookParsedResult) getResult();
- StringBuffer contents = new StringBuffer(100);
+ StringBuilder contents = new StringBuilder(100);
ParsedResult.maybeAppend(result.getNames(), contents);
int namesLength = contents.length();
View
9 android/src/com/google/zxing/client/android/result/CalendarResultHandler.java
@@ -28,6 +28,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
+import java.util.Locale;
/**
* Handles calendar entries encoded in QR Codes.
@@ -36,8 +37,8 @@
*/
public final class CalendarResultHandler extends ResultHandler {
- private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
- private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
+ private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH);
+ private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH);
private static final int[] buttons = {
R.string.button_add_calendar
@@ -72,7 +73,7 @@ public void handleButtonPress(int index) {
@Override
public CharSequence getDisplayContents() {
CalendarParsedResult calResult = (CalendarParsedResult) getResult();
- StringBuffer result = new StringBuffer(100);
+ StringBuilder result = new StringBuilder(100);
ParsedResult.maybeAppend(calResult.getSummary(), result);
appendTime(calResult.getStart(), result);
@@ -89,7 +90,7 @@ public CharSequence getDisplayContents() {
return result.toString();
}
- private static void appendTime(String when, StringBuffer result) {
+ private static void appendTime(String when, StringBuilder result) {
if (when.length() == 8) {
// Show only year/month/day
Date date;
View
2  android/src/com/google/zxing/client/android/result/ISBNResultHandler.java
@@ -42,6 +42,7 @@
public ISBNResultHandler(Activity activity, ParsedResult result, Result rawResult) {
super(activity, result, rawResult);
showGoogleShopperButton(new View.OnClickListener() {
+ @Override
public void onClick(View view) {
ISBNParsedResult isbnResult = (ISBNParsedResult) getResult();
openGoogleShopper(isbnResult.getISBN());
@@ -62,6 +63,7 @@ public int getButtonText(int index) {
@Override
public void handleButtonPress(final int index) {
showNotOurResults(index, new AlertDialog.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
ISBNParsedResult isbnResult = (ISBNParsedResult) getResult();
switch (index) {
View
2  android/src/com/google/zxing/client/android/result/ProductResultHandler.java
@@ -41,6 +41,7 @@
public ProductResultHandler(Activity activity, ParsedResult result, Result rawResult) {
super(activity, result, rawResult);
showGoogleShopperButton(new View.OnClickListener() {
+ @Override
public void onClick(View view) {
ProductParsedResult productResult = (ProductParsedResult) getResult();
openGoogleShopper(productResult.getNormalizedProductID());
@@ -61,6 +62,7 @@ public int getButtonText(int index) {
@Override
public void handleButtonPress(final int index) {
showNotOurResults(index, new AlertDialog.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int i) {
ProductParsedResult productResult = (ProductParsedResult) getResult();
switch (index) {
View
1  android/src/com/google/zxing/client/android/result/ResultButtonListener.java
@@ -34,6 +34,7 @@ public ResultButtonListener(ResultHandler resultHandler, int index) {
this.index = index;
}
+ @Override
public void onClick(View view) {
resultHandler.handleButtonPress(index);
}
View
11 android/src/com/google/zxing/client/android/result/ResultHandler.java
@@ -43,7 +43,11 @@
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.TimeZone;
/**
* A base class for the Android-specific barcode handlers. These allow the app to polymorphically
@@ -61,13 +65,13 @@
private static final DateFormat DATE_FORMAT;
static {
- DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
+ DATE_FORMAT = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH);
// For dates without a time, for purposes of interacting with Android, the resulting timestamp
// needs to be midnight of that day in GMT. See:
// http://code.google.com/p/android/issues/detail?id=8330
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
}
- private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
+ private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.ENGLISH);
private static final String GOOGLE_SHOPPER_PACKAGE = "com.google.android.apps.shopper";
private static final String GOOGLE_SHOPPER_ACTIVITY = GOOGLE_SHOPPER_PACKAGE +
@@ -105,6 +109,7 @@
private final DialogInterface.OnClickListener shopperMarketListener =
new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialogInterface, int which) {
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URI_PREFIX +
GOOGLE_SHOPPER_PACKAGE + MARKET_REFERRER_SUFFIX)));
View
51 android/src/com/google/zxing/client/android/result/ResultHandlerFactory.java
@@ -18,7 +18,6 @@
import com.google.zxing.Result;
import com.google.zxing.client.result.ParsedResult;
-import com.google.zxing.client.result.ParsedResultType;
import com.google.zxing.client.result.ResultParser;
import android.app.Activity;
@@ -34,33 +33,31 @@ private ResultHandlerFactory() {
public static ResultHandler makeResultHandler(Activity activity, Result rawResult) {
ParsedResult result = parseResult(rawResult);
- ParsedResultType type = result.getType();
- if (type.equals(ParsedResultType.ADDRESSBOOK)) {
- return new AddressBookResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.EMAIL_ADDRESS)) {
- return new EmailAddressResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.PRODUCT)) {
- return new ProductResultHandler(activity, result, rawResult);
- } else if (type.equals(ParsedResultType.URI)) {
- return new URIResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.WIFI)) {
- return new WifiResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.TEXT)) {
- return new TextResultHandler(activity, result, rawResult);
- } else if (type.equals(ParsedResultType.GEO)) {
- return new GeoResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.TEL)) {
- return new TelResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.SMS)) {
- return new SMSResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.CALENDAR)) {
- return new CalendarResultHandler(activity, result);
- } else if (type.equals(ParsedResultType.ISBN)) {
- return new ISBNResultHandler(activity, result, rawResult);
- } else {
- // The TextResultHandler is the fallthrough for unsupported formats.
- return new TextResultHandler(activity, result, rawResult);
+ switch (result.getType()) {
+ case ADDRESSBOOK:
+ return new AddressBookResultHandler(activity, result);
+ case EMAIL_ADDRESS:
+ return new EmailAddressResultHandler(activity, result);
+ case PRODUCT:
+ return new ProductResultHandler(activity, result, rawResult);
+ case URI:
+ return new URIResultHandler(activity, result);
+ case WIFI:
+ return new WifiResultHandler(activity, result);
+ case TEXT:
+ return new TextResultHandler(activity, result, rawResult);
+ case GEO:
+ return new GeoResultHandler(activity, result);
+ case TEL:
+ return new TelResultHandler(activity, result);
+ case SMS:
+ return new SMSResultHandler(activity, result);
+ case CALENDAR:
+ return new CalendarResultHandler(activity, result);
+ case ISBN:
+ return new ISBNResultHandler(activity, result, rawResult);
}
+ return new TextResultHandler(activity, result, rawResult);
}
private static ParsedResult parseResult(Result rawResult) {
View
2  android/src/com/google/zxing/client/android/result/SMSResultHandler.java
@@ -65,7 +65,7 @@ public void handleButtonPress(int index) {
@Override
public CharSequence getDisplayContents() {
SMSParsedResult smsResult = (SMSParsedResult) getResult();
- StringBuffer contents = new StringBuffer(50);
+ StringBuilder contents = new StringBuilder(50);
String[] rawNumbers = smsResult.getNumbers();
String[] formattedNumbers = new String[rawNumbers.length];
for (int i = 0; i < rawNumbers.length; i++) {
View
2  android/src/com/google/zxing/client/android/result/WifiResultHandler.java
@@ -71,7 +71,7 @@ public void handleButtonPress(int index) {
@Override
public CharSequence getDisplayContents() {
WifiParsedResult wifiResult = (WifiParsedResult) getResult();
- StringBuffer contents = new StringBuffer(50);
+ StringBuilder contents = new StringBuilder(50);
String wifiLabel = parent.getString(R.string.wifi_ssid_label);
ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
String typeLabel = parent.getString(R.string.wifi_type_label);
View
1  android/src/com/google/zxing/client/android/result/supplement/KillerCallable.java
@@ -34,6 +34,7 @@
this.unit = unit;
}
+ @Override
public Void call() throws ExecutionException, InterruptedException {
try {
future.get(timeout, unit);
View
3  android/src/com/google/zxing/client/android/result/supplement/SupplementalInfoRetriever.java
@@ -48,6 +48,7 @@
private static synchronized ExecutorService getExecutorService() {
if (executorInstance == null) {
executorInstance = Executors.newCachedThreadPool(new ThreadFactory() {
+ @Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
@@ -95,6 +96,7 @@ public static void maybeInvokeRetrieval(TextView textView,
this.historyManager = historyManager;
}
+ @Override
public final Void call() throws IOException, InterruptedException {
retrieveSupplementalInfo();
return null;
@@ -138,6 +140,7 @@ final void append(String itemID, String source, String[] newTexts, String linkUR
}
handler.post(new Runnable() {
+ @Override
public void run() {
textView.append(content);
textView.setMovementMethod(LinkMovementMethod.getInstance());
View
12 android/src/com/google/zxing/client/android/share/BookmarkAdapter.java
@@ -39,31 +39,35 @@
private final Context context;
private final Cursor cursor;
- public BookmarkAdapter(Context context, Cursor cursor) {
+ BookmarkAdapter(Context context, Cursor cursor) {
this.context = context;
this.cursor = cursor;
}
+ @Override
public int getCount() {
return cursor.getCount();
}
+ @Override
public Object getItem(int index) {
// Not used, so no point in retrieving it.
return null;
}
+ @Override
public long getItemId(int index) {
return index;
}
+ @Override
public View getView(int index, View view, ViewGroup viewGroup) {
LinearLayout layout;
- if (!(view instanceof LinearLayout)) {
+ if (view instanceof LinearLayout) {
+ layout = (LinearLayout) view;
+ } else {
LayoutInflater factory = LayoutInflater.from(context);
layout = (LinearLayout) factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false);
- } else {
- layout = (LinearLayout) view;
}
cursor.moveToPosition(index);
View
1  android/src/com/google/zxing/client/android/share/LoadPackagesAsyncTask.java
@@ -98,6 +98,7 @@ protected synchronized void onPostExecute(List<String[]> results) {
}
private static class ByFirstStringComparator implements Comparator<String[]>, Serializable {
+ @Override
public int compare(String[] o1, String[] o2) {
return o1[0].compareTo(o2[0]);
}
View
5 android/src/com/google/zxing/client/android/share/ShareActivity.java
@@ -71,6 +71,7 @@
private Button clipboardButton;
private final Button.OnClickListener contactListener = new Button.OnClickListener() {
+ @Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
@@ -79,6 +80,7 @@ public void onClick(View v) {
};
private final Button.OnClickListener bookmarkListener = new Button.OnClickListener() {
+ @Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
@@ -88,6 +90,7 @@ public void onClick(View v) {
};
private final Button.OnClickListener appListener = new Button.OnClickListener() {
+ @Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
@@ -97,6 +100,7 @@ public void onClick(View v) {
};
private final Button.OnClickListener clipboardListener = new Button.OnClickListener() {
+ @Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
// Should always be true, because we grey out the clipboard button in onResume() if it's empty
@@ -107,6 +111,7 @@ public void onClick(View v) {
};
private final View.OnKeyListener textListener = new View.OnKeyListener() {
+ @Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
String text = ((TextView) view).getText().toString();
View
1  android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java
@@ -41,6 +41,7 @@ public static void configure(final WifiManager wifiManager,
final String password,
final String networkTypeString) {
Runnable configureRunnable = new Runnable() {
+ @Override
public void run() {
// Start WiFi, otherwise nothing will work
if (!wifiManager.isWifiEnabled()) {
View
37 androidtest/src/com/google/zxing/client/androidtest/BenchmarkActivity.java
@@ -27,12 +27,12 @@
public final class BenchmarkActivity extends Activity {
+ private static final String TAG = BenchmarkActivity.class.getSimpleName();
private static final String PATH = "/sdcard/zxingbenchmark";
- private static final String TAG = "ZXingBenchmark";
- private Button mRunBenchmarkButton;
- private TextView mTextView;
- private BenchmarkThread mBenchmarkThread;
+ private Button runBenchmarkButton;
+ private TextView textView;
+ private BenchmarkThread benchmarkThread;
@Override
public void onCreate(Bundle icicle) {
@@ -40,32 +40,33 @@ public void onCreate(Bundle icicle) {
setContentView(R.layout.benchmark);
- mRunBenchmarkButton = (Button) findViewById(R.id.benchmark_run);
- mRunBenchmarkButton.setOnClickListener(mRunBenchmark);
- mTextView = (TextView) findViewById(R.id.benchmark_help);
+ runBenchmarkButton = (Button) findViewById(R.id.benchmark_run);
+ runBenchmarkButton.setOnClickListener(runBenchmark);
+ textView = (TextView) findViewById(R.id.benchmark_help);
- mBenchmarkThread = null;
+ benchmarkThread = null;
}
- public final Button.OnClickListener mRunBenchmark = new Button.OnClickListener() {
+ private final Button.OnClickListener runBenchmark = new Button.OnClickListener() {
+ @Override
public void onClick(View v) {
- if (mBenchmarkThread == null) {
- mRunBenchmarkButton.setEnabled(false);
- mTextView.setText(R.string.benchmark_running);
- mBenchmarkThread = new BenchmarkThread(BenchmarkActivity.this, PATH);
- mBenchmarkThread.start();
+ if (benchmarkThread == null) {
+ runBenchmarkButton.setEnabled(false);
+ textView.setText(R.string.benchmark_running);
+ benchmarkThread = new BenchmarkThread(BenchmarkActivity.this, PATH);
+ benchmarkThread.start();
}
}
};
- public final Handler mHandler = new Handler() {
+ final Handler handler = new Handler() {
@Override
public void handleMessage(Message message) {
switch (message.what) {
case R.id.benchmark_done:
handleBenchmarkDone(message);
- mBenchmarkThread = null;
- mRunBenchmarkButton.setEnabled(true);
+ benchmarkThread = null;
+ runBenchmarkButton.setEnabled(true);
break;
default:
break;
@@ -86,7 +87,7 @@ private void handleBenchmarkDone(Message message) {
}
String totals = "TOTAL: Decoded " + count + " images in " + time + " us";
Log.v(TAG, totals);
- mTextView.setText(totals + "\n\n" + getString(R.string.benchmark_help));
+ textView.setText(totals + "\n\n" + getString(R.string.benchmark_help));
}
}
View
51 androidtest/src/com/google/zxing/client/androidtest/BenchmarkItem.java
@@ -20,49 +20,44 @@
public final class BenchmarkItem {
- private final String mPath;
- private final int[] mTimes;
- private int mPosition;
- private boolean mDecoded;
- private BarcodeFormat mFormat;
+ private final String path;
+ private final int[] times;
+ private int position;
+ private boolean decoded;
+ private BarcodeFormat format;
public BenchmarkItem(String path, int runs) {
if (runs <= 0) {
throw new IllegalArgumentException();
}
- mPath = path;
- mTimes = new int[runs];
- mPosition = 0;
- mDecoded = false;
- mFormat = null;
+ this.path = path;
+ times = new int[runs];
+ position = 0;
+ decoded = false;
+ format = null;
}
public void addResult(int microseconds) {
- mTimes[mPosition] = microseconds;
- mPosition++;
+ times[position] = microseconds;
+ position++;
}
public void setDecoded(boolean decoded) {
- mDecoded = decoded;
+ this.decoded = decoded;
}
public void setFormat(BarcodeFormat format) {
- mFormat = format;
+ this.format = format;
}
@Override
public String toString() {
- StringBuilder result = new StringBuilder();
- result.append(mDecoded ? ("DECODED " + mFormat.toString() + ": ") : "FAILED: ");
- result.append(mPath);
+ StringBuilder result = new StringBuilder(30);
+ result.append(decoded ? "DECODED " + format.toString() + ": " : "FAILED: ");
+ result.append(path);
result.append(" (");
result.append(getAverageTime());
result.append(" us average)");
-// int size = mTimes.length;
-// for (int x = 0; x < size; x++) {
-// result.append(mTimes[x]);
-// result.append(" ");
-// }
return result.toString();
}
@@ -72,11 +67,11 @@ public String toString() {
* @return The average decoding time in microseconds.
*/
public int getAverageTime() {
- int size = mTimes.length;
+ int size = times.length;
int total = 0;
- int max = mTimes[0];
+ int max = times[0];
for (int x = 0; x < size; x++) {
- int time = mTimes[x];
+ int time = times[x];
total += time;
if (time > max) {
max = time;
@@ -84,11 +79,7 @@ public int getAverageTime() {
}
total -= max;
size--;
- if (size > 0) {
- return total / size;
- } else {
- return 0;
- }
+ return size > 0 ? total / size : 0;
}
}
View
32 androidtest/src/com/google/zxing/client/androidtest/BenchmarkThread.java
@@ -34,43 +34,43 @@
final class BenchmarkThread extends Thread {
- private static final String TAG = "BenchmarkThread";
+ private static final String TAG = BenchmarkThread.class.getSimpleName();
private static final int RUNS = 10;
- private final BenchmarkActivity mActivity;
- private final String mPath;
- private MultiFormatReader mMultiFormatReader;
+ private final BenchmarkActivity activity;
+ private final String path;
+ private MultiFormatReader multiFormatReader;
BenchmarkThread(BenchmarkActivity activity, String path) {
- mActivity = activity;
- mPath = path;
+ this.activity = activity;
+ this.path = path;
}
@Override
public void run() {
- mMultiFormatReader = new MultiFormatReader();
- mMultiFormatReader.setHints(null);
+ multiFormatReader = new MultiFormatReader();
+ multiFormatReader.setHints(null);
// Try to get in a known state before starting the benchmark
System.gc();
List<BenchmarkItem> items = new ArrayList<BenchmarkItem>();
- walkTree(mPath, items);
- Message message = Message.obtain(mActivity.mHandler, R.id.benchmark_done);
+ walkTree(path, items);
+ Message message = Message.obtain(activity.handler, R.id.benchmark_done);
message.obj = items;
message.sendToTarget();
}
// Recurse to allow subdirectories
- private void walkTree(String path, List<BenchmarkItem> items) {
- File file = new File(path);
+ private void walkTree(String currentPath, List<BenchmarkItem> items) {
+ File file = new File(currentPath);
if (file.isDirectory()) {
String[] files = file.list();
Arrays.sort(files);
- for (String f : files) {
- walkTree(file.getAbsolutePath() + '/' + f, items);
+ for (String fileName : files) {
+ walkTree(file.getAbsolutePath() + '/' + fileName, items);
}
} else {
- BenchmarkItem item = decode(path);
+ BenchmarkItem item = decode(currentPath);
if (item != null) {
items.add(item);
}
@@ -95,7 +95,7 @@ private BenchmarkItem decode(String path) {
long now = Debug.threadCpuTimeNanos();
try {
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
- result = mMultiFormatReader.decodeWithState(bitmap);
+ result = multiFormatReader.decodeWithState(bitmap);
success = true;
} catch (ReaderException e) {
success = false;
View
37 androidtest/src/com/google/zxing/client/androidtest/CameraManager.java
@@ -20,7 +20,6 @@
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.Camera;
-import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
@@ -29,6 +28,7 @@
import android.view.WindowManager;
import java.io.IOException;
+import java.util.regex.Pattern;
/**
* This object wraps the Camera service object and expects to be the only one talking to it. The
@@ -38,13 +38,17 @@
* @author dswitkin@google.com (Daniel Switkin)
*/
final class CameraManager {
- private static final String TAG = "CameraManager";
+
+ private static final String TAG = CameraManager.class.getSimpleName();
+
private static final int MIN_FRAME_WIDTH = 240;
private static final int MIN_FRAME_HEIGHT = 240;
private static final int MAX_FRAME_WIDTH = 480;
private static final int MAX_FRAME_HEIGHT = 360;
private static CameraManager cameraManager;
+ private static final Pattern SEMICOLON = Pattern.compile(";");
+
private Camera camera;
private final Context context;
private Point screenResolution;
@@ -56,17 +60,14 @@
private int autoFocusMessage;
private boolean initialized;
private boolean previewing;
- private final boolean useOneShotPreviewCallback;
/**
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
* clear the handler so it will only receive one message.
*/
private final Camera.PreviewCallback previewCallback = new Camera.PreviewCallback() {
+ @Override
public void onPreviewFrame(byte[] data, Camera camera) {
- if (!useOneShotPreviewCallback) {
- camera.setPreviewCallback(null);
- }
if (previewHandler != null) {
Message message = previewHandler.obtainMessage(previewMessage, cameraResolution.x,
cameraResolution.y, data);
@@ -80,6 +81,7 @@ public void onPreviewFrame(byte[] data, Camera camera) {
* Autofocus callbacks arrive here, and are dispatched to the Handler which requested them.
*/
private final Camera.AutoFocusCallback autoFocusCallback = new Camera.AutoFocusCallback() {
+ @Override
public void onAutoFocus(boolean success, Camera camera) {
if (autoFocusHandler != null) {
Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
@@ -116,13 +118,6 @@ private CameraManager(Context context) {
camera = null;
initialized = false;
previewing = false;
-
- // Camera.setOneShotPreviewCallback() has a race condition in Cupcake, so we use the older
- // Camera.setPreviewCallback() on 1.5 and earlier. For Donut and later, we need to use
- // the more efficient one shot callback, as the older one can swamp the system and cause it
- // to run out of memory. We can't use SDK_INT because it was introduced in the Donut SDK.
- //useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > Build.VERSION_CODES.CUPCAKE;
- useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > 3; // 3 = Cupcake
}
/**
@@ -175,9 +170,6 @@ public void startPreview() {
*/
public void stopPreview() {
if (camera != null && previewing) {
- if (!useOneShotPreviewCallback) {
- camera.setPreviewCallback(null);
- }
camera.stopPreview();
previewHandler = null;
autoFocusHandler = null;
@@ -197,11 +189,7 @@ public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewHandler = handler;
previewMessage = message;
- if (useOneShotPreviewCallback) {
- camera.setOneShotPreviewCallback(previewCallback);
- } else {
- camera.setPreviewCallback(previewCallback);
- }
+ camera.setOneShotPreviewCallback(previewCallback);
}
}
@@ -274,16 +262,13 @@ private void setCameraParameters() {
Log.v(TAG, "Setting preview size: "