Replies: 2 comments
-
For decoding - without modifying the library, the easiest is to create a custom Decoder and DecoderFactory. You can override You may need to implement custom code to do the rotation there. If you modify the library, you could pass in a rotation parameter, or just override the rotation here: The above is normally used to determine the orientation of the camera relative to the orientation of the display, which determines whether or not it is required to rotate the image by 90 degrees. If you add 90 to the rotation there, it would be rotated for the decoding. Making the UI match up with this may be more tricky. You'd need to rotate the drawn line, and also translate all the resultpoints correctly. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the pointers. I like the getDisplayRotation() idea because there is no need to write a more code to perform an additional rotation when the engine already does that. It seems like it would make sense to change getDisplayRotation() to protected so that a class that extends BarcodeView (perhaps VerticalBarcodeView) could override this function to return the suggested value. Lastly, translating the ResultPoints could be performed through the BarcodeCallback and the layout modifications could be done with refs.xml and tools:override What are your thoughts on changing getDisplayRotation() to protected? |
Beta Was this translation helpful? Give feedback.
-
My app uses the embedded DecoratedBarcodeView. Sometimes, it would be beneficial if the library scanned vertically, i.e. the red horizontal 'laser' line should be vertical and linear barcodes would be matched that way.
Is there already a way to do this in the library?
If not, where would be a good place to add such functionality? It seems like a few strategic X,Y swaps (and perhaps an alternate layout XML file) is all that would be needed.
Not required, but a nice implementation might be that the library examines the width/height of the BarcodeView and scans along the longer axis.
Any thoughts, ideas, and/or help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions