Updated MainActivity to new generateEpcQrCode() signature

This commit is contained in:
dankito 2023-04-11 02:18:44 +02:00
parent 44f0bf7d34
commit 391bad8ade
1 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,10 @@ class MainActivity : AppCompatActivity() {
private fun generateQrCode() {
hideKeyboard(edtxtReference)
val param = EpcQrCodeConfig(edtxtReceiver.string, edtxtIban.string, edtxtBic.string, edtxtAmount.string, edtxtReference.string)
val density = resources.displayMetrics.density
val heightAndWidth = (350 * density).toInt()
val param = EpcQrCodeConfig(edtxtReceiver.string, edtxtIban.string, edtxtBic.string, edtxtAmount.string, edtxtReference.string, qrCodeHeightAndWidth = heightAndWidth)
generateQrCodeAsync(param) { createdQrCode ->
imgGeneratedQrCode.setImageBitmap(createdQrCode)
@ -41,10 +44,7 @@ class MainActivity : AppCompatActivity() {
private fun generateQrCodeAsync(param: EpcQrCodeConfig, done: (Bitmap) -> Unit) {
GlobalScope.launch(Dispatchers.IO) {
val density = resources.displayMetrics.density
val heightAndWidth = (350 * density).toInt()
val epcQrCode = EpcQrCodeGenerator().generateEpcQrCode(param, heightAndWidth)
val epcQrCode = EpcQrCodeGenerator().generateEpcQrCode(param)
withContext(Dispatchers.Main) {
done(epcQrCode.androidBitmap)