Wrapped excluded images list into a singleton#168
Conversation
| if (excludedImages != null) { | ||
| dest.writeList(this.excludedImages); | ||
| } | ||
| dest.writeByte((byte) ((ExcludedMediaSingleton.getInstance().getExcludedImages() == null || |
There was a problem hiding this comment.
I believe this is not needed anymore.
| @@ -198,10 +191,10 @@ protected ImagePickerConfig(Parcel in) { | |||
| this.selectedImages = in.createTypedArrayList(Image.CREATOR); | |||
|
|
|||
| boolean isPresent = in.readByte() != 0; | |||
| this.excludedImages = new ArrayList<>(); | ||
| in.readList(this.excludedImages, File.class.getClassLoader()); | ||
| } | ||
| // if (isPresent) { |
| import java.util.ArrayList; | ||
|
|
||
| /** | ||
| * Code written by Qandeel Abbassi on 9/20/2018 at 7:03 PM. |
There was a problem hiding this comment.
Sorry, no signatures or this kind of comment in the repo
| /** | ||
| * Code written by Qandeel Abbassi on 9/20/2018 at 7:03 PM. | ||
| */ | ||
| public class ExcludedMediaSingleton { |
There was a problem hiding this comment.
This could be generate singleton for transferring large data between others activities/fragment to ImagePicker.
Can you add ImagePickerConfig.selectedImages to this as well?
The name could be renamed to something more general as well, and please omit "Singleton" from it.
|
|
||
| public void resetExclusions() { | ||
| if (excludedImages != null) { | ||
| excludedImages.clear(); |
There was a problem hiding this comment.
I think this could lead to some unexpected behavior since excludedImages is shared between ImagePicker and others screen on the app.
If you want to do this, please copy the list instead of just assigning it in setExcludedImageFiles()
|
I will review your requested changes. I will let you know when it's done and sorry about the signature; that was not intentional. |
Created a singleton object
ExcludedMediaSingletonwhich provides getter and setter methods forexcludedImagesand removed theexcludedImageslist fromImagePickerConfigto avoidTransactionTooLargeException