Printable barcode texts

This commit is contained in:
M66B 2024-02-10 13:15:07 +01:00
parent dcb090db82
commit 95a4358b6a
2 changed files with 3 additions and 1 deletions

View File

@ -232,7 +232,7 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
BinaryBitmap bBitmap = new BinaryBitmap(new HybridBinarizer(source));
MultiFormatReader reader = new MultiFormatReader();
Result result = reader.decode(bBitmap);
args.putString("barcode_text", result.getText());
args.putString("barcode_text", Helper.getPrintableString(result.getText()));
args.putString("barcode_format", result.getBarcodeFormat().name());
} catch (NotFoundException ex) {
Log.w(ex);

View File

@ -2186,6 +2186,8 @@ public class Helper {
// https://issuetracker.google.com/issues/37054851
static String getPrintableString(String value) {
if (TextUtils.isEmpty(value))
return value;
StringBuilder result = new StringBuilder();
for (int i = 0; i < value.length(); i++) {
char kar = value.charAt(i);