Swati4star / Images-to-PDF

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

Issue #987 Crop feature cam scanner #1145

Closed HenryZhang0222 closed 1 year ago

HenryZhang0222 commented 1 year ago

Description

The main purpose of PR is to solve the issue #987 - Crop feature similar to cam scanner. Code changes can be found in the ImageToPdfFragment class. My implementation steps are:

  1. Selecting Images: Images are selected from the device using the Matisse library. The selected image is fetched via Matisse.obtainResult(data) and stored as a list of URIs.
  2. Logic for cropping images: After the user selects an image, a dialogue box pops up asking if the user wants to crop the image. If user selects "Yes", then cropImage(Uri.parse(mImagesUri.get(mImageCounter))) method will be executed for the first image.
  3. Working with cropped images: Use the CropImage library for cropping. After cropping, receive the cropped image in onActivityResult. Update the path of the image at the corresponding location in the mImagesUri collection by converting the Uri in the CropImage.ActivityResult object to a string.
  4. Iterative Cropping Process: After cropping on image at a time, check if there are more images to be cropped. If there are, use cropImage(Uri.parse(mImagesUri.get(mImageCounter))) method to continue cropping the next image. When all images are cropped, update the interface to reflect the cropped image.

Fixes #987

Type of change

How Has This Been Tested?

Checklist:

codeclimate[bot] commented 1 year ago

Code Climate has analyzed commit 6615a63d and detected 0 issues on this pull request.

View more on Code Climate.

Swati4star commented 1 year ago

thank you for your contribution!