Android Open Source - webimageloader Loader Request






From Project

Back to project page webimageloader.

License

The source code is released under:

Apache License

If you think the Android project webimageloader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.webimageloader.loader;
/*from   www .  j  a  va  2 s.  c o  m*/
import com.webimageloader.Request;
import com.webimageloader.transformation.Transformation;

import java.util.EnumSet;

public class LoaderRequest {
    private String url;
    private Transformation transformation;
    private Metadata metadata;
    private EnumSet<Request.Flag> flags;

    private String cacheKey;

    public LoaderRequest(String url, Transformation transformation, EnumSet<Request.Flag> flags) {
        if (url == null) {
            throw new IllegalArgumentException("url may not be null");
        }

        this.url = url;
        this.transformation = transformation;
        this.flags = flags;

        if (transformation != null) {
            cacheKey = url + transformation.getIdentifier();
        } else {
            cacheKey = url;
        }
    }

    public LoaderRequest withoutTransformation() {
        return new LoaderRequest(url, null, flags);
    }

    public LoaderRequest withMetadata(Metadata metadata) {
        LoaderRequest r = new LoaderRequest(url, transformation, flags);
        r.metadata = metadata;

        return r;
    }

    public String getUrl() {
        return url;
    }

    public Transformation getTransformation() {
        return transformation;
    }

    public Metadata getMetadata() {
        return metadata;
    }

    public String getCacheKey() {
        return cacheKey;
    }

    public boolean hasFlag(Request.Flag flag) {
        return flags.contains(flag);
    }

    @Override
    public int hashCode() {
        return cacheKey.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (obj instanceof LoaderRequest) {
            LoaderRequest request = (LoaderRequest) obj;
            return cacheKey.equals(request.getCacheKey());
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        String f = flags.isEmpty() ? "" : ", flags=" + flags;

        if (transformation != null) {
            return url + f + " with transformation " + '"' + transformation.getIdentifier() + '"';
        } else {
            return url + f;
        }
    }
}




Java Source Code List

com.webimageloader.ConnectionFactory.java
com.webimageloader.ConnectionHandler.java
com.webimageloader.Constants.java
com.webimageloader.ImageLoaderImpl.java
com.webimageloader.ImageLoader.java
com.webimageloader.Request.java
com.webimageloader.content.ContentURLConnection.java
com.webimageloader.content.ContentURLStreamHandler.java
com.webimageloader.ext.ImageHelper.java
com.webimageloader.ext.ImageLoaderApplication.java
com.webimageloader.loader.BackgroundLoader.java
com.webimageloader.loader.DiskLoader.java
com.webimageloader.loader.LoaderManager.java
com.webimageloader.loader.LoaderRequest.java
com.webimageloader.loader.LoaderWork.java
com.webimageloader.loader.Loader.java
com.webimageloader.loader.MemoryCache.java
com.webimageloader.loader.MemoryLoader.java
com.webimageloader.loader.Metadata.java
com.webimageloader.loader.NetworkLoader.java
com.webimageloader.loader.PendingRequests.java
com.webimageloader.loader.SimpleBackgroundLoader.java
com.webimageloader.loader.TransformingLoader.java
com.webimageloader.sample.AsyncLoader.java
com.webimageloader.sample.ExampleApplication.java
com.webimageloader.sample.FastImageView.java
com.webimageloader.sample.MainActivity.java
com.webimageloader.sample.numbers.NumberDetailsActivity.java
com.webimageloader.sample.numbers.NumbersActivity.java
com.webimageloader.sample.patterns.PatternDetailsActivity.java
com.webimageloader.sample.patterns.PatternsActivity.java
com.webimageloader.sample.patterns.PatternsListFragment.java
com.webimageloader.sample.progress.ProgressActivity.java
com.webimageloader.transformation.ScaleTransformation.java
com.webimageloader.transformation.SimpleTransformation.java
com.webimageloader.transformation.Transformation.java
com.webimageloader.util.AbstractImageLoader.java
com.webimageloader.util.Android.java
com.webimageloader.util.BitmapUtils.java
com.webimageloader.util.FlushedInputStream.java
com.webimageloader.util.Hasher.java
com.webimageloader.util.HeaderParser.java
com.webimageloader.util.IOUtil.java
com.webimageloader.util.InputSupplier.java
com.webimageloader.util.ListenerFuture.java
com.webimageloader.util.LruCache.java
com.webimageloader.util.PriorityThreadFactory.java
com.webimageloader.util.WaitFuture.java