ZXing Fragment Library


Source link: https://github.com/mitoyarzun/zxingfragmentlib

ZXing Fragment Library

This library allows you to embed a Barcode scanner as a Fragment.

Most of the code was taken from the official ZXing repository, this is basically a re-implementation of CaptureActivity.java.

This was also inspired by another similar library, barcodefragmentlib.

WARNING

I'm currently updating this library, I've updated the original ZXing sources to the latest version and there might be some incompatibilities with older versions of Android.

Please browse the before-rebuild branch to get the previous version.

There are some bugs that prevent the scanning in portrait mode (especially with 1D codes, QR and others should be ok).

I've tested the code and it's working (at least) in Android 2.1 (Eclair), 2.3 (Gingerbread) and 4.4 (KitKat). If yours doesn't work, please create an issue.

Goals

Here are the basic guidelines for this project. As always, suggestions are appreciated :)

  • Provide a simple library to scan codes using ZXing's core library.
  • Be compatible with Android 2.1 and up.
  • Work out of the box (or almost).
  • Facilitate customization and/or configuration.

Usage

  1. Add the library as a module dependency to your app.
  2. Add the ZXing core library (the jar is included in libs/zxing-core-2.3.jar)
  3. Add the following permissions to your AndroidManifest.xml
 <uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />
  1. Extend the BarCodeScannerFragment class and add a callback somewhere:

    this.setmCallBack(new BarCodeScannerFragment.IResultCallback() {
    
      @Override
      public void result(Result lastResult) {
    
    Log.v("zxingfragmentlib", lastResult.toString());
    
      
    }
     
    }
    );
    
  2. Enjoy!

A sample activity is included, look at SampleActivity.java, SampleFragment.java and sample_activity.xml to get an idea.

Contributing

Any code improvements and bug reports are appreciated, just submit a pull request or open an issue.

TODO

  • Remove unused XMLs
  • Remove PreferencesActivity
  • Add front-camera selector
  • Test in more devices

Author

Jaime Oyarzun [email protected]

The original ZXing project is at https://github.com/zxing/zxing

Resources

A rxJava2 + ViewPager banner view for android. Automatically starts playing images and stops when on touching.

Transform any object into an async object (can be useful for VIPER).

Rx binding for AltBeacon.

Detect device shake in background (if you want), specifying sensitivity, range, counts.

This library helps android developers to implement something like iOS key value observer pattern (KVO).

A library that implements Google Play like PersistentSearch view.

  • 3 modes: Toolbar with drawer button, MenuItem and Toolbar with back button
  • MenuItem mode reveal animation
  • Voice recognition support.
  • Use android.support.v7.widget.CardView to draw background and shadow, you can set persistentSV_searchCardElevation to modify shadow size.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes