0
0
mirror of https://github.com/markusfisch/BinaryEye.git synced 2024-09-19 19:42:18 +02:00

Add DX_FILM_EDGE barcode format

And add it to the selected barcodes so it's immediately
available for existing installations too.
This commit is contained in:
Markus Fisch 2024-02-17 13:41:49 +01:00
parent ef7e2a4b0d
commit 2e89f1530a
3 changed files with 23 additions and 10 deletions

View File

@ -36,6 +36,7 @@ ZXing can read the following barcode formats:
* [CODE 93][code_93]
* [CODE 128][code_128]
* [DATA MATRIX][data_matrix]
* [DX FILM EDGE][dx_film_edge]
* [EAN 8][ean_8]
* [EAN 13][ean_13]
* [ITF][itf]
@ -144,6 +145,7 @@ class YourActivity : Activity() {
[code_93]: https://en.wikipedia.org/wiki/Code_93
[code_128]: https://en.wikipedia.org/wiki/Code_128
[data_matrix]: https://en.wikipedia.org/wiki/Data_Matrix
[dx_film_edge]: https://en.wikipedia.org/wiki/DX_encoding
[ean_8]: https://en.wikipedia.org/wiki/EAN-8
[ean_13]: https://en.wikipedia.org/wiki/International_Article_Number
[itf]: https://en.wikipedia.org/wiki/Interleaved_2_of_5

View File

@ -21,6 +21,7 @@ class Preferences {
BarcodeFormat.DATA_BAR.name,
BarcodeFormat.DATA_BAR_EXPANDED.name,
BarcodeFormat.DATA_MATRIX.name,
BarcodeFormat.DX_FILM_EDGE.name,
BarcodeFormat.EAN_8.name,
BarcodeFormat.EAN_13.name,
BarcodeFormat.ITF.name,
@ -218,16 +219,11 @@ class Preferences {
fun update() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
preferences.getStringSet(BARCODE_FORMATS, barcodeFormats)?.let {
// Add rMQR Code for existing installations.
val addRMQRCode = "rmqr_added"
barcodeFormats = if (!preferences.getBoolean(addRMQRCode, false)) {
preferences.edit().putBoolean(addRMQRCode, true).apply()
it.toMutableSet().apply {
add(BarcodeFormat.RMQR_CODE.name)
}
} else {
it
}
barcodeFormats = addFormatsOnUpdate(
it,
BarcodeFormat.RMQR_CODE,
BarcodeFormat.DX_FILM_EDGE
)
}
}
cropHandleX = preferences.getInt(CROP_HANDLE_X, cropHandleX)
@ -325,6 +321,19 @@ class Preferences {
)
}
private fun addFormatsOnUpdate(
restored: Set<String>,
vararg formats: BarcodeFormat
) = restored.toMutableSet().apply {
for (format in formats) {
val name = "${format.name}_added"
if (!preferences.getBoolean(name, false)) {
preferences.edit().putBoolean(name, true).apply()
add(format.name)
}
}
}
fun beepTone() = when (beepToneName) {
"tone_cdma_confirm" -> ToneGenerator.TONE_CDMA_CONFIRM
"tone_sup_radio_ack" -> ToneGenerator.TONE_SUP_RADIO_ACK

View File

@ -8,6 +8,7 @@
<item>DATA BAR</item>
<item>DATA BAR EXPANDED</item>
<item>DATA MATRIX</item>
<item>DX FILM EDGE</item>
<item>EAN 8</item>
<item>EAN 13</item>
<item>ITF</item>
@ -28,6 +29,7 @@
<item>DATA_BAR</item>
<item>DATA_BAR_EXPANDED</item>
<item>DATA_MATRIX</item>
<item>DX_FILM_EDGE</item>
<item>EAN_8</item>
<item>EAN_13</item>
<item>ITF</item>