journeyapps / zxing-android-embedded

Barcode scanner library for Android, based on the ZXing decoder
https://journeyapps.com/
Apache License 2.0
5.68k stars 1.26k forks source link

Make initializeAttributes public instead of protected to enable custom frame position #672

Closed juliansteenbakker closed 2 years ago

juliansteenbakker commented 2 years ago

Description of the problem:

In order to move the BarcodeView to another position on the screen rather than centered it is advised to extend the default BarcodeView and override calculateFramingRect in order to change the position.

If we want to decorate this barcode view using the default DecoratedBarcodeView, we run into the following problem:

        // Pass on any preview-related attributes
        barcodeView!!.initializeAttributes(attrs)

Since the newly created customBarcodeView is not part of this package, the protected function initializeAttributes(attrs) can't be called. This blocks the use of a custom barcodeView.

If we make this function public, we can use all the same code but with a modified barcodeView.

Which library version are you using? 4.3.0

nathanfallet commented 2 years ago

@juliansteenbakker @rkistner This issue can be closed if the fixing pull request was merged