com.bumptech.glide.loader.stream
Class LocalUriLoader

java.lang.Object
  extended by com.bumptech.glide.loader.stream.LocalUriLoader
All Implemented Interfaces:
StreamLoader

public class LocalUriLoader
extends java.lang.Object
implements StreamLoader


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bumptech.glide.loader.stream.StreamLoader
StreamLoader.StreamReadyCallback
 
Constructor Summary
LocalUriLoader(android.content.Context context, android.net.Uri uri)
          Opens an input stream for a uri pointing to a local asset.
 
Method Summary
 void cancel()
          A method that will be called by an ImagePresenter when a load is no longer relevant (because we now want to load a different image into the view).
 void loadStream(StreamLoader.StreamReadyCallback cb)
          Asynchronously fetch and open an InputStream representing an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalUriLoader

public LocalUriLoader(android.content.Context context,
                      android.net.Uri uri)
Opens an input stream for a uri pointing to a local asset. Only certain uris are supported

Parameters:
context - A context (this will be weakly referenced and the load will silently abort if the weak reference is cleared before StreamLoader.loadStream(StreamReadyCallback cb) is called
uri - A Uri pointing to a local asset. This load will fail if the uri isn't openable by ContentResolver.openInputStream(android.net.Uri)
See Also:
ContentResolver.openInputStream(android.net.Uri)
Method Detail

loadStream

public void loadStream(StreamLoader.StreamReadyCallback cb)
Description copied from interface: StreamLoader
Asynchronously fetch and open an InputStream representing an image. This will always be called on background thread so it is safe to perform long running tasks here. Any third party libraries called must be thread safe since this method will be called from a thread in a ExecutorService that may have more than one background thread. This method will only be called when the corresponding image is not in the cache.

Specified by:
loadStream in interface StreamLoader
Parameters:
cb - The callback to call when the load completes or fails due to an exception

cancel

public void cancel()
Description copied from interface: StreamLoader
A method that will be called by an ImagePresenter when a load is no longer relevant (because we now want to load a different image into the view). This method does not need to guarantee that any in process loads do not finish. It also may be called before a load starts or after it finishes. The best way to use this method is to cancel any loads that have not yet started, but allow those that are in process to finish since its we typically will want to display the same image in a different view in the near future.

Specified by:
cancel in interface StreamLoader