Transferee can help you seamlessly transition from thumbnail view to original view, and elegantly browse multimedia in different formats such as ordinary pictures, long pictures, GIFs, and videos.

Get a feel for browsing images:

Browse GIF images

Browse the video

If it looks like what you want, click the link below to download apK and play with Demo.apk

Currently, Transferee supports the following functions:

  • Support video preview
  • Gif preview is supported
  • Supports large and long graph preview
  • Support drag and drop off
  • Support for custom page index indicators
  • Customize the resource loading progress bar
  • Support for custom image loader [UniversalImageLoader/GlideImageLoader/PicassoImageLoader]
  • Support image saving
  • Support preview picture zoom, drag, rotation and other gesture operations
  • Support foolproof binding RecyclerView/ListView/GridView/ImageView
  • Transferee can be started without binding any View

Adding dependencies quickly

step1.

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io'}}}Copy the code

step2.

// add all modules [Transferee, GlideImageLoader, PicassoImageLoader, UniversalImageLoader] implementation'com. Making. Hitomis: transferee: 1.6.1'// Add a separate core Module Transferee, and then at least one of the three image loaders needs to be implemented'com. Making. Hitomis. Transferee: transferee: 1.6.1'// Add Glide image loader implementation'com. Making. Hitomis. Transferee: GlideImageLoader: 1.6.1'// Add Picasso image loader implementation'com. Making. Hitomis. Transferee: PicassoImageLoader: 1.6.1'// add Universal image loader implementation'com. Making. Hitomis. Transferee: UniversalImageLoader: 1.6.1'
Copy the code

use

If used against a single ImageView, it is very simple:

// Call transferee.destroy() transferee.apply(transferconfig.build () .setImageLoader(GlideImageLoader.with(getApplicationContext())) .bindImageView(sourceIv, imageUrl)
        ).show();
Copy the code

If you need more functionality, here’s a complete example of Transferee in use:

Create only one transferee sample per page (preferably in the onCreate method).

transferee = Transferee.getDefault(context);
Copy the code

Step 2: Create a parameter configurator for the transferee

TransferConfig config = TransferConfig.build()
       .setSourceImageList(sourceUrlList) // Resource URL collection, String format. SetSourceUriList (sourceUriList) // Set of resource URIs Uri format.setMissplaceholder (r.mpmap.ic_empty_photo) // Placeholder map before resource loading. SetErrorPlaceHolder (R.mpmap.ic_empty_photo) // SetProgressIndicator (new ProgressPieIndicator()) // Resource loading progress indicator IProgressIndicator extension.setIndexIndicator(new NumberIndexIndicator()) SetImageLoader (GlideImageLoader. With (getApplicationContext()))) The ImageLoader extension.setBackgroundColor(color.parsecolor ("# 000000"SetOffscreenPageLimit (2) // The number of resources preloaded when initializing or switching the page for the first time, Conflicts with justLoadHitImage property, defaults to 1. SetCustomView (customView) // customView, SetNowThumbnailIndex (index) // Thumbnail index in the picture group. EnableJustLoadHitPage (true) // Whether to load only the resources currently displayed on the screen, off by default. EnableDragClose (true) // Whether to enable pull-down gesture off, default enableDragHide(false) // Whether to hide all views on the page except the main view when the pull-down is disabled. This function is enabled by default.falseEnableHideThumb (enableHideThumb(enableHideThumb))falseWhether) / / open when the transferee to open, to hide thumbnails, off by default. EnableScrollingWithPageChange (falseSetOnLongClickListener (new Transferee).setonLongClickListener (new Transferee);OnTransfereeLongClickListener@override public void onLongClick(ImageView ImageView, String imageUri, int pos) { saveImageFile(imageUri); }}). BindImageView (imageView,sourceBindListView (listView, r.i.iv_thumb); // Bind an ImageView, all bind methods can only call a.bindListView(listView, R.I.iv_thumb) All binding methods can only call a. BindRecyclerView (recyclerView, R.id.iv_thumb) // bind a recyclerView, all binding methods can only call aCopy the code

