generate stylized QR code based on ZXing
val bitmap = StylizeQRGenerator.Builder()
.dotStyle(true)
.margin(2)
.build()
.generate(text)
binding.qrNormal.setImageBitmap(bitmap)
val gradient = GradientDrawable(GradientDrawable.Orientation.BL_TR, arrayOf(Color.BLUE, Color.RED).toIntArray())
val bitmapGradient = StylizeQRGenerator.Builder()
.dotStyle(true)
.margin(2)
.gradient(gradient)
.build()
.generate(text)
binding.qrGradient.setImageBitmap(bitmapGradient)
val bg = ContextCompat.getDrawable(this, R.drawable.bg)?.toBitmap(150, 150, Bitmap.Config.ARGB_8888)!!
val bitmapBG = StylizeQRGenerator.Builder()
.dotStyle(true)
.background(bg)
.margin(2)
.build()
.generate(longText)
binding.qrBg.setImageBitmap(bitmapBG)
val logo = ContextCompat.getDrawable(this, R.drawable.logo)?.toBitmap(150, 150, Bitmap.Config.RGB_565)!!
val bitmapLogo = StylizeQRGenerator.Builder()
.dotStyle(true)
.background(bg)
.margin(2)
.logo(logo)
.build()
.generate(text)
binding.qrLogo.setImageBitmap(bitmapLogo)