QRGen


Source link: https://github.com/kenglxn/QRGen

QRGen: a simple QRCode generation api for java built on top ZXING

Dependencies:

ZXING: http://code.google.com/p/zxing/

Get it:

QRGen consists of three modules: core, javase and android.

As of 2.1.0 QRGen is available from jitpack.io. QRGen is no longer deployed to maven central (ref: #61). Older releases are available from Maven Central Repository.

Maven:

 <repositories>

<repository>

 <id>jitpack.io</id>

 <url>https://jitpack.io</url>

</repository>
  </repositories>

Gradle:

 allprojects {

repositories {

 // ...

 maven {
 url "https://jitpack.io" 
}

}

  
}
Nexus proxy setup for jitpack

See https://github.com/jitpack/jitpack.io/issues/506 for solution.

(thanks to @LTheobald for the heads up)

Java Application

When developing a Java application you need to add javase module to your list of dependencies. The required core module will be added automatically by your build system:

Gradle:

 dependencies {

compile 'com.github.kenglxn.QRGen:javase:2.3.0'
  
}

Maven:

 <dependencies>

<dependency>

 <groupId>com.github.kenglxn.qrgen</groupId>

 <artifactId>javase</artifactId>

 <version>2.3.0</version>

</dependency>
  </dependencies>
Android

When you want to use QRGen inside your android application you need to add the android module to your list of dependencies. The required core module will be added automatically by your build system:

Gradle:

 dependencies {

compile 'com.github.kenglxn.QRGen:android:2.3.0'
  
}

Maven:

 <dependencies>

<dependency>

 <groupId>com.github.kenglxn.qrgen</groupId>

 <artifactId>android</artifactId>

 <version>2.3.0</version>

</dependency>
  </dependencies>

Or you can clone and build yourself:

 git clone git://github.com/kenglxn/QRGen.git
  cd QRGen/
  mvn clean install

Usage:

// get QR file from text using defaults File file = QRCode.from("Hello World").file();
  // get QR stream from text using defaults ByteArrayOutputStream stream = QRCode.from("Hello World").stream();
  // override the image type to be JPG QRCode.from("Hello World").to(ImageType.JPG).file();
 QRCode.from("Hello World").to(ImageType.JPG).stream();
  // override image size to be 250x250 QRCode.from("Hello World").withSize(250, 250).file();
 QRCode.from("Hello World").withSize(250, 250).stream();
  // override size and image type QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).file();
 QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).stream();
  // override default colors (black on white) // notice that the color format is "0x(alpha: 1 byte)(RGB: 3 bytes)" // so in the example below it's red for foreground and yellowish for background, both 100% alpha (FF). QRCode.from("Hello World").withColor(0xFFFF0000, 0xFFFFFFAA).file();
  // supply own outputstream QRCode.from("Hello World").to(ImageType.PNG).writeTo(outputStream);
  // supply own file name QRCode.from("Hello World").file("QRCode");
  // supply charset hint to ZXING QRCode.from("Hello World").withCharset("UTF-8");
  // supply error correction level hint to ZXING QRCode.from("Hello World").withErrorCorrection(ErrorCorrectionLevel.L);
  // supply any hint to ZXING QRCode.from("Hello World").withHint(EncodeHintType.CHARACTER_SET, "UTF-8");
  // encode contact data as vcard using defaults VCard johnDoe = new VCard("John Doe")

.setEmail("[email protected]")

.setAddress("John Doe Street 1, 5678 Doestown")

.setTitle("Mister")

.setCompany("John Doe Inc.")

.setPhoneNumber("1234")

.setWebsite("www.example.org");
 QRCode.from(johnDoe).file();
  // if using special characters don't forget to supply the encoding VCard johnSpecial = new VCard("Jöhn D?e")

 .setAddress("ëåäö? Sträät 1, 1234 Döestüwn");
 QRCode.from(johnSpecial).withCharset("UTF-8").file();
 

Android only

On Android you have a special method bitmap() which returns a android.graphics.Bitmap without creating a File object before, so you can use the generated android.graphics.Bitmap immediately inside an ImageView:

Bitmap myBitmap = QRCode.from("www.example.org").bitmap();
 ImageView myImage = (ImageView) findViewById(R.id.imageView);
 myImage.setImageBitmap(myBitmap);

License:

http://www.apache.org/licenses/LICENSE-2.0.html

Resources

A simple, customizable and easy to use swipeable view stack for Android.

A simple & fluent Android ORM.

Assent is designed to make Marshmallow's runtime permissions easier to use. Have the flexibility of request permissions and receiving results through callback interfaces.

MultiLevelListView is an Open Source Android library providing view for displaying items grouped into levels and sub-levels. Levels hierarchy size is not limited. Any particular data model is not required, it fully depends on developer.

Material Intro View is a showcase android library.

A library with custom views based on gestures.

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