Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Wrapped excluded images list into a singleton#168

Open
qandeelabbassi wants to merge 1 commit into
esafirm:masterfrom
qandeelabbassi:master
Open

Wrapped excluded images list into a singleton#168
qandeelabbassi wants to merge 1 commit into
esafirm:masterfrom
qandeelabbassi:master

Conversation

@qandeelabbassi

Copy link
Copy Markdown

Created a singleton object ExcludedMediaSingleton which provides getter and setter methods for excludedImages and removed the excludedImages list from ImagePickerConfig to avoid TransactionTooLargeException

if (excludedImages != null) {
dest.writeList(this.excludedImages);
}
dest.writeByte((byte) ((ExcludedMediaSingleton.getInstance().getExcludedImages() == null ||

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove isPresent

this.excludedImages = new ArrayList<>();
in.readList(this.excludedImages, File.class.getClassLoader());
}
// if (isPresent) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all this comments

import java.util.ArrayList;

/**
* Code written by Qandeel Abbassi on 9/20/2018 at 7:03 PM.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

@esafirm esafirm closed this Oct 2, 2018
@esafirm esafirm reopened this Oct 2, 2018
@qandeelabbassi

Copy link
Copy Markdown
Author

I will review your requested changes. I will let you know when it's done and sorry about the signature; that was not intentional.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants