nguyenhoanglam / ImagePicker

A customizable library for selecting images on the device.
Apache License 2.0
599 stars 156 forks source link

Slow Time on loading Image #137

Closed RamesanPP closed 2 years ago

RamesanPP commented 2 years ago

gallery issue.txt This is the code which implements imagepicker.

When selecting a picture from gallery, it takes a noticeable time to update the picture in the app.

The image is being uploaded to local storage in the app. PS: This code was not written by me. The app was already done by the company I work for. I was given the task of refining the app and adding certain other things among which this issue came up. Sorry for being a noobie, please help out if possible. I could not find a solution online.

Here is a video of the issue in the app. https://user-images.githubusercontent.com/84701649/145668023-24cfa01b-128b-4cbd-92cc-3ff43f017b0d.mp4

nguyenhoanglam commented 2 years ago

@RamesanPP It takes time to load because your code only updates profile photo after successfully upload it to server. To fix this, just move below code to the position before updateProfilePic() in onActivityResult callback:

Glide.with(requireContext())
         .load(newPhotoList[0])
         .into(binding.roundedImageView)

Screen Shot 2021-12-12 at 11 30 17 AM Screen Shot 2021-12-12 at 11 33 54 AM

If you've time, let check out version 1.5.1 with some changes and bug fixes.

RamesanPP commented 2 years ago

@nguyenhoanglam Sorry for the late reply. Thanks for clearing the issue. By moving the code, the problem was fixed. But I could not however make it work in the latest updated version. When I try to update to 1.5.1, there are a lot of errors which I'm not gonna bother fixing now. Anyways, thanks and I'll definitely upgrade to the newest version for my newer builds.

nguyenhoanglam commented 2 years ago

@RamesanPP v1.5.1 has a different code implementation. So maybe you encounter some errors. You should try it in your next builds!