Now the App will have the need to select pictures, some will also have the need to select videos, now with Daguerre can realize the selection of pictures, videos, pictures + videos. Let’s take a look at what the Daguerre support library looks like:

select directory preview

Daguerre is fully open source on Github

The sample

The use of Daguerre is very simple, just need to call the time to pass in the corresponding parameters, you can open the selection interface of Daguerre; Example:

Daguerre.with(this)
        .theme(R.style.CustomTheme)
        .spanCount(3)
        .maxSelectable(3)
        .mimeType(MimeType.IMAGE, MimeType.JPEG)
        .setImageLoader(new ImageLoader())
        .launch(REQUEST_CODE);
Copy the code

From the above code, we can guess what the functions are:

  • Custom theme
  • Set the number of columns in the list
  • Set the maximum number of options
  • Supported resource format definitions (Daguerre already has common formats built in, developers can also define their own pass)
  • Fully custom image loading (Daguerre does not have a built-in image loader, only provides interface, developers need to implement) PS: currently can not be customizedFrescoHow images are loaded

The principle of

Daguerre adopts Loader to obtain local picture or video resources, adopts ActionMode when selecting and displays the currently selected quantity by changing the title of ActionMode. The action menu is set to ActionMode to confirm the selection. RecyclerView is used to display the list of pictures, and RecyclerView is used to view the preview interface of large pictures to achieve similar ViewPager effect

custom

Daguerre also has several custom Theme attR attributes to facilitate the basic customization of styles without modifying the source code. For details, see Github

Daguerre is easy to use and is believed to meet your basic needs for photo or video selection. Daguerre is open source on Github, welcome to issue, fork, or comment on this article. Welcome to commit Request