Seamless transition from thumbnail view to original view

https://github.com/Hitomis/transferee

transferee can help you complete the seamless transition from thumbnail view to original view, and browse multimedia in different formats such as ordinary pictures, long pictures, gif pictures and videos gracefully.

Supported functions:

  • Support video preview
  • Support Gif chart Preview
  • Support large and long map preview
  • Drag off support
  • Supports custom page index indicators
  • Support custom resource loading progress bar
  • Support custom image loader [universal imageloader / glideimageloader / picassoimageloader already exist]
  • Support image saving
  • Support preview picture, zoom, drag, rotate and other gesture operations
  • Seamless transition animation from thumbnail to large image or from large image to thumbnail. When there is no thumbnail information, the animation behavior will be automatically changed to pan transition - > load large image - > stretch image animation
  • Support fool binding RecyclerView / ListView / GridView / ImageView
  • You can start transferee without binding any View
// Add all module s [including Transferee, GlideImageLoader, PicassoImageLoader, universal imageloader]
implementation 'com.github.Hitomis:transferee:1.6.1'

// Add the core module Transferee separately, and then add at least one of the following three image loaders
implementation 'com.github.Hitomis.transferee:Transferee:1.6.1'

// Add Glide picture loader
implementation 'com.github.Hitomis.transferee:GlideImageLoader:1.6.1'

// Add Picasso picture loader
implementation 'com.github.Hitomis.transferee:PicassoImageLoader:1.6.1'

// Add Universal picture loader
implementation 'com.github.Hitomis.transferee:UniversalImageLoader:1.6.1'

 

If used for a single ImageView, it will be very simple:

Transferee transfer = Transferee.getDefault(context);
transfer.apply(TransferConfig.build()
        .setImageLoader(UniversalImageLoader.with(getApplicationContext()))
        .setSourceUrlList(SourceConfig.getMixingSourceGroup())
        .create()
).show());

// Don't forget to call when you leave the page
transfer.destroy();

If you need more functions, here is a complete use example of transferee:

step 1: create only one transferee example per page (it is recommended to write it in onCreate method)

transferee = Transferee.getDefault(context);

step 2: create parameter configurator for transferee

TransferConfig config = TransferConfig.build()
       .setSourceImageList(sourceUrlList) // Resource url collection, in String format
       .setSourceUriList(sourceUriList) // Resource URI collection, URI format
       .setMissPlaceHolder(R.mipmap.ic_empty_photo) // Bitmap before resource loading
       .setErrorPlaceHolder(R.mipmap.ic_empty_photo) // Bitmap after resource loading error
       .setProgressIndicator(new ProgressPieIndicator()) // The resource loading progress indicator can realize the IProgressIndicator extension
       .setIndexIndicator(new NumberIndexIndicator()) // The resource quantity index indicator can realize the extension of IIndexIndicator
       .setImageLoader(GlideImageLoader.with(getApplicationContext())) // Image loader can realize the extension of ImageLoader
       .setBackgroundColor(Color.parseColor("#000000 ") / / background color
       .setDuration(300) // Animation duration of opening, closing, gesture dragging and closing, display, diffusion and disappearance
       .setOffscreenPageLimit(2) // The number of preloaded resources during the first initialization or page switching conflicts with the justLoadHitImage property. The default is 1
       .setCustomView(customView) // Custom view, which will be placed on the panel of transferee
       .setNowThumbnailIndex(index) // Index of thumbnails in a group
       .enableJustLoadHitPage(true) // Whether to load only the resources currently displayed on the screen. It is off by default
       .enableDragClose(true) // Whether to enable the pull-down gesture is off. It is on by default
       .enableDragHide(false) // Whether to hide other views on the page except the main view when pull-down dragging is closed. It is enabled by default
       .enableDragPause(false) // When pull-down dragging is off, if it is currently a video, whether to pause playback is off by default
       .enableHideThumb(false) // Whether to turn it on. When transferee is turned on, the thumbnail is hidden. It is turned off by default
       .enableScrollingWithPageChange(false) // Whether to enable the list to scroll your list with the page switching. It is off by default
       .setOnLongClickListener(new Transferee.OnTransfereeLongClickListener() { // Long press and hold the listener of the current page
            @Override
            public void onLongClick(ImageView imageView, String imageUri, int pos) {
                saveImageFile(imageUri); // Use transferee GetFile (imageuri) gets the cache file and saves it. Video is not supported
            }
        })
       .bindImageView(imageView, source) // Bind an ImageView, and all binding methods can only call one
       .bindListView(listView, R.id.iv_thumb) // Bind a ListView, and all binding methods can only call one
       .bindRecyclerView(recyclerView, R.id.iv_thumb)  // Bind a RecyclerView, and all binding methods can only call one

step 3: Show transferee

transferee.apply(config).show();

step 4: when leaving the page, you need to destroy the resources in the transferee to prevent memory leakage (it is recommended to write it in the onDestroy method)

transferee.destroy()

 

Config

attributeexplain
sourceUrlListThe collection of resource URLs to be previewed, in String format
sourceUriListCollection of resource URIs to preview, URI format
nowThumbnailIndexThe index of thumbnails in the graph group. If you bind ListView or RecyclerView, this attribute is required, otherwise it can be ignored; Or you can specify the position of the initialization display page when you open transferee
offscreenPageLimitDisplays the number of resources initially loaded during transferee. The default value is 1, which means that three are loaded for the first time (nowThumbnailIndex, nowThumbnailIndex + 1, nowThumbnailIndex - 1); A value of 2 indicates that 5 sheets are loaded. And so on
missPlaceHolderDefault bitmap, resource id format. The default picture displayed when the resource is not loaded
missDrawableThe default bitmap is in Drawable format. The default picture displayed when the resource is not loaded
errorPlaceHolderLoad the wrong bitmap, resource id format. The picture displayed when the original image is loaded incorrectly
errorDrawableLoad the wrong bitmap in Drawable format. The picture displayed when the original image is loaded incorrectly
backgroundColorTransferee background color when transferee is displayed
durationThe duration of animation such as opening, closing, gesture dragging and closing, transparency animation display, diffusion and disappearance
justLoadHitPageWhether to load only the resources in the current page. If it 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 preloading and loading actions of the current page will be performed according to the value set by offscreen pagelimit, which is closed by default
enableDragCloseWhether it supports dragging down to close. It is enabled by default
enableDragHideWhether to hide other views except the main view when dragging and closing. It is on by default
enableDragPauseWhether to pause the video playback of the current page when dragging is closed. It is closed by default
enableHideThumbWhether to turn it on. When transferee is turned on, the thumbnail is hidden. It is turned on by default
enableScrollingWithPageChangeWhether to start the list to scroll with the page switching is only valid for binding RecyclerView/GridView/ListView. After starting, because the list will scroll in real time, the thumbnail view will not be empty, so as to ensure that the animation is turned off for transition when the transferee is turned off, which is turned off by default
progressIndicatorResource loading progress indicator (default built-in ProgressPieIndicator and ProgressBarIndicator). The IProgressIndicator interface can be implemented to define its own resource loading progress indicator
indexIndicatorResource index indicator (default built-in CircleIndexIndicator and NumberIndexIndicator). The IIndexIndicator interface can be implemented to define its own resource index indicator
imageLoaderResource loader. The ImageLoader interface can be implemented to define its own image loader
imageIdImageView id in ItemView of RecyclerView or ListView
customViewThe user-defined view is placed on the panel after the transferee is displayed
listViewIf you use the ListView or GridView to arrange the display pictures, you need to pass your ListView or GridView into the bindListView() method
recyclerViewIf you use the RecyclerView to arrange the displayed pictures, you need to pass the RecyclerView into the bindRecyclerView() method
imageViewIf you only want to use the functions of this library for a single ImageView, or if a single ImageView on the interface is the cover of an album, use bindImageView(...) Or its overloaded method can meet your needs

 

Method

methodexplain
getDefault(context)Get transferee instance
apply(config)Apply the configuration parameter object to the transferee instance
show()Turn on / show transferee
show(listener)Turn on / display transferee and monitor the display / off status
isShown()Is transferee displayed
dismiss()Close transferee
clear()Clear all cached files such as pictures and videos
destroy()Destroy the resources used by transferee to prevent memory leakage
getImageFile(url)Get the cached image corresponding to the url
setOnTransfereeStateChangeListener(listener)Set the transferee to display / turn off the listener for status change

Added by surreal5335 on Thu, 03 Mar 2022 17:37:12 +0200