All Projects → yuriy-budiyev → Code Scanner

yuriy-budiyev / Code Scanner

Licence: mit
Code scanner library for Android, based on ZXing

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Code Scanner

Zxinglite
🔥 ZXing的精简版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信)
Stars: ✭ 2,117 (+289.87%)
Mutual labels:  qr-code, zxing, barcode-scanner, barcode, scanner, code
Zxing
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
Stars: ✭ 28,795 (+5202.95%)
Mutual labels:  qr-code, zxing, barcode-scanner, barcode
Qr Code Scanner
📠 A simple, fast and useful progressive web application
Stars: ✭ 982 (+80.85%)
Mutual labels:  qr-code, barcode-scanner, barcode, scanner
Ngx Scanner
Angular (2+) QR code, Barcode, DataMatrix, scanner component using ZXing.
Stars: ✭ 420 (-22.65%)
Mutual labels:  qr-code, zxing, barcode, scanner
Flutter barcode scanner
Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
Stars: ✭ 194 (-64.27%)
Mutual labels:  barcode-scanner, barcode, scanner
browser
ZXing for JS's browser layer with decoding implementations for browser.
Stars: ✭ 88 (-83.79%)
Mutual labels:  barcode, qr-code, zxing
Qrandbarcodescanner
An Android app for scanning QR codes and barcodes
Stars: ✭ 114 (-79.01%)
Mutual labels:  zxing, barcode, scanner
scanbot-sdk-example-ionic
Scanbot scanner SDK example app for Ionic with Cordova.
Stars: ✭ 24 (-95.58%)
Mutual labels:  scanner, barcode, qr-code
Nativescript Barcodescanner
🔎 NativeScript QR / barcode (bulk)scanner plugin
Stars: ✭ 280 (-48.43%)
Mutual labels:  qr-code, barcode-scanner, barcode
Zxing Typescript
Open-source, multi-format 1D/2D barcode image processing library ported from Java in TypeScript usable from node or browser
Stars: ✭ 68 (-87.48%)
Mutual labels:  qr-code, zxing, barcode-scanner
Qzxing
Qt/QML wrapper library for the ZXing library. 1D/2D barcode image processing library
Stars: ✭ 401 (-26.15%)
Mutual labels:  zxing, barcode-scanner, barcode
barcode scan2
[reborned barcode_scan] A flutter plugin for reading 2D barcodes and QR codes.
Stars: ✭ 43 (-92.08%)
Mutual labels:  scanner, barcode, barcode-scanner
Barcode To Pc App
Barcode to PC app
Stars: ✭ 121 (-77.72%)
Mutual labels:  barcode-scanner, barcode, scanner
Scannermapp
A QR-code and barcode acanner app built in Delphi using ZXing and TFrameStand
Stars: ✭ 65 (-88.03%)
Mutual labels:  zxing, barcode-scanner, barcode
Scanbot Sdk Example Android
Document scanning SDK example apps for the Scanbot SDK for Android.
Stars: ✭ 67 (-87.66%)
Mutual labels:  qr-code, barcode, scanner
scanbot-sdk-example-ios
No description or website provided.
Stars: ✭ 17 (-96.87%)
Mutual labels:  scanner, barcode, qr-code
React Native Vision Camera
📸 The Camera library that sees the vision.
Stars: ✭ 443 (-18.42%)
Mutual labels:  qr-code, library, scanner
python
Build Python extension with Dynamsoft Barcode Reader.
Stars: ✭ 35 (-93.55%)
Mutual labels:  barcode, qr-code
StarBarcode
一个基于Zxing封装的条形码扫描库。支持多种条形码,可生成、解析带logo的二维码,自动放大镜头,设备移动时自动对焦、连续对焦,扫描UI自定义。
Stars: ✭ 52 (-90.42%)
Mutual labels:  barcode, zxing
pola-ios
Pola pomoże Ci odnaleźć polskie wyroby. Zabierając Polę na zakupy odnajdujesz produkty “z duszą” i wspierasz polską gospodarkę.
Stars: ✭ 17 (-96.87%)
Mutual labels:  barcode, barcode-scanner

Code Scanner

Download Android Arsenal API Codacy Badge

Code scanner library for Android, based on ZXing

Features

  • Auto focus and flash light control
  • Portrait and landscape screen orientations
  • Back and front facing cameras
  • Customizable viewfinder
  • Kotlin friendly
  • Touch focus

Supported formats

1D product 1D industrial 2D
UPC-A Code 39 QR Code
UPC-E Code 93 Data Matrix
EAN-8 Code 128 Aztec
EAN-13 Codabar PDF 417
ITF MaxiCode
RSS-14
RSS-Expanded

Usage (sample)

Add dependency:

dependencies {
    implementation 'com.budiyev.android:code-scanner:2.1.0'
}