Step 3: Display the transferee

transferee.apply(config).show();
Copy the code

When leaving the page, you need to destroy the resources in the Transferee to prevent memory leaks.

transferee.destroy()
Copy the code

Configuration list

attribute instructions
sourceUrlList A collection of resource urls to preview, in String format
sourceUriList A collection of resource URIs to be previewed in URI format
nowThumbnailIndex The index of thumbnails in the group. This property is required if you bind to ListView or RecyclerView, otherwise you can ignore it
offscreenPageLimit The number of resources that are initialized to load when the transferee is displayed. The default value is 1, indicating the first load of 3 resources (nowThumbnailIndex, nowThumbnailIndex + 1, nowThumbnailIndex – 1). If the value is 2, five cards are loaded. So on
missPlaceHolder Default placeholder map in resource ID format. The image that is displayed by default when the resource has not finished loading
missDrawable Default placeholder in Drawable format. The image that is displayed by default when the resource has not finished loading
errorPlaceHolder Loading error placeholder map, resource ID format. The image that is displayed when the original image is loaded incorrectly
errorDrawable Loading error placeholder map in Drawable format. The image that is displayed when the original image is loaded incorrectly
backgroundColor Transferee Indicates the transferee background color when displayed
duration The duration of animation such as on, off, gesture drag off, transparency animation display, diffusion disappear, etc
justLoadHitPage Whether to load only resources in the current page. If the value is set to true, the loading action of the current page will be triggered only when the transferee switches to the current page. Otherwise, the value offscreenPageLimit is set to preload and the loading action of the current page, which is disabled by default
enableDragClose Whether to enable or disable the function by dragging down
enableDragHide Whether to hide views other than the main view when dragging and closing. Enabled by default
enableDragPause Whether to pause the video playing on the current page when dragging and closing
enableHideThumb Enable Or Not Hides the thumbnail when transferee is enabled. This function is enabled by default
enableScrollingWithPageChange Whether to start the list with the switch of page scrolling, only for binding RecyclerView/GridView/ListView effective, will start because after list, real-time thumbnail view will not appear the phenomenon of empty, This ensures that closing transferee is a transitional closing animation, which is disabled by default
progressIndicator Resource loading progress indicator (built-in ProgressPieIndicator and ProgressBarIndicator by default). You can implement the IProgressIndicator interface to define your own resource loading progress indicator
indexIndicator Resource index indicators (CircleIndexIndicator and NumberIndexIndicator are built-in by default). You can implement the IIndexIndicator interface to define your own resource index indicators
imageLoader Resource loader. The ImageLoader interface can be implemented to define its own ImageLoader
imageId RecyclerView or ListView ItemView ImageView ID
customView The user – defined view is placed on the panel after transferee displays it
listView If you are using a ListView or GridView to display images, you need to pass your ListView or GridView into the bindListView() method
recyclerView If you use RecyclerView to arrange display images, pass the RecyclerView into bindRecyclerView()
imageView If you only want to use the library’s capabilities for a single ImageView, or if the single ImageView on the interface is the cover of an album, use bindImageView(…). Or its overloaded methods may suit your needs

Method statement

methods instructions
getDefault(context) Obtain the Transferee instance
apply(config) Apply the configuration parameter object to the Transferee instance
show() The transferee function is enabled or displayed
show(listener) Open/display the transferee and listen for the display/close status
isShown() Transferee Whether to display
dismiss() Close the transferee
clear() Clear all cached files such as pictures and videos
destroy() Destroys resources used by transferee to prevent memory leaks
getImageFile(url) Gets the cached image corresponding to the URL
setOnTransfereeStateChangeListener(listener) Sets transferee to display/disable the listener for state changes

If you’re interested in the project, you can click transferee to go to Github to learn more