Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add feature selected picture #888

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SuperBeagleDog
Copy link

A lot of users asked a feature that the MatisseActivity page can select those pictures users selected before by default.

So that I add a new api for it:
SelectionCreator.setSelectedItems(ArrayList<String> list)
This worked well.

Use case:

   // Define a list to cache those pictures selected by user
   private ArrayList<String> selectedList = new ArrayList<>();

   // Save selected pictures.
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {
            selectedList.clear();
            selectedList.addAll(Matisse.obtainPathResult(data));-
        }
    }

   // Open the album
   Matisse.from(SampleActivity.this)
                        .choose(MimeType.ofImage(), false)
                        .countable(true)
                        .setSelectedItems(selectedList) // pass those selected pictures.
                        .forResult(REQUEST_CODE_CHOOSE);

liyuefeng added 2 commits May 15, 2023 16:07
…ist).

set a list of uri to select pictures by default(these pictures will be selected by default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant