├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_launcher-web.png
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ └── custom_icon.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── me
│ │ │ └── sudar
│ │ │ └── zxingdemo
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── me
│ │ └── sudar
│ │ └── zxingorient
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── screenshots
├── screenshot_1.png
└── screenshot_2.png
├── .gitignore
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── zxing-orient
├── libs
│ └── android-core-3.1.0.jar
├── src
│ └── main
│ │ ├── res
│ │ ├── raw
│ │ │ └── beep.ogg
│ │ ├── drawable
│ │ │ ├── ic_launcher.png
│ │ │ ├── share_via_barcode.png
│ │ │ ├── ic_flash_off_white_18dp.png
│ │ │ ├── ic_flash_on_white_18dp.png
│ │ │ ├── ic_center_focus_weak_white_18dp.png
│ │ │ └── ic_center_focus_strong_white_18dp.png
│ │ ├── drawable-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_flash_off_white_18dp.png
│ │ │ ├── ic_flash_on_white_18dp.png
│ │ │ ├── ic_center_focus_weak_white_18dp.png
│ │ │ └── ic_center_focus_strong_white_18dp.png
│ │ ├── drawable-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_flash_on_white_18dp.png
│ │ │ ├── ic_flash_off_white_18dp.png
│ │ │ ├── ic_center_focus_weak_white_18dp.png
│ │ │ └── ic_center_focus_strong_white_18dp.png
│ │ ├── drawable-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_flash_off_white_18dp.png
│ │ │ ├── ic_flash_on_white_18dp.png
│ │ │ ├── ic_center_focus_weak_white_18dp.png
│ │ │ └── ic_center_focus_strong_white_18dp.png
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── values
│ │ │ ├── styles.xml
│ │ │ ├── dimens.xml
│ │ │ ├── ids.xml
│ │ │ ├── themes.xml
│ │ │ ├── colors.xml
│ │ │ └── arrays.xml
│ │ ├── menu
│ │ │ └── encode.xml
│ │ ├── layout-land
│ │ │ └── encode.xml
│ │ └── layout
│ │ │ └── encode.xml
│ │ └── java
│ │ ├── com
│ │ └── google
│ │ │ └── zxing
│ │ │ ├── pdf417
│ │ │ ├── encoder
│ │ │ │ ├── Compaction.java
│ │ │ │ ├── Dimensions.java
│ │ │ │ ├── BarcodeRow.java
│ │ │ │ └── BarcodeMatrix.java
│ │ │ ├── detector
│ │ │ │ └── PDF417DetectorResult.java
│ │ │ ├── PDF417ResultMetadata.java
│ │ │ └── decoder
│ │ │ │ ├── BarcodeMetadata.java
│ │ │ │ ├── Codeword.java
│ │ │ │ └── BarcodeValue.java
│ │ │ ├── client
│ │ │ ├── android
│ │ │ │ ├── IntentSource.java
│ │ │ │ ├── encode
│ │ │ │ │ ├── Formatter.java
│ │ │ │ │ └── VCardTelDisplayFormatter.java
│ │ │ │ ├── ViewfinderResultPointCallback.java
│ │ │ │ ├── camera
│ │ │ │ │ ├── FrontLightMode.java
│ │ │ │ │ ├── PreviewCallback.java
│ │ │ │ │ └── open
│ │ │ │ │ │ └── OpenCameraInterface.java
│ │ │ │ ├── FinishListener.java
│ │ │ │ └── Preferences.java
│ │ │ └── result
│ │ │ │ ├── ParsedResultType.java
│ │ │ │ ├── ISBNParsedResult.java
│ │ │ │ ├── TextParsedResult.java
│ │ │ │ ├── BookmarkDoCoMoResultParser.java
│ │ │ │ ├── ProductParsedResult.java
│ │ │ │ ├── TelResultParser.java
│ │ │ │ ├── AbstractDoCoMoResultParser.java
│ │ │ │ ├── TelParsedResult.java
│ │ │ │ ├── URLTOResultParser.java
│ │ │ │ ├── ISBNResultParser.java
│ │ │ │ ├── SMTPResultParser.java
│ │ │ │ ├── WifiResultParser.java
│ │ │ │ ├── EmailAddressParsedResult.java
│ │ │ │ ├── SMSTOMMSTOResultParser.java
│ │ │ │ ├── ProductResultParser.java
│ │ │ │ ├── WifiParsedResult.java
│ │ │ │ ├── ParsedResult.java
│ │ │ │ ├── URIResultParser.java
│ │ │ │ ├── EmailAddressResultParser.java
│ │ │ │ ├── EmailDoCoMoResultParser.java
│ │ │ │ └── GeoResultParser.java
│ │ │ ├── datamatrix
│ │ │ └── encoder
│ │ │ │ ├── Encoder.java
│ │ │ │ ├── SymbolShapeHint.java
│ │ │ │ ├── DataMatrixSymbolInfo144.java
│ │ │ │ ├── TextEncoder.java
│ │ │ │ └── Base256Encoder.java
│ │ │ ├── ResultPointCallback.java
│ │ │ ├── common
│ │ │ ├── reedsolomon
│ │ │ │ └── ReedSolomonException.java
│ │ │ ├── DetectorResult.java
│ │ │ └── detector
│ │ │ │ └── MathUtils.java
│ │ │ ├── qrcode
│ │ │ ├── encoder
│ │ │ │ ├── BlockPair.java
│ │ │ │ └── ByteMatrix.java
│ │ │ ├── detector
│ │ │ │ ├── FinderPatternInfo.java
│ │ │ │ └── AlignmentPattern.java
│ │ │ └── decoder
│ │ │ │ ├── ErrorCorrectionLevel.java
│ │ │ │ └── QRCodeDecoderMetaData.java
│ │ │ ├── WriterException.java
│ │ │ ├── ChecksumException.java
│ │ │ ├── NotFoundException.java
│ │ │ ├── oned
│ │ │ ├── rss
│ │ │ │ ├── Pair.java
│ │ │ │ ├── expanded
│ │ │ │ │ ├── decoders
│ │ │ │ │ │ ├── DecodedObject.java
│ │ │ │ │ │ ├── AI013103decoder.java
│ │ │ │ │ │ ├── DecodedChar.java
│ │ │ │ │ │ ├── AI01320xDecoder.java
│ │ │ │ │ │ ├── BlockParsedResult.java
│ │ │ │ │ │ ├── AnyAIDecoder.java
│ │ │ │ │ │ ├── AI013x0xDecoder.java
│ │ │ │ │ │ ├── DecodedInformation.java
│ │ │ │ │ │ ├── AI01weightDecoder.java
│ │ │ │ │ │ ├── CurrentParsingState.java
│ │ │ │ │ │ ├── AI01AndOtherAIs.java
│ │ │ │ │ │ ├── DecodedNumeric.java
│ │ │ │ │ │ └── AI01392xDecoder.java
│ │ │ │ │ ├── ExpandedRow.java
│ │ │ │ │ └── BitArrayBuilder.java
│ │ │ │ ├── DataCharacter.java
│ │ │ │ └── FinderPattern.java
│ │ │ ├── UPCEANWriter.java
│ │ │ ├── UPCEANExtensionSupport.java
│ │ │ ├── EAN8Reader.java
│ │ │ └── UPCAWriter.java
│ │ │ ├── FormatException.java
│ │ │ ├── multi
│ │ │ ├── MultipleBarcodeReader.java
│ │ │ └── qrcode
│ │ │ │ └── detector
│ │ │ │ └── MultiDetector.java
│ │ │ ├── aztec
│ │ │ ├── encoder
│ │ │ │ ├── Token.java
│ │ │ │ ├── SimpleToken.java
│ │ │ │ ├── AztecCode.java
│ │ │ │ └── BinaryShiftToken.java
│ │ │ └── AztecDetectorResult.java
│ │ │ ├── ReaderException.java
│ │ │ ├── Dimension.java
│ │ │ ├── BarcodeFormat.java
│ │ │ ├── Writer.java
│ │ │ └── InvertedLuminanceSource.java
│ │ └── me
│ │ └── sudar
│ │ └── zxingorient
│ │ └── ZxingOrientResult.java
├── build.gradle
└── publish.gradle
├── gradle.properties
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':zxing-orient'
2 |
--------------------------------------------------------------------------------
/screenshots/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/screenshots/screenshot_1.png
--------------------------------------------------------------------------------
/screenshots/screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/screenshots/screenshot_2.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 |
9 | zxing-orient/build
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/zxing-orient/libs/android-core-3.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/libs/android-core-3.1.0.jar
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/raw/beep.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/raw/beep.ogg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/res/drawable/custom_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable/share_via_barcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable/share_via_barcode.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable/ic_flash_off_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable/ic_flash_off_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable/ic_flash_on_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable/ic_flash_on_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-hdpi/ic_flash_off_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-hdpi/ic_flash_off_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-hdpi/ic_flash_on_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-hdpi/ic_flash_on_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xhdpi/ic_flash_on_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xhdpi/ic_flash_on_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xhdpi/ic_flash_off_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xhdpi/ic_flash_off_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xxhdpi/ic_flash_off_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xxhdpi/ic_flash_off_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xxhdpi/ic_flash_on_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xxhdpi/ic_flash_on_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable/ic_center_focus_weak_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable/ic_center_focus_weak_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable/ic_center_focus_strong_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable/ic_center_focus_strong_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-hdpi/ic_center_focus_weak_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-hdpi/ic_center_focus_weak_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-hdpi/ic_center_focus_strong_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-hdpi/ic_center_focus_strong_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xhdpi/ic_center_focus_weak_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xhdpi/ic_center_focus_weak_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xxhdpi/ic_center_focus_weak_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xxhdpi/ic_center_focus_weak_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xhdpi/ic_center_focus_strong_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xhdpi/ic_center_focus_strong_white_18dp.png
--------------------------------------------------------------------------------
/zxing-orient/src/main/res/drawable-xxhdpi/ic_center_focus_strong_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1zantine/ZXing-Orient/HEAD/zxing-orient/src/main/res/drawable-xxhdpi/ic_center_focus_strong_white_18dp.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Mar 01 09:10:41 IST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
Thrown when an exception occurs during Reed-Solomon decoding, such as when 21 | * there are too many errors to correct.
22 | * 23 | * @author Sean Owen 24 | */ 25 | public final class ReedSolomonException extends Exception { 26 | 27 | public ReedSolomonException(String message) { 28 | super(message); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /zxing-orient/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.jfrog.bintray' 3 | apply plugin: 'com.github.dcendents.android-maven' 4 | 5 | buildscript { 6 | repositories { 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' 11 | classpath "com.github.dcendents:android-maven-gradle-plugin:1.3" 12 | } 13 | } 14 | android { 15 | compileSdkVersion 23 16 | buildToolsVersion "23.0.2" 17 | 18 | defaultConfig { 19 | minSdkVersion 15 20 | targetSdkVersion 23 21 | compileOptions { 22 | sourceCompatibility JavaVersion.VERSION_1_7 23 | targetCompatibility JavaVersion.VERSION_1_7 24 | } 25 | } 26 | 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 31 | } 32 | } 33 | } 34 | 35 | apply from: 'publish.gradle' 36 | 37 | dependencies { 38 | compile fileTree(dir: 'libs', include: ['*.jar']) 39 | compile 'com.android.support:appcompat-v7:23.2.0' 40 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/ParsedResultType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | /** 20 | * Represents the type of data encoded by a barcode -- from plain text, to a 21 | * URI, to an e-mail address, etc. 22 | * 23 | * @author Sean Owen 24 | */ 25 | public enum ParsedResultType { 26 | 27 | ADDRESSBOOK, 28 | EMAIL_ADDRESS, 29 | PRODUCT, 30 | URI, 31 | TEXT, 32 | GEO, 33 | TEL, 34 | SMS, 35 | CALENDAR, 36 | WIFI, 37 | ISBN, 38 | VIN, 39 | 40 | } 41 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/android/encode/Formatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.android.encode; 18 | 19 | /** 20 | * Encapsulates some simple formatting logic, to aid refactoring in {@link ContactEncoder}. 21 | * 22 | * @author Sean Owen 23 | */ 24 | interface Formatter { 25 | 26 | /** 27 | * @param value value to format 28 | * @param index index of value in a list of values to be formatted 29 | * @return formatted value 30 | */ 31 | CharSequence format(CharSequence value, int index); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/datamatrix/encoder/DataMatrixSymbolInfo144.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Jeremias Maerki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.datamatrix.encoder; 18 | 19 | final class DataMatrixSymbolInfo144 extends SymbolInfo { 20 | 21 | DataMatrixSymbolInfo144() { 22 | super(false, 1558, 620, 22, 22, 36, -1, 62); 23 | } 24 | 25 | @Override 26 | public int getInterleavedBlockCount() { 27 | return 10; 28 | } 29 | 30 | @Override 31 | public int getDataLengthForInterleavedBlock(int index) { 32 | return (index <= 8) ? 156 : 155; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/qrcode/encoder/BlockPair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.qrcode.encoder; 18 | 19 | final class BlockPair { 20 | 21 | private final byte[] dataBytes; 22 | private final byte[] errorCorrectionBytes; 23 | 24 | BlockPair(byte[] data, byte[] errorCorrection) { 25 | dataBytes = data; 26 | errorCorrectionBytes = errorCorrection; 27 | } 28 | 29 | public byte[] getDataBytes() { 30 | return dataBytes; 31 | } 32 | 33 | public byte[] getErrorCorrectionBytes() { 34 | return errorCorrectionBytes; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 |Encapsulates functionality and implementation that is common to UPC and EAN families 21 | * of one-dimensional barcodes.
22 | * 23 | * @author aripollak@gmail.com (Ari Pollak) 24 | * @author dsbnatut@gmail.com (Kazuki Nishiura) 25 | */ 26 | public abstract class UPCEANWriter extends OneDimensionalCodeWriter { 27 | 28 | @Override 29 | public int getDefaultMargin() { 30 | // Use a different default more appropriate for UPC/EAN 31 | return UPCEANReader.START_END_PATTERN.length; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/FormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing; 18 | 19 | /** 20 | * Thrown when a barcode was successfully detected, but some aspect of 21 | * the content did not conform to the barcode's format rules. This could have 22 | * been due to a mis-detection. 23 | * 24 | * @author Sean Owen 25 | */ 26 | public final class FormatException extends ReaderException { 27 | 28 | private static final FormatException instance = new FormatException(); 29 | 30 | private FormatException() { 31 | // do nothing 32 | } 33 | 34 | public static FormatException getFormatInstance() { 35 | return instance; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/android/ViewfinderResultPointCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.android; 18 | 19 | import com.google.zxing.ResultPoint; 20 | import com.google.zxing.ResultPointCallback; 21 | 22 | final class ViewfinderResultPointCallback implements ResultPointCallback { 23 | 24 | private final ViewfinderView viewfinderView; 25 | 26 | ViewfinderResultPointCallback(ViewfinderView viewfinderView) { 27 | this.viewfinderView = viewfinderView; 28 | } 29 | 30 | @Override 31 | public void foundPossibleResultPoint(ResultPoint point) { 32 | viewfinderView.addPossibleResultPoint(point); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /zxing-orient/src/main/res/menu/encode.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /zxing-orient/publish.gradle: -------------------------------------------------------------------------------- 1 | task generateSourcesJar(type: Jar) { 2 | from android.sourceSets.main.java.srcDirs 3 | classifier 'sources' 4 | } 5 | task generateJavadocs(type: Javadoc) { 6 | source = android.sourceSets.main.java.srcDirs 7 | classpath += project.files(android.getBootClasspath() 8 | .join(File.pathSeparator)) 9 | } 10 | task generateJavaDocsJar(type: Jar) { 11 | from generateJavadocs.destinationDir 12 | classifier 'javadoc' 13 | } 14 | 15 | generateJavaDocsJar.dependsOn generateJavadocs 16 | 17 | artifacts { 18 | // archives generateJavaDocsJar 19 | archives generateSourcesJar 20 | } 21 | 22 | group = 'me.sudar' 23 | version = '2.1.1' 24 | Properties properties = new Properties() 25 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 26 | 27 | bintray { 28 | user = properties.getProperty('BINTRAY_USER') 29 | key = properties.getProperty('BINTRAY_KEY') 30 | pkg { 31 | repo = 'maven' 32 | name = 'ZXing-Orient' 33 | 34 | version { 35 | name = '2.1.1' 36 | released = new Date() 37 | vcsTag = 'v2.1.1' 38 | } 39 | 40 | licenses = ['Apache-2.0'] 41 | vcsUrl = 'https://github.com/SudarAbisheck/ZXing-Orient.git' 42 | websiteUrl = 'https://github.com/SudarAbisheck/ZXing-Orient' 43 | } 44 | configurations = ['archives'] 45 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/pdf417/detector/PDF417DetectorResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.pdf417.detector; 18 | 19 | import com.google.zxing.ResultPoint; 20 | import com.google.zxing.common.BitMatrix; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * @author Guenther Grau 26 | */ 27 | public final class PDF417DetectorResult { 28 | 29 | private final BitMatrix bits; 30 | private final ListEncapsulates the result of detecting a barcode in an image. This includes the raw 23 | * matrix of black/white pixels corresponding to the barcode, and possibly points of interest 24 | * in the image, like the location of finder patterns or corners of the barcode in the image.
25 | * 26 | * @author Sean Owen 27 | */ 28 | public class DetectorResult { 29 | 30 | private final BitMatrix bits; 31 | private final ResultPoint[] points; 32 | 33 | public DetectorResult(BitMatrix bits, ResultPoint[] points) { 34 | this.bits = bits; 35 | this.points = points; 36 | } 37 | 38 | public final BitMatrix getBits() { 39 | return bits; 40 | } 41 | 42 | public final ResultPoint[] getPoints() { 43 | return points; 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/ProductParsedResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | /** 20 | * @author dswitkin@google.com (Daniel Switkin) 21 | */ 22 | public final class ProductParsedResult extends ParsedResult { 23 | 24 | private final String productID; 25 | private final String normalizedProductID; 26 | 27 | ProductParsedResult(String productID) { 28 | this(productID, productID); 29 | } 30 | 31 | ProductParsedResult(String productID, String normalizedProductID) { 32 | super(ParsedResultType.PRODUCT); 33 | this.productID = productID; 34 | this.normalizedProductID = normalizedProductID; 35 | } 36 | 37 | public String getProductID() { 38 | return productID; 39 | } 40 | 41 | public String getNormalizedProductID() { 42 | return normalizedProductID; 43 | } 44 | 45 | @Override 46 | public String getDisplayResult() { 47 | return productID; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/TelResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.Result; 20 | 21 | /** 22 | * Parses a "tel:" URI result, which specifies a phone number. 23 | * 24 | * @author Sean Owen 25 | */ 26 | public final class TelResultParser extends ResultParser { 27 | 28 | @Override 29 | public TelParsedResult parse(Result result) { 30 | String rawText = getMassagedText(result); 31 | if (!rawText.startsWith("tel:") && !rawText.startsWith("TEL:")) { 32 | return null; 33 | } 34 | // Normalize "TEL:" to "tel:" 35 | String telURI = rawText.startsWith("TEL:") ? "tel:" + rawText.substring(4) : rawText; 36 | // Drop tel, query portion 37 | int queryStart = rawText.indexOf('?', 4); 38 | String number = queryStart < 0 ? rawText.substring(4) : rawText.substring(4, queryStart); 39 | return new TelParsedResult(number, telURI, null); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/AbstractDoCoMoResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | /** 20 | *See 21 | * 22 | * DoCoMo's documentation about the result types represented by subclasses of this class.
23 | * 24 | *Thanks to Jeff Griffin for proposing rewrite of these classes that relies less 25 | * on exception-based mechanisms during parsing.
26 | * 27 | * @author Sean Owen 28 | */ 29 | abstract class AbstractDoCoMoResultParser extends ResultParser { 30 | 31 | static String[] matchDoCoMoPrefixedField(String prefix, String rawText, boolean trim) { 32 | return matchPrefixedField(prefix, rawText, ';', trim); 33 | } 34 | 35 | static String matchSingleDoCoMoPrefixedField(String prefix, String rawText, boolean trim) { 36 | return matchSinglePrefixedField(prefix, rawText, ';', trim); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/pdf417/encoder/Dimensions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.pdf417.encoder; 18 | 19 | /** 20 | * Data object to specify the minimum and maximum number of rows and columns for a PDF417 barcode. 21 | * 22 | * @author qwandor@google.com (Andrew Walbran) 23 | */ 24 | public final class Dimensions { 25 | 26 | private final int minCols; 27 | private final int maxCols; 28 | private final int minRows; 29 | private final int maxRows; 30 | 31 | public Dimensions(int minCols, int maxCols, int minRows, int maxRows) { 32 | this.minCols = minCols; 33 | this.maxCols = maxCols; 34 | this.minRows = minRows; 35 | this.maxRows = maxRows; 36 | } 37 | 38 | public int getMinCols() { 39 | return minCols; 40 | } 41 | 42 | public int getMaxCols() { 43 | return maxCols; 44 | } 45 | 46 | public int getMinRows() { 47 | return minRows; 48 | } 49 | 50 | public int getMaxRows() { 51 | return maxRows; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/qrcode/detector/FinderPatternInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.qrcode.detector; 18 | 19 | /** 20 | *Encapsulates information about finder patterns in an image, including the location of 21 | * the three finder patterns, and their estimated module size.
22 | * 23 | * @author Sean Owen 24 | */ 25 | public final class FinderPatternInfo { 26 | 27 | private final FinderPattern bottomLeft; 28 | private final FinderPattern topLeft; 29 | private final FinderPattern topRight; 30 | 31 | public FinderPatternInfo(FinderPattern[] patternCenters) { 32 | this.bottomLeft = patternCenters[0]; 33 | this.topLeft = patternCenters[1]; 34 | this.topRight = patternCenters[2]; 35 | } 36 | 37 | public FinderPattern getBottomLeft() { 38 | return bottomLeft; 39 | } 40 | 41 | public FinderPattern getTopLeft() { 42 | return topLeft; 43 | } 44 | 45 | public FinderPattern getTopRight() { 46 | return topRight; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/TelParsedResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | /** 20 | * @author Sean Owen 21 | */ 22 | public final class TelParsedResult extends ParsedResult { 23 | 24 | private final String number; 25 | private final String telURI; 26 | private final String title; 27 | 28 | public TelParsedResult(String number, String telURI, String title) { 29 | super(ParsedResultType.TEL); 30 | this.number = number; 31 | this.telURI = telURI; 32 | this.title = title; 33 | } 34 | 35 | public String getNumber() { 36 | return number; 37 | } 38 | 39 | public String getTelURI() { 40 | return telURI; 41 | } 42 | 43 | public String getTitle() { 44 | return title; 45 | } 46 | 47 | @Override 48 | public String getDisplayResult() { 49 | StringBuilder result = new StringBuilder(20); 50 | maybeAppend(number, result); 51 | maybeAppend(title, result); 52 | return result.toString(); 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/URLTOResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.Result; 20 | 21 | /** 22 | * Parses the "URLTO" result format, which is of the form "URLTO:[title]:[url]". 23 | * This seems to be used sometimes, but I am not able to find documentation 24 | * on its origin or official format? 25 | * 26 | * @author Sean Owen 27 | */ 28 | public final class URLTOResultParser extends ResultParser { 29 | 30 | @Override 31 | public URIParsedResult parse(Result result) { 32 | String rawText = getMassagedText(result); 33 | if (!rawText.startsWith("urlto:") && !rawText.startsWith("URLTO:")) { 34 | return null; 35 | } 36 | int titleEnd = rawText.indexOf(':', 6); 37 | if (titleEnd < 0) { 38 | return null; 39 | } 40 | String title = titleEnd <= 6 ? null : rawText.substring(6, titleEnd); 41 | String uri = rawText.substring(titleEnd + 1); 42 | return new URIParsedResult(uri, title); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/UPCEANExtensionSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.oned; 18 | 19 | import com.google.zxing.NotFoundException; 20 | import com.google.zxing.ReaderException; 21 | import com.google.zxing.Result; 22 | import com.google.zxing.common.BitArray; 23 | 24 | final class UPCEANExtensionSupport { 25 | 26 | private static final int[] EXTENSION_START_PATTERN = {1,1,2}; 27 | 28 | private final UPCEANExtension2Support twoSupport = new UPCEANExtension2Support(); 29 | private final UPCEANExtension5Support fiveSupport = new UPCEANExtension5Support(); 30 | 31 | Result decodeRow(int rowNumber, BitArray row, int rowOffset) throws NotFoundException { 32 | int[] extensionStartRange = UPCEANReader.findGuardPattern(row, rowOffset, false, EXTENSION_START_PATTERN); 33 | try { 34 | return fiveSupport.decodeRow(rowNumber, row, extensionStartRange); 35 | } catch (ReaderException ignored) { 36 | return twoSupport.decodeRow(rowNumber, row, extensionStartRange); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/ISBNResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.BarcodeFormat; 20 | import com.google.zxing.Result; 21 | 22 | /** 23 | * Parses strings of digits that represent a ISBN. 24 | * 25 | * @author jbreiden@google.com (Jeff Breidenbach) 26 | */ 27 | public final class ISBNResultParser extends ResultParser { 28 | 29 | /** 30 | * See ISBN-13 For Dummies 31 | */ 32 | @Override 33 | public ISBNParsedResult parse(Result result) { 34 | BarcodeFormat format = result.getBarcodeFormat(); 35 | if (format != BarcodeFormat.EAN_13) { 36 | return null; 37 | } 38 | String rawText = getMassagedText(result); 39 | int length = rawText.length(); 40 | if (length != 13) { 41 | return null; 42 | } 43 | if (!rawText.startsWith("978") && !rawText.startsWith("979")) { 44 | return null; 45 | } 46 | 47 | return new ISBNParsedResult(rawText); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/rss/DataCharacter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.oned.rss; 18 | 19 | public class DataCharacter { 20 | 21 | private final int value; 22 | private final int checksumPortion; 23 | 24 | public DataCharacter(int value, int checksumPortion) { 25 | this.value = value; 26 | this.checksumPortion = checksumPortion; 27 | } 28 | 29 | public final int getValue() { 30 | return value; 31 | } 32 | 33 | public final int getChecksumPortion() { 34 | return checksumPortion; 35 | } 36 | 37 | @Override 38 | public final String toString() { 39 | return value + "(" + checksumPortion + ')'; 40 | } 41 | 42 | @Override 43 | public final boolean equals(Object o) { 44 | if(!(o instanceof DataCharacter)) { 45 | return false; 46 | } 47 | DataCharacter that = (DataCharacter) o; 48 | return value == that.value && checksumPortion == that.checksumPortion; 49 | } 50 | 51 | @Override 52 | public final int hashCode() { 53 | return value ^ checksumPortion; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/rss/expanded/decoders/AI013103decoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * These authors would like to acknowledge the Spanish Ministry of Industry, 19 | * Tourism and Trade, for the support in the project TSI020301-2008-2 20 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 21 | * Mobile Dynamic Environments", led by Treelogic 22 | * ( http://www.treelogic.com/ ): 23 | * 24 | * http://www.piramidepse.com/ 25 | */ 26 | 27 | package com.google.zxing.oned.rss.expanded.decoders; 28 | 29 | import com.google.zxing.common.BitArray; 30 | 31 | /** 32 | * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) 33 | */ 34 | final class AI013103decoder extends AI013x0xDecoder { 35 | 36 | AI013103decoder(BitArray information) { 37 | super(information); 38 | } 39 | 40 | @Override 41 | protected void addWeightCode(StringBuilder buf, int weight) { 42 | buf.append("(3103)"); 43 | } 44 | 45 | @Override 46 | protected int checkWeight(int weight) { 47 | return weight; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/aztec/AztecDetectorResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.aztec; 18 | 19 | import com.google.zxing.ResultPoint; 20 | import com.google.zxing.common.BitMatrix; 21 | import com.google.zxing.common.DetectorResult; 22 | 23 | public final class AztecDetectorResult extends DetectorResult { 24 | 25 | private final boolean compact; 26 | private final int nbDatablocks; 27 | private final int nbLayers; 28 | 29 | public AztecDetectorResult(BitMatrix bits, 30 | ResultPoint[] points, 31 | boolean compact, 32 | int nbDatablocks, 33 | int nbLayers) { 34 | super(bits, points); 35 | this.compact = compact; 36 | this.nbDatablocks = nbDatablocks; 37 | this.nbLayers = nbLayers; 38 | } 39 | 40 | public int getNbLayers() { 41 | return nbLayers; 42 | } 43 | 44 | public int getNbDatablocks() { 45 | return nbDatablocks; 46 | } 47 | 48 | public boolean isCompact() { 49 | return compact; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/Dimension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing; 18 | 19 | /** 20 | * Simply encapsulates a width and height. 21 | */ 22 | public final class Dimension { 23 | 24 | private final int width; 25 | private final int height; 26 | 27 | public Dimension(int width, int height) { 28 | if (width < 0 || height < 0) { 29 | throw new IllegalArgumentException(); 30 | } 31 | this.width = width; 32 | this.height = height; 33 | } 34 | 35 | public int getWidth() { 36 | return width; 37 | } 38 | 39 | public int getHeight() { 40 | return height; 41 | } 42 | 43 | @Override 44 | public boolean equals(Object other) { 45 | if (other instanceof Dimension) { 46 | Dimension d = (Dimension) other; 47 | return width == d.width && height == d.height; 48 | } 49 | return false; 50 | } 51 | 52 | @Override 53 | public int hashCode() { 54 | return width * 32713 + height; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return width + "x" + height; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/pdf417/PDF417ResultMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.pdf417; 18 | 19 | /** 20 | * @author Guenther Grau 21 | */ 22 | public final class PDF417ResultMetadata { 23 | 24 | private int segmentIndex; 25 | private String fileId; 26 | private int[] optionalData; 27 | private boolean lastSegment; 28 | 29 | public int getSegmentIndex() { 30 | return segmentIndex; 31 | } 32 | 33 | public void setSegmentIndex(int segmentIndex) { 34 | this.segmentIndex = segmentIndex; 35 | } 36 | 37 | public String getFileId() { 38 | return fileId; 39 | } 40 | 41 | public void setFileId(String fileId) { 42 | this.fileId = fileId; 43 | } 44 | 45 | public int[] getOptionalData() { 46 | return optionalData; 47 | } 48 | 49 | public void setOptionalData(int[] optionalData) { 50 | this.optionalData = optionalData; 51 | } 52 | 53 | public boolean isLastSegment() { 54 | return lastSegment; 55 | } 56 | 57 | public void setLastSegment(boolean lastSegment) { 58 | this.lastSegment = lastSegment; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /zxing-orient/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 |See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels 21 | * defined by the QR code standard.
22 | * 23 | * @author Sean Owen 24 | */ 25 | public enum ErrorCorrectionLevel { 26 | 27 | /** L = ~7% correction */ 28 | L(0x01), 29 | /** M = ~15% correction */ 30 | M(0x00), 31 | /** Q = ~25% correction */ 32 | Q(0x03), 33 | /** H = ~30% correction */ 34 | H(0x02); 35 | 36 | private static final ErrorCorrectionLevel[] FOR_BITS = {M, L, H, Q}; 37 | 38 | private final int bits; 39 | 40 | ErrorCorrectionLevel(int bits) { 41 | this.bits = bits; 42 | } 43 | 44 | public int getBits() { 45 | return bits; 46 | } 47 | 48 | /** 49 | * @param bits int containing the two bits encoding a QR Code's error correction level 50 | * @return ErrorCorrectionLevel representing the encoded error correction level 51 | */ 52 | public static ErrorCorrectionLevel forBits(int bits) { 53 | if (bits < 0 || bits >= FOR_BITS.length) { 54 | throw new IllegalArgumentException(); 55 | } 56 | return FOR_BITS[bits]; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/BarcodeFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing; 18 | 19 | /** 20 | * Enumerates barcode formats known to this package. Please keep alphabetized. 21 | * 22 | * @author Sean Owen 23 | */ 24 | public enum BarcodeFormat { 25 | 26 | /** Aztec 2D barcode format. */ 27 | AZTEC, 28 | 29 | /** CODABAR 1D format. */ 30 | CODABAR, 31 | 32 | /** Code 39 1D format. */ 33 | CODE_39, 34 | 35 | /** Code 93 1D format. */ 36 | CODE_93, 37 | 38 | /** Code 128 1D format. */ 39 | CODE_128, 40 | 41 | /** Data Matrix 2D barcode format. */ 42 | DATA_MATRIX, 43 | 44 | /** EAN-8 1D format. */ 45 | EAN_8, 46 | 47 | /** EAN-13 1D format. */ 48 | EAN_13, 49 | 50 | /** ITF (Interleaved Two of Five) 1D format. */ 51 | ITF, 52 | 53 | /** MaxiCode 2D barcode format. */ 54 | MAXICODE, 55 | 56 | /** PDF417 format. */ 57 | PDF_417, 58 | 59 | /** QR Code 2D barcode format. */ 60 | QR_CODE, 61 | 62 | /** RSS 14 */ 63 | RSS_14, 64 | 65 | /** RSS EXPANDED */ 66 | RSS_EXPANDED, 67 | 68 | /** UPC-A 1D format. */ 69 | UPC_A, 70 | 71 | /** UPC-E 1D format. */ 72 | UPC_E, 73 | 74 | /** UPC/EAN extension format. Not a stand-alone format. */ 75 | UPC_EAN_EXTENSION 76 | 77 | } 78 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/SMTPResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.Result; 20 | 21 | /** 22 | *Parses an "smtp:" URI result, whose format is not standardized but appears to be like: 23 | * {@code smtp[:subject[:body]]}.
24 | * 25 | * @author Sean Owen 26 | */ 27 | public final class SMTPResultParser extends ResultParser { 28 | 29 | @Override 30 | public EmailAddressParsedResult parse(Result result) { 31 | String rawText = getMassagedText(result); 32 | if (!(rawText.startsWith("smtp:") || rawText.startsWith("SMTP:"))) { 33 | return null; 34 | } 35 | String emailAddress = rawText.substring(5); 36 | String subject = null; 37 | String body = null; 38 | int colon = emailAddress.indexOf(':'); 39 | if (colon >= 0) { 40 | subject = emailAddress.substring(colon + 1); 41 | emailAddress = emailAddress.substring(0, colon); 42 | colon = subject.indexOf(':'); 43 | if (colon >= 0) { 44 | body = subject.substring(colon + 1); 45 | subject = subject.substring(0, colon); 46 | } 47 | } 48 | String mailtoURI = "mailto:" + emailAddress; 49 | return new EmailAddressParsedResult(emailAddress, subject, body, mailtoURI); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/rss/expanded/decoders/BlockParsedResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * These authors would like to acknowledge the Spanish Ministry of Industry, 19 | * Tourism and Trade, for the support in the project TSI020301-2008-2 20 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 21 | * Mobile Dynamic Environments", led by Treelogic 22 | * ( http://www.treelogic.com/ ): 23 | * 24 | * http://www.piramidepse.com/ 25 | */ 26 | 27 | package com.google.zxing.oned.rss.expanded.decoders; 28 | 29 | /** 30 | * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) 31 | * @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) 32 | */ 33 | final class BlockParsedResult { 34 | 35 | private final DecodedInformation decodedInformation; 36 | private final boolean finished; 37 | 38 | BlockParsedResult(boolean finished) { 39 | this(null, finished); 40 | } 41 | 42 | BlockParsedResult(DecodedInformation information, boolean finished) { 43 | this.finished = finished; 44 | this.decodedInformation = information; 45 | } 46 | 47 | DecodedInformation getDecodedInformation() { 48 | return this.decodedInformation; 49 | } 50 | 51 | boolean isFinished() { 52 | return this.finished; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/qrcode/decoder/QRCodeDecoderMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.qrcode.decoder; 18 | 19 | import com.google.zxing.ResultPoint; 20 | 21 | /** 22 | * Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the 23 | * decoding caller. Callers are expected to process this. 24 | * 25 | * @see com.google.zxing.common.DecoderResult#getOther() 26 | */ 27 | public final class QRCodeDecoderMetaData { 28 | 29 | private final boolean mirrored; 30 | 31 | QRCodeDecoderMetaData(boolean mirrored) { 32 | this.mirrored = mirrored; 33 | } 34 | 35 | /** 36 | * @return true if the QR Code was mirrored. 37 | */ 38 | public boolean isMirrored() { 39 | return mirrored; 40 | } 41 | 42 | /** 43 | * Apply the result points' order correction due to mirroring. 44 | * 45 | * @param points Array of points to apply mirror correction to. 46 | */ 47 | public void applyMirroredCorrection(ResultPoint[] points) { 48 | if (!mirrored || points == null || points.length < 3) { 49 | return; 50 | } 51 | ResultPoint bottomLeft = points[0]; 52 | points[0] = points[2]; 53 | points[2] = bottomLeft; 54 | // No need to 'fix' top-left and alignment pattern. 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * These authors would like to acknowledge the Spanish Ministry of Industry, 19 | * Tourism and Trade, for the support in the project TSI020301-2008-2 20 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 21 | * Mobile Dynamic Environments", led by Treelogic 22 | * ( http://www.treelogic.com/ ): 23 | * 24 | * http://www.piramidepse.com/ 25 | */ 26 | 27 | package com.google.zxing.oned.rss.expanded.decoders; 28 | 29 | import com.google.zxing.FormatException; 30 | import com.google.zxing.NotFoundException; 31 | import com.google.zxing.common.BitArray; 32 | 33 | /** 34 | * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) 35 | * @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) 36 | */ 37 | final class AnyAIDecoder extends AbstractExpandedDecoder { 38 | 39 | private static final int HEADER_SIZE = 2 + 1 + 2; 40 | 41 | AnyAIDecoder(BitArray information) { 42 | super(information); 43 | } 44 | 45 | @Override 46 | public String parseInformation() throws NotFoundException, FormatException { 47 | StringBuilder buf = new StringBuilder(); 48 | return this.getGeneralDecoder().decodeAllCodes(buf, HEADER_SIZE); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/WifiResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.Result; 20 | 21 | /** 22 | *Parses a WIFI configuration string. Strings will be of the form:
23 | * 24 | *{@code WIFI:T:[network type];S:[network SSID];P:[network password];H:[hidden?];;}
25 | * 26 | *The fields can appear in any order. Only "S:" is required.
27 | * 28 | * @author Vikram Aggarwal 29 | * @author Sean Owen 30 | */ 31 | public final class WifiResultParser extends ResultParser { 32 | 33 | @Override 34 | public WifiParsedResult parse(Result result) { 35 | String rawText = getMassagedText(result); 36 | if (!rawText.startsWith("WIFI:")) { 37 | return null; 38 | } 39 | String ssid = matchSinglePrefixedField("S:", rawText, ';', false); 40 | if (ssid == null || ssid.isEmpty()) { 41 | return null; 42 | } 43 | String pass = matchSinglePrefixedField("P:", rawText, ';', false); 44 | String type = matchSinglePrefixedField("T:", rawText, ';', false); 45 | if (type == null) { 46 | type = "nopass"; 47 | } 48 | boolean hidden = Boolean.parseBoolean(matchSinglePrefixedField("H:", rawText, ';', false)); 49 | return new WifiParsedResult(type, ssid, pass, hidden); 50 | } 51 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/EmailAddressParsedResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | /** 20 | * @author Sean Owen 21 | */ 22 | public final class EmailAddressParsedResult extends ParsedResult { 23 | 24 | private final String emailAddress; 25 | private final String subject; 26 | private final String body; 27 | private final String mailtoURI; 28 | 29 | EmailAddressParsedResult(String emailAddress, 30 | String subject, 31 | String body, 32 | String mailtoURI) { 33 | super(ParsedResultType.EMAIL_ADDRESS); 34 | this.emailAddress = emailAddress; 35 | this.subject = subject; 36 | this.body = body; 37 | this.mailtoURI = mailtoURI; 38 | } 39 | 40 | public String getEmailAddress() { 41 | return emailAddress; 42 | } 43 | 44 | public String getSubject() { 45 | return subject; 46 | } 47 | 48 | public String getBody() { 49 | return body; 50 | } 51 | 52 | public String getMailtoURI() { 53 | return mailtoURI; 54 | } 55 | 56 | @Override 57 | public String getDisplayResult() { 58 | StringBuilder result = new StringBuilder(30); 59 | maybeAppend(emailAddress, result); 60 | maybeAppend(subject, result); 61 | maybeAppend(body, result); 62 | return result.toString(); 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/SMSTOMMSTOResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.Result; 20 | 21 | /** 22 | *Parses an "smsto:" URI result, whose format is not standardized but appears to be like: 23 | * {@code smsto:number(:body)}.
24 | * 25 | *This actually also parses URIs starting with "smsto:", "mmsto:", "SMSTO:", and 26 | * "MMSTO:", and treats them all the same way, and effectively converts them to an "sms:" URI 27 | * for purposes of forwarding to the platform.
28 | * 29 | * @author Sean Owen 30 | */ 31 | public final class SMSTOMMSTOResultParser extends ResultParser { 32 | 33 | @Override 34 | public SMSParsedResult parse(Result result) { 35 | String rawText = getMassagedText(result); 36 | if (!(rawText.startsWith("smsto:") || rawText.startsWith("SMSTO:") || 37 | rawText.startsWith("mmsto:") || rawText.startsWith("MMSTO:"))) { 38 | return null; 39 | } 40 | // Thanks to dominik.wild for suggesting this enhancement to support 41 | // smsto:number:body URIs 42 | String number = rawText.substring(6); 43 | String body = null; 44 | int bodyStart = number.indexOf(':'); 45 | if (bodyStart >= 0) { 46 | body = number.substring(bodyStart + 1); 47 | number = number.substring(0, bodyStart); 48 | } 49 | return new SMSParsedResult(number, null, null, body); 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/rss/expanded/decoders/AI013x0xDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * These authors would like to acknowledge the Spanish Ministry of Industry, 19 | * Tourism and Trade, for the support in the project TSI020301-2008-2 20 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 21 | * Mobile Dynamic Environments", led by Treelogic 22 | * ( http://www.treelogic.com/ ): 23 | * 24 | * http://www.piramidepse.com/ 25 | */ 26 | 27 | package com.google.zxing.oned.rss.expanded.decoders; 28 | 29 | import com.google.zxing.NotFoundException; 30 | import com.google.zxing.common.BitArray; 31 | 32 | /** 33 | * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) 34 | */ 35 | abstract class AI013x0xDecoder extends AI01weightDecoder { 36 | 37 | private static final int HEADER_SIZE = 4 + 1; 38 | private static final int WEIGHT_SIZE = 15; 39 | 40 | AI013x0xDecoder(BitArray information) { 41 | super(information); 42 | } 43 | 44 | @Override 45 | public String parseInformation() throws NotFoundException { 46 | if (this.getInformation().getSize() != HEADER_SIZE + GTIN_SIZE + WEIGHT_SIZE) { 47 | throw NotFoundException.getNotFoundInstance(); 48 | } 49 | 50 | StringBuilder buf = new StringBuilder(); 51 | 52 | encodeCompressedGtin(buf, HEADER_SIZE); 53 | encodeCompressedWeight(buf, HEADER_SIZE + GTIN_SIZE, WEIGHT_SIZE); 54 | 55 | return buf.toString(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /zxing-orient/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 |Abstract class representing the result of decoding a barcode, as more than 21 | * a String -- as some type of structured data. This might be a subclass which represents 22 | * a URL, or an e-mail address. {@link ResultParser#parseResult(com.google.zxing.Result)} will turn a raw 23 | * decoded string into the most appropriate type of structured representation.
24 | * 25 | *Thanks to Jeff Griffin for proposing rewrite of these classes that relies less 26 | * on exception-based mechanisms during parsing.
27 | * 28 | * @author Sean Owen 29 | */ 30 | public abstract class ParsedResult { 31 | 32 | private final ParsedResultType type; 33 | 34 | protected ParsedResult(ParsedResultType type) { 35 | this.type = type; 36 | } 37 | 38 | public final ParsedResultType getType() { 39 | return type; 40 | } 41 | 42 | public abstract String getDisplayResult(); 43 | 44 | @Override 45 | public final String toString() { 46 | return getDisplayResult(); 47 | } 48 | 49 | public static void maybeAppend(String value, StringBuilder result) { 50 | if (value != null && !value.isEmpty()) { 51 | // Don't add a newline before the first value 52 | if (result.length() > 0) { 53 | result.append('\n'); 54 | } 55 | result.append(value); 56 | } 57 | } 58 | 59 | public static void maybeAppend(String[] values, StringBuilder result) { 60 | if (values != null) { 61 | for (String value : values) { 62 | maybeAppend(value, result); 63 | } 64 | } 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/rss/expanded/decoders/CurrentParsingState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * These authors would like to acknowledge the Spanish Ministry of Industry, 19 | * Tourism and Trade, for the support in the project TSI020301-2008-2 20 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 21 | * Mobile Dynamic Environments", led by Treelogic 22 | * ( http://www.treelogic.com/ ): 23 | * 24 | * http://www.piramidepse.com/ 25 | */ 26 | 27 | package com.google.zxing.oned.rss.expanded.decoders; 28 | 29 | /** 30 | * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) 31 | */ 32 | final class CurrentParsingState { 33 | 34 | private int position; 35 | private State encoding; 36 | 37 | private enum State { 38 | NUMERIC, 39 | ALPHA, 40 | ISO_IEC_646 41 | } 42 | 43 | CurrentParsingState() { 44 | this.position = 0; 45 | this.encoding = State.NUMERIC; 46 | } 47 | 48 | int getPosition() { 49 | return position; 50 | } 51 | 52 | void setPosition(int position) { 53 | this.position = position; 54 | } 55 | 56 | void incrementPosition(int delta) { 57 | position += delta; 58 | } 59 | 60 | boolean isAlpha(){ 61 | return this.encoding == State.ALPHA; 62 | } 63 | 64 | boolean isNumeric(){ 65 | return this.encoding == State.NUMERIC; 66 | } 67 | 68 | boolean isIsoIec646(){ 69 | return this.encoding == State.ISO_IEC_646; 70 | } 71 | 72 | void setNumeric() { 73 | this.encoding = State.NUMERIC; 74 | } 75 | 76 | void setAlpha() { 77 | this.encoding = State.ALPHA; 78 | } 79 | 80 | void setIsoIec646() { 81 | this.encoding = State.ISO_IEC_646; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /zxing-orient/src/main/res/layout/encode.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 |Encapsulates an alignment pattern, which are the smaller square patterns found in 23 | * all but the simplest QR Codes.
24 | * 25 | * @author Sean Owen 26 | */ 27 | public final class AlignmentPattern extends ResultPoint { 28 | 29 | private final float estimatedModuleSize; 30 | 31 | AlignmentPattern(float posX, float posY, float estimatedModuleSize) { 32 | super(posX, posY); 33 | this.estimatedModuleSize = estimatedModuleSize; 34 | } 35 | 36 | /** 37 | *Determines if this alignment pattern "about equals" an alignment pattern at the stated 38 | * position and size -- meaning, it is at nearly the same center with nearly the same size.
39 | */ 40 | boolean aboutEquals(float moduleSize, float i, float j) { 41 | if (Math.abs(i - getY()) <= moduleSize && Math.abs(j - getX()) <= moduleSize) { 42 | float moduleSizeDiff = Math.abs(moduleSize - estimatedModuleSize); 43 | return moduleSizeDiff <= 1.0f || moduleSizeDiff <= estimatedModuleSize; 44 | } 45 | return false; 46 | } 47 | 48 | /** 49 | * Combines this object's current estimate of a finder pattern position and module size 50 | * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two. 51 | */ 52 | AlignmentPattern combineEstimate(float i, float j, float newModuleSize) { 53 | float combinedX = (getX() + j) / 2.0f; 54 | float combinedY = (getY() + i) / 2.0f; 55 | float combinedModuleSize = (estimatedModuleSize + newModuleSize) / 2.0f; 56 | return new AlignmentPattern(combinedX, combinedY, combinedModuleSize); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/oned/EAN8Reader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.oned; 18 | 19 | import com.google.zxing.BarcodeFormat; 20 | import com.google.zxing.NotFoundException; 21 | import com.google.zxing.common.BitArray; 22 | 23 | /** 24 | *Implements decoding of the EAN-8 format.
25 | * 26 | * @author Sean Owen 27 | */ 28 | public final class EAN8Reader extends UPCEANReader { 29 | 30 | private final int[] decodeMiddleCounters; 31 | 32 | public EAN8Reader() { 33 | decodeMiddleCounters = new int[4]; 34 | } 35 | 36 | @Override 37 | protected int decodeMiddle(BitArray row, 38 | int[] startRange, 39 | StringBuilder result) throws NotFoundException { 40 | int[] counters = decodeMiddleCounters; 41 | counters[0] = 0; 42 | counters[1] = 0; 43 | counters[2] = 0; 44 | counters[3] = 0; 45 | int end = row.getSize(); 46 | int rowOffset = startRange[1]; 47 | 48 | for (int x = 0; x < 4 && rowOffset < end; x++) { 49 | int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS); 50 | result.append((char) ('0' + bestMatch)); 51 | for (int counter : counters) { 52 | rowOffset += counter; 53 | } 54 | } 55 | 56 | int[] middleRange = findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN); 57 | rowOffset = middleRange[1]; 58 | 59 | for (int x = 0; x < 4 && rowOffset < end; x++) { 60 | int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS); 61 | result.append((char) ('0' + bestMatch)); 62 | for (int counter : counters) { 63 | rowOffset += counter; 64 | } 65 | } 66 | 67 | return rowOffset; 68 | } 69 | 70 | @Override 71 | BarcodeFormat getBarcodeFormat() { 72 | return BarcodeFormat.EAN_8; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/pdf417/encoder/BarcodeRow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.pdf417.encoder; 18 | 19 | /** 20 | * @author Jacob Haynes 21 | */ 22 | final class BarcodeRow { 23 | 24 | private final byte[] row; 25 | //A tacker for position in the bar 26 | private int currentLocation; 27 | 28 | /** 29 | * Creates a Barcode row of the width 30 | */ 31 | BarcodeRow(int width) { 32 | this.row = new byte[width]; 33 | currentLocation = 0; 34 | } 35 | 36 | /** 37 | * Sets a specific location in the bar 38 | * 39 | * @param x The location in the bar 40 | * @param value Black if true, white if false; 41 | */ 42 | void set(int x, byte value) { 43 | row[x] = value; 44 | } 45 | 46 | /** 47 | * Sets a specific location in the bar 48 | * 49 | * @param x The location in the bar 50 | * @param black Black if true, white if false; 51 | */ 52 | void set(int x, boolean black) { 53 | row[x] = (byte) (black ? 1 : 0); 54 | } 55 | 56 | /** 57 | * @param black A boolean which is true if the bar black false if it is white 58 | * @param width How many spots wide the bar is. 59 | */ 60 | void addBar(boolean black, int width) { 61 | for (int ii = 0; ii < width; ii++) { 62 | set(currentLocation++, black); 63 | } 64 | } 65 | 66 | /* 67 | byte[] getRow() { 68 | return row; 69 | } 70 | */ 71 | 72 | /** 73 | * This function scales the row 74 | * 75 | * @param scale How much you want the image to be scaled, must be greater than or equal to 1. 76 | * @return the scaled row 77 | */ 78 | byte[] getScaledRow(int scale) { 79 | byte[] output = new byte[row.length * scale]; 80 | for (int i = 0; i < output.length; i++) { 81 | output[i] = row[i / scale]; 82 | } 83 | return output; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /zxing-orient/src/main/java/com/google/zxing/client/result/EmailAddressResultParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.zxing.client.result; 18 | 19 | import com.google.zxing.Result; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * Represents a result that encodes an e-mail address, either as a plain address 25 | * like "joe@example.org" or a mailto: URL like "mailto:joe@example.org". 26 | * 27 | * @author Sean Owen 28 | */ 29 | public final class EmailAddressResultParser extends ResultParser { 30 | 31 | @Override 32 | public EmailAddressParsedResult parse(Result result) { 33 | String rawText = getMassagedText(result); 34 | String emailAddress; 35 | if (rawText.startsWith("mailto:") || rawText.startsWith("MAILTO:")) { 36 | // If it starts with mailto:, assume it is definitely trying to be an email address 37 | emailAddress = rawText.substring(7); 38 | int queryStart = emailAddress.indexOf('?'); 39 | if (queryStart >= 0) { 40 | emailAddress = emailAddress.substring(0, queryStart); 41 | } 42 | emailAddress = urlDecode(emailAddress); 43 | Map