Renamed EpcQrCodeCreator to EpcQrCodeGenerator

This commit is contained in:
dankito 2022-03-13 22:23:22 +01:00
parent db548eb9cd
commit 5d818dfeec
5 changed files with 9 additions and 12 deletions

View File

@ -1,11 +1,7 @@
package net.codinux.banking.epcqrcode
open class EpcQrCodeCreator {
// companion object {
// val AmountNumberFormat = Decim
// }
open class EpcQrCodeGenerator {
open fun generate(param: EpcQrCodeConfig): EpcQrCode {

View File

@ -8,6 +8,7 @@ import kotlin.concurrent.thread
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -32,7 +33,7 @@ class MainActivity : AppCompatActivity() {
val density = resources.displayMetrics.density
val config = EncodeToQrCodeConfig((EncodeToQrCodeConfig.DefaultWidth * density).toInt(), (EncodeToQrCodeConfig.DefaultHeight * density).toInt())
val qrCodeContent = EpcQrCodeCreator().generateAsString(param)
val qrCodeContent = EpcQrCodeGenerator().generateAsString(param)
// TODO: this takes a very long time. Improve it
val generatedQrCode = QrCodeGenerator().generateQrCode(qrCodeContent, config)

View File

@ -268,7 +268,7 @@ class MainWindow : View(FX.messages["application.title"]) {
private fun generateQrCode() {
val param = EpcQrCodeConfig(receiver.value, iban.value, bic.value, amount.value, reference.value)
val qrCodeContent = EpcQrCodeCreator().generateAsString(param)
val qrCodeContent = EpcQrCodeGenerator().generateAsString(param)
generatedQrCodeImage.value = generateQrCode(qrCodeContent)

View File

@ -2,7 +2,7 @@ package net.codinux.banking.epcqrcode.rest
import net.codinux.banking.epcqrcode.EpcQrCodeConfig
import net.codinux.banking.epcqrcode.EncodeToQrCodeConfig
import net.codinux.banking.epcqrcode.EpcQrCodeCreator
import net.codinux.banking.epcqrcode.EpcQrCodeGenerator
import net.codinux.banking.epcqrcode.QrCodeGenerator
import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeRequestDto
import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeResponseDto
@ -22,7 +22,7 @@ class EpcQrCodeResource {
}
protected val epcQrCodeCreator = EpcQrCodeCreator()
protected val epcQrCodeGenerator = EpcQrCodeGenerator()
protected val qrCodeGenerator = QrCodeGenerator()
@ -31,7 +31,7 @@ class EpcQrCodeResource {
@Produces(MediaType.APPLICATION_JSON)
fun createEpcQrCode(requestDto: GenerateEpcQrCodeRequestDto): Response {
try {
val qrCodeContent = epcQrCodeCreator.generateAsString(mapToEpcQrCodeConfig(requestDto))
val qrCodeContent = epcQrCodeGenerator.generateAsString(mapToEpcQrCodeConfig(requestDto))
val qrCodeBytes = qrCodeGenerator.generateQrCode(qrCodeContent, map(requestDto))
return Response.ok(GenerateEpcQrCodeResponseDto(qrCodeBytes))

View File

@ -81,10 +81,10 @@ struct ContentView: View {
private func generateQRCode() {
let creator = EpcQrCodeCreator()
let generator = EpcQrCodeGenerator()
let param = EpcQrCodeConfig(receiverName: receiver, iban: iban, bic: bic, amount: amount, reference: reference, noteToUser: nil, encoding: .utf8)
let qrCodeContent = creator.generateAsString(param: param)
let qrCodeContent = generator.generateAsString(param: param)
self.generatedQrCode = generateQRCode(qrCodeContent)
}