From 391bad8adeeddc1a47f74d4bdb6a4f0d05d16b84 Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 11 Apr 2023 02:18:44 +0200 Subject: [PATCH] Updated MainActivity to new generateEpcQrCode() signature --- .../java/net/codinux/banking/epcqrcode/MainActivity.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/MainActivity.kt b/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/MainActivity.kt index 0d1d492..abb8350 100644 --- a/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/MainActivity.kt +++ b/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/MainActivity.kt @@ -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)