Support more formats & cleanup

This commit is contained in:
soraefir 2024-03-24 13:00:22 +01:00
parent 8181da421e
commit 84ebdcc9a8
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
5 changed files with 39 additions and 12 deletions

View File

@ -1,3 +1,4 @@
#file: noinspection SpellCheckingInspection
name: CI-Android APK

View File

@ -1,3 +1,7 @@
<!--suppress ALL -->
<div align="center">
<h1>Keepass Fidelity</h1>
<p>A minimalist fidelity/loyalty card plugin</p>
@ -28,6 +32,7 @@
- Recently used history for fast access
- Protect entries from caching
- Minimalist design and features
- Supported Formats: CODE_39, CODE_93, CODE_128, EAN_8, EAN_13, UPC_A, UPC_E, UPC_EAN, CODE_QR, PDF_417, AZTEC, CODABAR, MAXICODE, DATA_MATRIX, ITF, RSS_14, RSS_EXPANDED
## 📳 Installation
@ -54,7 +59,6 @@ Keepass-Fidelity is a user-driven project. We welcome any contribution, big or s
Thanks to all contributors, the developers of our dependencies, and our users.
## 📝 License
```

View File

@ -65,17 +65,13 @@ android {
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.camera:camera-camera2:1.3.2'
implementation 'androidx.camera:camera-lifecycle:1.3.2'
implementation 'androidx.camera:camera-view:1.3.2'
runtimeOnly 'androidx.camera:camera-camera2:1.3.2'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.zxing:core:3.5.3'
}

View File

@ -15,21 +15,39 @@ object BarcodeFormatConverter {
"UPC_A" -> BarcodeFormat.UPC_A
"UPC_E" -> BarcodeFormat.UPC_E
"PDF_417" -> BarcodeFormat.PDF_417
"AZTEC" -> BarcodeFormat.AZTEC
"CODABAR" -> BarcodeFormat.CODABAR
"MAXICODE" -> BarcodeFormat.MAXICODE
"DATA_MATRIX" -> BarcodeFormat.DATA_MATRIX
"ITF" -> BarcodeFormat.ITF
"RSS_14" -> BarcodeFormat.RSS_14
"RSS_EXPANDED" -> BarcodeFormat.RSS_EXPANDED
"UPC_EAN" -> BarcodeFormat.UPC_EAN_EXTENSION
else -> throw Exception("Unsupported Format: $f")
}
}
fun formatToString(f: BarcodeFormat): String {
return when (f) {
BarcodeFormat.CODE_128 -> "CODE_128"
BarcodeFormat.CODE_39 -> "CODE_39"
BarcodeFormat.CODE_93 -> "CODE_93"
BarcodeFormat.CODE_128 -> "CODE_128"
BarcodeFormat.EAN_8 -> "EAN_8"
BarcodeFormat.EAN_13 -> "EAN_13"
BarcodeFormat.QR_CODE -> "CODE_QR"
BarcodeFormat.UPC_A -> "UPC_A"
BarcodeFormat.UPC_E -> "UPC_E"
BarcodeFormat.PDF_417 -> "PDF_417"
BarcodeFormat.AZTEC -> "AZTEC"
BarcodeFormat.CODABAR -> "CODABAR"
BarcodeFormat.MAXICODE -> "MAXICODE"
BarcodeFormat.DATA_MATRIX -> "DATA_MATRIX"
BarcodeFormat.ITF -> "ITF"
BarcodeFormat.RSS_14 -> "RSS_14"
BarcodeFormat.RSS_EXPANDED -> "RSS_EXPANDED"
BarcodeFormat.UPC_EAN_EXTENSION -> "UPC_EAN"
else -> throw Exception("Unsupported Format: $f")
}
}

View File

@ -16,14 +16,22 @@
<string name="format">Format</string>
<string name="save">Save</string>
<string-array name="format_array">
<item>CODE_128</item>
<item>CODE_39</item>
<item>CODE_93</item>
<item>CODE_128</item>
<item>EAN_8</item>
<item>EAN_13</item>
<item>CODE_QR</item>
<item>UPC_A</item>
<item>UPC_E</item>
<item>PDF_417</item>
<item>AZTEC</item>
<item>CODABAR</item>
<item>MAXICODE</item>
<item>DATA_MATRIX</item>
<item>ITF</item>
<item>RSS_14</item>
<item>RSS_EXPANDED</item>
<item>UPC_EAN</item>
</string-array>
</resources>