GlideBarcode is an open-source barcode loading extension for Android Glide that wraps barcode generating and displaying.
Step 1. Add the JitPack repository to your root build.gradle at the end of repositories.
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
/* Zxing */
implementation 'com.google.zxing:core:X.X.X'
/* Glide */
implementation 'com.github.bumptech.glide:glide:X.X.X'
kapt 'com.github.bumptech.glide:compiler:X.X.X'
implementation 'com.github.illiashenkoo:glide-barcode:X.X.X'
}
Step 1. Include a AppGlideModule implementation in your application:
@GlideModule
class MyAppGlideModule : AppGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
super.registerComponents(context, glide, registry)
}
}
Step 2. Initialize GlideBarcode => GlideBarcode.registerFactory(registry)
@GlideModule
class MyAppGlideModule : AppGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
super.registerComponents(context, glide, registry)
GlideBarcode.registerFactory(registry)
}
}
Step 3. Create barcode object
val barcode = Barcode("QrCode", BarcodeFormat.QR_CODE)
Step 4. Show barcode
Glide.with(this)
.load(barcode)
.into(imageView)