diff --git a/CHANGELOG.md b/CHANGELOG.md index 62df501075..8fa660947a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product= ### Next version -* Added barcode decoding +* Added barcode decoding (requires Android 7+) * Small improvements and minor bug fixes * Updated [translations](https://crowdin.com/project/open-source-email) diff --git a/app/src/main/assets/CHANGELOG.md b/app/src/main/assets/CHANGELOG.md index 62df501075..8fa660947a 100644 --- a/app/src/main/assets/CHANGELOG.md +++ b/app/src/main/assets/CHANGELOG.md @@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product= ### Next version -* Added barcode decoding +* Added barcode decoding (requires Android 7+) * Small improvements and minor bug fixes * Updated [translations](https://crowdin.com/project/open-source-email) diff --git a/app/src/main/java/eu/faircode/email/AdapterMedia.java b/app/src/main/java/eu/faircode/email/AdapterMedia.java index 67760a2013..04164370ed 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMedia.java +++ b/app/src/main/java/eu/faircode/email/AdapterMedia.java @@ -223,9 +223,11 @@ public class AdapterMedia extends RecyclerView.Adapter Log.w(ex); } - if (barcode_preview) + // https://github.com/zxing/zxing/wiki/Frequently-Asked-Questions#developers + if (barcode_preview && + Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) try (InputStream is = new FileInputStream(file)) { - Bitmap bitmap = BitmapFactory.decodeStream(is); + Bitmap bitmap = ImageHelper.getScaledBitmap(is, file.getAbsolutePath(), type, max); int width = bitmap.getWidth(), height = bitmap.getHeight(); int[] pixels = new int[width * height]; bitmap.getPixels(pixels, 0, width, 0, 0, width, height); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index 0833b9504b..5b0059fd0b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -1351,6 +1351,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swBarcodePreview.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? View.VISIBLE : View.GONE); swBarcodePreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { diff --git a/metadata/en-US/changelogs/2157.txt b/metadata/en-US/changelogs/2157.txt index b7e7ebb0bd..6ad68ae688 100644 --- a/metadata/en-US/changelogs/2157.txt +++ b/metadata/en-US/changelogs/2157.txt @@ -8,7 +8,7 @@ Ypupiara Next version -* Added barcode decoding +* Added barcode decoding (requires Android 7+) * Small improvements and minor bug fixes * Updated translations