diff --git a/EpcQrCodeAndroidApp/build.gradle.kts b/EpcQrCodeAndroidApp/build.gradle.kts index dd9252d..d9fb213 100644 --- a/EpcQrCodeAndroidApp/build.gradle.kts +++ b/EpcQrCodeAndroidApp/build.gradle.kts @@ -9,6 +9,9 @@ group = "net.codinux.banking.epcqrcode.android" dependencies { implementation(project(":EpcQrCode")) + + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("androidx.core:core-ktx:1.2.0") implementation("androidx.appcompat:appcompat:1.1.0") implementation("androidx.constraintlayout:constraintlayout:1.1.3") diff --git a/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/Extensions.kt b/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/Extensions.kt index 0efbb3a..bc9d761 100644 --- a/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/Extensions.kt +++ b/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/Extensions.kt @@ -9,7 +9,7 @@ import com.google.android.material.textfield.TextInputEditText import com.soywiz.korim.format.toAndroidBitmap -val EpcQrCode.image: Bitmap +val EpcQrCode.androidBitmap: Bitmap get() = this.bitmap.toAndroidBitmap() 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 ebfb775..b0f4038 100644 --- a/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/MainActivity.kt +++ b/EpcQrCodeAndroidApp/src/main/java/net/codinux/banking/epcqrcode/MainActivity.kt @@ -3,8 +3,13 @@ package net.codinux.banking.epcqrcode import android.graphics.Bitmap import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import android.view.View +import android.widget.Button import kotlinx.android.synthetic.main.activity_main.* -import kotlin.concurrent.thread +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext class MainActivity : AppCompatActivity() { @@ -14,7 +19,13 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) - btnGenerateQrCode.setOnClickListener { generateQrCode() } + findViewById