Android icon indicating copy to clipboard operation
Android copied to clipboard

Consider using the new image viewer for barcodes

Open TheLastProject opened this issue 4 months ago • 5 comments

Not sure how viable, but the new image viewer introduced in #3184 is a lot more flexible than the current setup. Maybe we can somehow make it work with the barcode in the "full screen view"?

If so, we can maybe fix both #3171 and #2821 at once. As an added benefit, it would severely reduce the complexity of the LoyaltyCardViewActivity, which is an old Java class using Android XML, which was want to migrate away from.

Something to research.

TheLastProject avatar Jul 12 '26 17:07 TheLastProject

Hi! I am trying to work on this, and I have already built some base for it. What is the expected result more precisely? Do we want to keep the functionality to stretch the barcode drawable based on the sliders on the bottom?

KamiDaga avatar Oct 11 '26 13:10 KamiDaga

I marked it as "Something to research" because I'm not completely sure what would be best or if it's even a good idea. But it would make the code a lot cleaner while giving more flexibility to users I think.

I think the one thing most people want is for the barcode to be near the edge? So I think what we need it:

  1. The image viewer to support hiding the top bar
  2. The image viewer supporting aligning the image anywhere but the center (default: top)

If those conditions are satisfied, people could zoom any way they want so I think the sliders are no longer needed then.

Though I do see one pain point: sometimes scanners exist with very little space available, like these in the Netherlands (this one has more space than many), so it needs to be possible to make a 2D barcode take very little vertical space:

Image

So yeah, I'm not sure how this would work best. Above all, we need to not break existing use cases, so maybe we need to be able to resize horizontally and vertically separately (so: stretch)?

TheLastProject avatar Oct 11 '26 15:10 TheLastProject

Thanks for the clarification, it gave me a better understanding. By now I got this behaviour: https://github.com/user-attachments/assets/62eae9e9-8ce2-41c2-aa5a-5e9300e13ee2

I still need to polish something, but I wanted to ask you of this Is close to what we want to obtaim

KamiDaga avatar Oct 20 '26 05:10 KamiDaga

It's a bit hard to tell with the video, I don't think I see any two finger zoom actions? So I'm not quite sure how it is working in your video.

Are you extending the current image viewer to allow moving instead of just zooming or what are you doing? I can't tell if this is the correct direction, not enough info.

TheLastProject avatar Oct 27 '26 12:10 TheLastProject

My bad providing no context, sorry about it. So basically my idea is: double finger slide = drag (only vertically), zoom in/out vertically/horizontally extends the qr code in the appropriate direction. The qr stretch is implemented through the pre-existing qr-code generation logic and mantains a percentage of both width and heigth stretch so that it is backwards compatible

KamiDaga avatar Oct 30 '26 20:10 KamiDaga