Add camera permission to AndroidManifest.xml (Don't forget about dynamic permissions on API >= 23):

<uses-permission android:name="android.permission.CAMERA"/>

Define a view in your layout file:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.budiyev.android.codescanner.CodeScannerView
        android:id="@+id/scanner_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:autoFocusButtonColor="@android:color/white"
        app:autoFocusButtonVisible="true"
        app:flashButtonColor="@android:color/white"
        app:flashButtonVisible="true"
        app:frameColor="@android:color/white"
        app:frameCornersSize="50dp"
        app:frameCornersRadius="0dp"
        app:frameAspectRatioWidth="1"
        app:frameAspectRatioHeight="1"
        app:frameSize="0.75"
        app:frameThickness="2dp"
        app:maskColor="#77000000"/>
</FrameLayout>

And add following code to your activity:

Kotlin

class MainActivity : AppCompatActivity() {
    private lateinit var codeScanner: CodeScanner

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val scannerView = findViewById<CodeScannerView>(R.id.scanner_view)
        
        codeScanner = CodeScanner(this, scannerView)
        
        // Parameters (default values)
        codeScanner.camera = CodeScanner.CAMERA_BACK // or CAMERA_FRONT or specific camera id
        codeScanner.formats = CodeScanner.ALL_FORMATS // list of type BarcodeFormat,
                                                      // ex. listOf(BarcodeFormat.QR_CODE)
        codeScanner.autoFocusMode = AutoFocusMode.SAFE // or CONTINUOUS
        codeScanner.scanMode = ScanMode.SINGLE // or CONTINUOUS or PREVIEW
        codeScanner.isAutoFocusEnabled = true // Whether to enable auto focus or not
        codeScanner.isFlashEnabled = false // Whether to enable flash or not
        
        // Callbacks
        codeScanner.decodeCallback = DecodeCallback {
            runOnUiThread {
                Toast.makeText(this, "Scan result: ${it.text}", Toast.LENGTH_LONG).show()
            }
        }
        codeScanner.errorCallback = ErrorCallback { // or ErrorCallback.SUPPRESS
            runOnUiThread {
                Toast.makeText(this, "Camera initialization error: ${it.message}",
                        Toast.LENGTH_LONG).show()
            }
        }
        
        scannerView.setOnClickListener {
            codeScanner.startPreview()
        }
    }

    override fun onResume() {
        super.onResume()
        codeScanner.startPreview()
    }

    override fun onPause() {
        codeScanner.releaseResources()
        super.onPause()
    }
}

Java

public class MainActivity extends AppCompatActivity {
    private CodeScanner mCodeScanner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        CodeScannerView scannerView = findViewById(R.id.scanner_view);
        mCodeScanner = new CodeScanner(this, scannerView);
        mCodeScanner.setDecodeCallback(new DecodeCallback() {
            @Override
            public void onDecoded(@NonNull final Result result) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(MainActivity.this, result.getText(), Toast.LENGTH_SHORT).show();
                    }
                });
            }
        });
        scannerView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mCodeScanner.startPreview();
            }
        });       
    }

    @Override
    protected void onResume() {
        super.onResume();
        mCodeScanner.startPreview();
    }

    @Override
    protected void onPause() {
        mCodeScanner.releaseResources();
        super.onPause();
    }
}

or fragment:

Kotlin

class MainFragment : Fragment() {
    private lateinit var codeScanner: CodeScanner

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, 
            savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_main, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val scannerView = view.findViewById<CodeScannerView>(R.id.scanner_view)
        val activity = requireActivity()
        codeScanner = CodeScanner(activity, scannerView)
        codeScanner.decodeCallback = DecodeCallback {
            activity.runOnUiThread {
                Toast.makeText(activity, it.text, Toast.LENGTH_LONG).show()
            }
        }
        scannerView.setOnClickListener {
            codeScanner.startPreview()
        }
    }

    override fun onResume() {
        super.onResume()
        codeScanner.startPreview()
    }

    override fun onPause() {
        codeScanner.releaseResources()
        super.onPause()
    }
}

Java

public class MainFragment extends Fragment {
    private CodeScanner mCodeScanner;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
            @Nullable Bundle savedInstanceState) {
        final Activity activity = getActivity();
        View root = inflater.inflate(R.layout.fragment_main, container, false);
        CodeScannerView scannerView = root.findViewById(R.id.scanner_view);
        mCodeScanner = new CodeScanner(activity, scannerView);
        mCodeScanner.setDecodeCallback(new DecodeCallback() {
            @Override
            public void onDecoded(@NonNull final Result result) {
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(activity, result.getText(), Toast.LENGTH_SHORT).show();
                    }
                });
            }
        });
        scannerView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mCodeScanner.startPreview();
            }
        });        
        return root;
    }

    @Override
    public void onResume() {
        super.onResume();
        mCodeScanner.startPreview();
    }

    @Override
    public void onPause() {
        mCodeScanner.releaseResources();
        super.onPause();
    }
}

Preview

Preview screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].