Barcode improvements

pull/214/head
M66B 12 months ago
parent 922e1323df
commit f3ca84e88f

@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### Next version ### Next version
* Added barcode decoding * Added barcode decoding (requires Android 7+)
* Small improvements and minor bug fixes * Small improvements and minor bug fixes
* Updated [translations](https://crowdin.com/project/open-source-email) * Updated [translations](https://crowdin.com/project/open-source-email)

@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### Next version ### Next version
* Added barcode decoding * Added barcode decoding (requires Android 7+)
* Small improvements and minor bug fixes * Small improvements and minor bug fixes
* Updated [translations](https://crowdin.com/project/open-source-email) * Updated [translations](https://crowdin.com/project/open-source-email)

@ -223,9 +223,11 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
Log.w(ex); 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)) { 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 width = bitmap.getWidth(), height = bitmap.getHeight();
int[] pixels = new int[width * height]; int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height); bitmap.getPixels(pixels, 0, width, 0, 0, width, height);

@ -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() { swBarcodePreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

@ -8,7 +8,7 @@ Ypupiara
Next version Next version
* Added barcode decoding * Added barcode decoding (requires Android 7+)
* Small improvements and minor bug fixes * Small improvements and minor bug fixes
* Updated translations * Updated translations

Loading…
Cancel
Save