mirror of https://github.com/M66B/FairEmail.git
Printable barcode texts
This commit is contained in:
parent
dcb090db82
commit
95a4358b6a
|
@ -232,7 +232,7 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
|
||||||
BinaryBitmap bBitmap = new BinaryBitmap(new HybridBinarizer(source));
|
BinaryBitmap bBitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||||
MultiFormatReader reader = new MultiFormatReader();
|
MultiFormatReader reader = new MultiFormatReader();
|
||||||
Result result = reader.decode(bBitmap);
|
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());
|
args.putString("barcode_format", result.getBarcodeFormat().name());
|
||||||
} catch (NotFoundException ex) {
|
} catch (NotFoundException ex) {
|
||||||
Log.w(ex);
|
Log.w(ex);
|
||||||
|
|
|
@ -2186,6 +2186,8 @@ public class Helper {
|
||||||
// https://issuetracker.google.com/issues/37054851
|
// https://issuetracker.google.com/issues/37054851
|
||||||
|
|
||||||
static String getPrintableString(String value) {
|
static String getPrintableString(String value) {
|
||||||
|
if (TextUtils.isEmpty(value))
|
||||||
|
return value;
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (int i = 0; i < value.length(); i++) {
|
for (int i = 0; i < value.length(); i++) {
|
||||||
char kar = value.charAt(i);
|
char kar = value.charAt(i);
|
||||||
|
|
Loading…
Reference in New Issue