Legendary Coderslcoders.ir Amirhossein Aghajari --> امیر حسین آقاجری Glide Version : 4.7.0 Edited Version : 4.7.1 Retrofit , Glide hi. Tnx For Select Amir_Glide Library. The Best Glid Library in Android.. You Can Connect Amir_Glide To The Amir_Retrofit To Get Best Speed !
Initialize Glide Return a new Initializer Class _____________________________________________________________________ If you do not use Initialize, the default Context will be ApplicationContext _____________________________________________________________________ Examples : DimGlideAsAmir_Glide Default : Glide.Initializer.Default Retrofit : Glide.Initializer.Retrofit(Amir_Retrofit,0) 'CallFactory Glide.Initializer.Retrofit(Amir_Retrofit,1) 'HttpClient OkHttp : Glide.Initializer.OkHttp(OkHttpClient)
Loads a few resources ahead in the direction of scrolling in any RecyclerView so that images are in the memory cache just before the corresponding view in created in the list. Gives the appearance of an infinitely large image cache, depending on scrolling speed, cpu speed, and cache size.
Must be added as a listener to the RecyclerView using OnScrollListener, or have its corresponding methods called from another android.support.v7.widget.RecyclerView.OnScrollListener to function.
This class only works with android.support.v7.widget.LinearLayoutManager and subclasses of android.support.v7.widget.LinearLayoutManager.
This is a Custom Method Useing Callback Retrofit To Show Image And Gifs ... You Can Use This Method Just With Initialize Retrofit Don't Forgot to Enable Cache In Retrofit Builder
Prevents any bitmaps being loaded from previous requests, releases any resources held by this request, displays the current placeholder if one was provided, and marks the request as having been cancelled.
ClearOnDetachAsAmir_GlideRequest
Clears the View's Request when the View is detached from its android.view.Window and restarts the Request when the View is re-attached from its android.view.Window.
This is an experimental API that may be removed in a future version.
Using this method can save memory by allowing Glide to more eagerly clear resources when transitioning screens or swapping adapters in scrolling views. However it also substantially increases the odds that images will not be in memory if users subsequently return to a screen where images were previously loaded. Whether or not this happens will depend on the number of images loaded in the new screen and the size of the memory cache. Increasing the size of the memory cache can improve this behavior but it largely negates the memory benefits of using this method.
Use this method with caution and measure your memory usage to ensure that it's actually improving your memory usage in the cases you care about.
isCancelledAsBoolean
Returns true if the request has been cancelled.
isCompleteAsBoolean
Returns true if the request has completed successfully.
Returns true if this Request is equivalent to the given Request (has all of the same options and sizes).
This method is identical to Object equals(Object) except that it's specific to Request subclasses. We do not use Object equals(Object) directly because we track Requests in collections like java.util.Set and it's perfectly legitimate to have two different Request objects for two different Targets (for example). Using a similar but different method let's us selectively compare Request objects to each other when it's useful in specific scenarios.
isFailedAsBoolean
Returns true if the request has failed.
isPausedAsBoolean
Returns true if this request is paused and may be restarted.
isResourceSetAsBoolean
Returns true if a non-placeholder resource is put. For Requests that load more than one resource, isResourceSet may return true even if isComplete returns false.
isRunningAsBoolean
Returns true if this request is running and has not completed or failed.
PauseAsAmir_GlideRequest
Identical to clear except that the request may later be restarted.
RecycleAsAmir_GlideRequest
Recycles the request object and releases its resources.
waitForLayout If set to true, Glide will always wait for any pending layout pass before checking for the size a View. If set to false Glide will only wait for a pending layout pass if it's unable to resolve the size from layout parameters or an existing View size. Because setting this parameter to true forces Glide to wait for the layout pass to occur before starting the load, setting this parameter to true can cause flashing in some cases and should be used sparingly. If layout parameters are set to fixed sizes, they will still be used instead of the View's dimensions even if this parameter is set to true. This parameter is a fallback only.
onResourceReady (Data As Object,Model As Object,DataSourceName As String,isFirstResource as boolean) As Boolean onLoadFailed (ErrorMessage As String,Model As Object,isFirstResource as boolean) As Boolean
Returns a copy of this request builder with all of the options put so far on this builder.
This method returns a "deep" copy in that all non-immutable arguments are copied such that changes to one builder will not affect the other builder. However, in addition to immutable arguments, the current model is not copied copied so changes to the model will affect both builders.
Sets a RequestBuilder that is built and run iff the load started by this RequestBuilder fails.
If this RequestBuilder uses a thumbnail that succeeds the given error RequestBuilder will be started anyway if the non-thumbnail request fails.
Recursive calls to this method as well as calls to thumbnail(float) and thumbnail(RequestBuilder) are supported for the given error RequestBuilder.
Unlike thumbnail(RequestBuilder) and thumbnail(float), no options from this primary RequestBuilder are propagated to the given error RequestBuilder. Options like priority, override widths and heights and transitions must be applied independently to the error builder.
The given RequestBuilder will start and potentially override a fallback drawable if it's set on this RequestBuilder via RequestOptions fallback(android.graphics.drawable.Drawable) or RequestOptions fallback(int).
Into (ViewAsandroid.widget.ImageView) AsAmir_GlideRequest
Sets the ImageView the resource will be loaded into, cancels any existing loads into the view, and frees any resources Glide may have previously loaded into the view so they may be reused.
Sets a RequestListener to monitor the resource load. It's best to create a single instance of an exception handler per type of request (usually activity/fragment) rather than pass one in per request to avoid some redundant object allocation.
Loads a resource in an identical manner to this request except with the dimensions of the target multiplied by the given size multiplier. If the thumbnail load completes before the full size load, the thumbnail will be shown. If the thumbnail load completes after the full size load, the thumbnail will not be shown.
Loads and displays the resource retrieved by the given thumbnail request if it finishes before this request. Best used for loading thumbnail resources that are smaller and will be loaded more quickly than the full size resource. There are no guarantees about the order in which the requests will actually finish. However, if the thumb request completes after the full request, the thumb resource will never replace the full resource.
Updates this options set with any options that are explicitly set in the given RequestOptions object and returns this object if autoClone() is disabled or a new RequestOptions object if autoClone() is enabled.
apply only replaces those values that are explicitly set in the given RequestOptions. If you need to completely reset all previously set options, create a new RequestOptions object instead of using this method.
The options that will be set to values in the returned RequestOptions object is the intersection of the set of options in this RequestOptions object and the given RequestOptions object that were explicitly set. If the values of any of the options conflict, the values in the returned RequestOptions object will be set to those in the given RequestOptions object.
AutoCloneAsAmir_GlideRequestOptions
Similar to lock() except that mutations cause a clone() operation to happen before the mutation resulting in all methods returning a new Object and leaving the original locked object unmodified.
Auto clone is not retained by cloned objects returned from mutations. The cloned objects are mutable and are not locked.
CenterCropAsAmir_GlideRequestOptions
Applies CenterCrop to all default types and throws an exception if asked to transform an unknown type.
this will override previous calls to dontTransform().
CenterInsideAsAmir_GlideRequestOptions
Applies CenterInside to all default types, DownsampleStrategy CENTER_INSIDE to image types and throws an exception if asked to transform an unknown type.
This will override previous calls to dontTransform() and previous calls to Downsample(DownsampleStrategy).
CircleCropAsAmir_GlideRequestOptions
Applies CircleCrop to all default types and throws an exception if asked to transform an unknown type.
This will override previous calls to DontTransform().
CloneAsAmir_GlideRequestOptions
Returns a copy of this request builder with all of the options put so far on this builder.
This method returns a "deep" copy in that all non-immutable arguments are copied such that changes to one builder will not affect the other builder. However, in addition to immutable arguments, the current model is not copied copied so changes to the model will affect both builders.
Even if this object was locked, the cloned object returned from this method will not be locked.
DisallowHardwareConfigAsAmir_GlideRequestOptions
Disables the use of android.graphics.Bitmap.Config HARDWARE in Downsampler to avoid errors caused by inspecting Bitmap pixels, drawing with hardware support disabled, drawing to android.graphics.Canvass backed by Bitmaps etc.
It's almost never safe to set Downsampler ALLOW_HARDWARE_CONFIG to true so we only provide a way to disable hardware configs entirely. If no option is set for Downsampler ALLOW_HARDWARE_CONFIG, Glide will set the value per request based on whether or not a Transformation is applied and if one is, the type of Transformation applied. Built in transformations like FitCenter and DownsampleStrategy.CenterOutside can safely use android.graphics.Bitmap.Config HARDWARE because they can be entirely replaced by scaling within Downsampler. Transformations like CircleCrop that can't be replicated by Downsampler cannot use Bitmap.Config HARDWARE because android.graphics.Bitmap.Config HARDWARE cannot be drawn to android.graphics.Canvass, which is required by most Transformations.
For most applications RESOURCE is ideal. Applications that use the same resource multiple times in multiple sizes and are willing to trade off some speed and disk space in return for lower bandwidth usage may want to consider using DATA or ALL. ___________________________________________ Types : "ALL" "AUTOMATIC" "DATA" "NONE" "RESOURCE"
DontAnimateAsAmir_GlideRequestOptions
Disables resource decoders that return animated resources so any resource returned will be static.
DontTransformAsAmir_GlideRequestOptions
Removes all applied Transformation Transformations for all resource classes and allows unknown resource types to be transformed without throwing an exception.
Sets the DownsampleStrategy to use when decoding Bitmaps using Downsampler.
This is a component option specific to Downsampler. If the defautlt Bitmap decoder is replaced or skipped because of your configuration, this option may be ignored.
Sets an Drawable to display if the model provided to RequestBuilder Load(Object) is Null.
If a fallback is not set, null models will cause the error drawable to be displayed. If the error drawable is not set, the placeholder will be displayed.
FitCenterAsAmir_GlideRequestOptions
Applies FitCenter and to all default types, DownsampleStrategy FIT_CENTER to image types, and throws an exception if asked to transform an unknown type.
This will override previous calls to DontTransform() and previous calls to Downsample(DownsampleStrategy).
Format (TypeAsString) AsAmir_GlideRequestOptions
Sets the DecodeFormat to use when decoding Bitmap objects using Downsampler and Glide's default GIF decoders.
DecodeFormat is a request, not a requirement. It's possible the resource will be decoded using a decoder that cannot control the format (android.media.MediaMetadataRetriever for example), or that the decoder may choose to ignore the requested format if it can't display the image (i.e. RGB_565 is requested, but the image has alpha).
This is a component option specific to Downsampler and Glide's GIF decoders. If the default Bitmap decoders are replaced or skipped because of your configuration, this option may be ignored.
To set only the format used when decoding Bitmaps, use option and Downsampler DECODE_FORMAT. To set only the format used when decoding GIF frames, use option and GifOptions DECODE_FORMAT. _______________________________________________________ Types : "DEFAULT" "PREFER_ARGB_8888" "PREFER_ARGB_8888_DISALLOW_HARDWARE" "PREFER_RGB_565"
Sets the time position of the frame to extract from a video.
This is a component option specific to VideoDecoder. If the default video decoder is replaced or skipped because of your configuration, this option may be ignored.
frameTimeMicros : The time position in microseconds of the desired frame. If negative the Android framework implementation return a representative frame.
LockAsAmir_GlideRequestOptions
Throws if any further mutations are attempted.
Once locked, the only way to unlock is to use clone()
Applies the given Transformation for Bitmaps to the default types (Bitmap), android.graphics.drawable.BitmapDrawable, and GifDrawable and ignores unknown types.
This will override previous calls to DontTransform().
Support Multi Transformation :)
Override (sizeAsInt) AsAmir_GlideRequestOptions
Overrides the Target's width and height with the given size.
Overrides the Target's width and height with the given values. This is useful for thumbnails, and should only be used for other cases when you need a very specific image size.
Applies a multiplier to the Target's size before loading the resource. Useful for loading thumbnails or trying to avoid loading huge resources (particularly Bitmaps on devices with overly dense screens.
Allows the loaded resource to skip the memory cache.
Note : this is not a guarantee. If a request is already pending for this resource and that request is not also skipping the memory cache, the resource will be cached in memory.
Sets the android.content.res.Resources.Theme to apply when loading Drawables for resource ids provided via Error,Placeholder, and Fallback.
The theme is NOT applied in the decoder that will attempt to decode a given resource id model on Glide's background threads. The theme is used exclusively on the main thread to obtain placeholder/error/fallback drawables to avoid leaking Activities.
If the android.content.Context of the android.app.Fragment or android.app.Activity used to start this load has a different android.content.res.Resources.Theme, the android.content.res.Resources.Theme provided here will override the android.content.res.Resources.Theme of the android.content.Context.
theme : The theme to use when loading Drawables.
TimeOut (timeoutAsInt) AsAmir_GlideRequestOptions
Sets the read and write timeout for the http requests used to load the image.
If set to true, uses a special java.util.concurrent.Executor that is used exclusively for decoding frames of animated resources, like GIFs.
The animation executor disallows network operations and must not be used for loads that may load remote data. The animation executor has fewer threads available to it than Glide's normal executors and is only useful as a way of avoiding blocking on longer and more expensive reads for critical requests like those in an animating GIF.
If both useUnlimitedSourceGeneratorsPool(boolean) and this method are set, useUnlimitedSourceGeneratorsPool(boolean) will be preferred and this method will be ignored.
If set to true, uses a cached unlimited java.util.concurrent.Executor to run the request.
This method should ONLY be used when a Glide load is started recursively on one of Glide's threads as part of another request. Using this method in other scenarios can lead to excessive memory usage and OOMs and/or a significant decrease in performance across an application.
If both this method and useAnimationPool(boolean) are set, this method will be preferred and useAnimationPool(boolean) will be ignored.
Set a Mask drawable Example : DimXmlAsXmlLayoutBuilder DimRequestAsAmir_GlideRequestOptions DimTransAsAmir_GlideTransformation Request.BitmapTransition(Trans.Mask(Xml.GetResourceId("drawable","mask_image")))
Glide.Load("Link") _
.Apply(Request).Into(img)
Set a Mask drawable Example : DimdrawableAsBitmapDrawable drawable.Initialize(LoadBitmap(File.DirAssets,"images.png"))
DimRequestAsAmir_GlideRequestOptions DimTransAsAmir_GlideTransformation Request.BitmapTransition(Trans.MaskDrawable(drawable))
Glide.Load("Link") _
.Apply(Request).Into(img)