Renamed EpcQrCodeCreator to EpcQrCodeGenerator
This commit is contained in:
parent
db548eb9cd
commit
5d818dfeec
|
@ -1,11 +1,7 @@
|
||||||
package net.codinux.banking.epcqrcode
|
package net.codinux.banking.epcqrcode
|
||||||
|
|
||||||
|
|
||||||
open class EpcQrCodeCreator {
|
open class EpcQrCodeGenerator {
|
||||||
|
|
||||||
// companion object {
|
|
||||||
// val AmountNumberFormat = Decim
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
open fun generate(param: EpcQrCodeConfig): EpcQrCode {
|
open fun generate(param: EpcQrCodeConfig): EpcQrCode {
|
|
@ -8,6 +8,7 @@ import kotlin.concurrent.thread
|
||||||
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
val density = resources.displayMetrics.density
|
val density = resources.displayMetrics.density
|
||||||
val config = EncodeToQrCodeConfig((EncodeToQrCodeConfig.DefaultWidth * density).toInt(), (EncodeToQrCodeConfig.DefaultHeight * density).toInt())
|
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
|
// TODO: this takes a very long time. Improve it
|
||||||
val generatedQrCode = QrCodeGenerator().generateQrCode(qrCodeContent, config)
|
val generatedQrCode = QrCodeGenerator().generateQrCode(qrCodeContent, config)
|
||||||
|
|
|
@ -268,7 +268,7 @@ class MainWindow : View(FX.messages["application.title"]) {
|
||||||
|
|
||||||
private fun generateQrCode() {
|
private fun generateQrCode() {
|
||||||
val param = EpcQrCodeConfig(receiver.value, iban.value, bic.value, amount.value, reference.value)
|
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)
|
generatedQrCodeImage.value = generateQrCode(qrCodeContent)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package net.codinux.banking.epcqrcode.rest
|
||||||
|
|
||||||
import net.codinux.banking.epcqrcode.EpcQrCodeConfig
|
import net.codinux.banking.epcqrcode.EpcQrCodeConfig
|
||||||
import net.codinux.banking.epcqrcode.EncodeToQrCodeConfig
|
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.QrCodeGenerator
|
||||||
import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeRequestDto
|
import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeRequestDto
|
||||||
import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeResponseDto
|
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()
|
protected val qrCodeGenerator = QrCodeGenerator()
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class EpcQrCodeResource {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
fun createEpcQrCode(requestDto: GenerateEpcQrCodeRequestDto): Response {
|
fun createEpcQrCode(requestDto: GenerateEpcQrCodeRequestDto): Response {
|
||||||
try {
|
try {
|
||||||
val qrCodeContent = epcQrCodeCreator.generateAsString(mapToEpcQrCodeConfig(requestDto))
|
val qrCodeContent = epcQrCodeGenerator.generateAsString(mapToEpcQrCodeConfig(requestDto))
|
||||||
val qrCodeBytes = qrCodeGenerator.generateQrCode(qrCodeContent, map(requestDto))
|
val qrCodeBytes = qrCodeGenerator.generateQrCode(qrCodeContent, map(requestDto))
|
||||||
|
|
||||||
return Response.ok(GenerateEpcQrCodeResponseDto(qrCodeBytes))
|
return Response.ok(GenerateEpcQrCodeResponseDto(qrCodeBytes))
|
||||||
|
|
|
@ -81,10 +81,10 @@ struct ContentView: View {
|
||||||
|
|
||||||
|
|
||||||
private func generateQRCode() {
|
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 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)
|
self.generatedQrCode = generateQRCode(qrCodeContent)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue