Swati4star / Images-to-PDF

An app to convert images to PDF file!
GNU General Public License v3.0
1.17k stars 790 forks source link

[#1101] Add new feature to allow user scan QR code from saved image #1141

Open ShinChan1420 opened 8 months ago

ShinChan1420 commented 8 months ago

QrBarcodeScanFragment.java: add logical code

drawable: add two xml icons, ic_barcode_from_image_24dp.xml and ic_qrcode_from_image_24dp.xml

modify fragment_qrcode_barcode.xml

modify strings.xml

Description

ScreenShots for the new feature in UI: Two new buttons

image

users choose images from the gallery image

when the user scanned no corresponding code or no code in the saved image

image

when the user scanned a detectable code

image

As I cannot change the UI in the camera scanning interface, I prefer to add two access points for users to choose what they want to do with the QR/bar code scanner, either read from the gallery or the camera. I created two new cards for users to choose whether to scan with the camera or from images from the gallery.

I believe this is the optimal solution while maintaining the speed of the original camera opening and not changing the camera interface. It raises the learning cost for the user. Still, once the user is familiar with it, he/she will find it much more appealing as it doesn't pop up a window asking which one to choose and then has to click again to select it if he/she touches it accidentally by mistake. Large icons and clickable areas reduce the number of accidental touches.

Fixes #1101

Type of change

Just put an x in the [] which are valid.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

And new codes are highlighted, it's easy to see what has been changed.

Moreover, I found it was incompatible with my editor when I wanted to do the tests on it. I just made a local change with the test. Nothing more changes

System: macOS 14.0 CPU: Apple M2 Pro EDITOR: Android Studio Flamingo | 2022.2.1

image
codeclimate[bot] commented 8 months ago

Code Climate has analyzed commit 2a57627f and detected 7 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 5
Duplication 2

View more on Code Climate.

ShinChan1420 commented 8 months ago

I will fix these issues.

ShinChan1420 commented 8 months ago

This PR is ready for merge, the code I changed could be retrieved from 09116d5 and 220d0d6 with comments.