Skip to content

Feature/add feature selected picture#888

Open
SuperBeagleDog wants to merge 2 commits intozhihu:masterfrom
SuperBeagleDog:feature/add_feature_selected_picture
Open

Feature/add feature selected picture#888
SuperBeagleDog wants to merge 2 commits intozhihu:masterfrom
SuperBeagleDog:feature/add_feature_selected_picture

Conversation

@SuperBeagleDog
Copy link
Copy Markdown

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)
rashid-topedge

This comment was marked as resolved.

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.

2 participants