// Path: webimageloader/src/main/java/com/webimageloader/loader/LoaderRequest.java
// 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;
//         }
//     }
// }
// 
// Path: webimageloader/src/main/java/com/webimageloader/transformation/Transformation.java
// public interface Transformation {
//     /**
//      * Get the identified for this transformation. It should be unique and include any
//      * Parameters passed to this transformation.
//      *
//      * @return the identifier
//      */
//     String getIdentifier();
// 
//     /**
//      * Get the format used when saving the result of this transformation. This
//      * can be useful for example when relying on alpha.
//      *
//      * @return the bitmap compress format, null for default
//      */
//     Bitmap.CompressFormat getCompressFormat();
// 
//     /**
//      * Transform this {@link InputSupplier} to a {@link Bitmap}.
//      *
//      * @param input original {@link InputSupplier}
//      * @return transformed {@link Bitmap}
//      * @throws IOException if the conversion failed
//      */
//     Bitmap transform(InputSupplier input) throws IOException;
// 
//     /**
//      * Transform this {@link Bitmap} to a new {@link Bitmap}.
//      *
//      * @param b original {@link Bitmap}
//      * @return transformed {@link Bitmap}
//      */
//     Bitmap transform(Bitmap b);
// }


import java.io.File;
import java.util.EnumSet;
import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
import com.webimageloader.loader.LoaderRequest;
import com.webimageloader.transformation.Transformation;
package com.webimageloader;




/**
 * Class describing a specific request including transformations to be applied.
 *
 * @author Alexander Blom <alexanderblom.se>
 */
public class Request {
    public enum Flag {
        /**
         * Flag which makes the request ignore any possibly cached bitmaps
         */
        IGNORE_CACHE,
        /**
         * Flag which makes the request don't save its result to cache
         */
        NO_CACHE,
        /**
         * Flag for skipping the disk cache, both for retrieval and storing,
         * useful for images already fetched from disk.
         */
        SKIP_DISK_CACHE
    }

    private String url;
    private Transformation transformation;
    private EnumSet<Flag> flags = EnumSet.noneOf(Flag.class);

    /**
     * Create a request for a resource in /res.
     *
     * Note that this sets the SKIP_DISK_CACHE to skip disk cache
     *
     * @param c the context to use
     * @param resId the resource if
     * @return a request for this resource
     */
    public static Request forResource(Context c, int resId) {
        String url = createUrl(ContentResolver.SCHEME_ANDROID_RESOURCE, c.getPackageName(), String.valueOf(resId));
        return new Request(url).addFlag(Flag.SKIP_DISK_CACHE);
    }

    /**
     * Create a request for an asset in /assets.
     *
     * Note that this sets the SKIP_DISK_CACHE to skip disk cache
     *
     * @param path the path of this asset
     * @return a request for this asset
     */
    public static Request forAsset(String path) {
        String url = createUrl(ContentResolver.SCHEME_FILE, "/android_asset/", path);
        return new Request(url).addFlag(Flag.SKIP_DISK_CACHE);
    }

    /**
     * Create a request for this file on the local file system.
     *
     * Note that this sets the SKIP_DISK_CACHE to skip disk cache
     *
     * @param file path to the file
     * @return a request for this file
     */
    public static Request forFile(File file) {
        String url = Uri.fromFile(file).toString();
// Path: webimageloader/src/main/java/com/webimageloader/loader/LoaderRequest.java
// 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;
//         }
//     }
// }
// 
// Path: webimageloader/src/main/java/com/webimageloader/transformation/Transformation.java
// public interface Transformation {
//     /**
//      * Get the identified for this transformation. It should be unique and include any
//      * Parameters passed to this transformation.
//      *
//      * @return the identifier
//      */
//     String getIdentifier();
// 
//     /**
//      * Get the format used when saving the result of this transformation. This
//      * can be useful for example when relying on alpha.
//      *
//      * @return the bitmap compress format, null for default
//      */
//     Bitmap.CompressFormat getCompressFormat();
// 
//     /**
//      * Transform this {@link InputSupplier} to a {@link Bitmap}.
//      *
//      * @param input original {@link InputSupplier}
//      * @return transformed {@link Bitmap}
//      * @throws IOException if the conversion failed
//      */
//     Bitmap transform(InputSupplier input) throws IOException;
// 
//     /**
//      * Transform this {@link Bitmap} to a new {@link Bitmap}.
//      *
//      * @param b original {@link Bitmap}
//      * @return transformed {@link Bitmap}
//      */
//     Bitmap transform(Bitmap b);
// }


// Path: webimageloader/src/main/java/com/webimageloader/Request.java
import java.io.File;
import java.util.EnumSet;
import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
import com.webimageloader.loader.LoaderRequest;
import com.webimageloader.transformation.Transformation;

package com.webimageloader;




/**
 * Class describing a specific request including transformations to be applied.
 *
 * @author Alexander Blom <alexanderblom.se>
 */
public class Request {
    public enum Flag {
        /**
         * Flag which makes the request ignore any possibly cached bitmaps
         */
        IGNORE_CACHE,
        /**
         * Flag which makes the request don't save its result to cache
         */
        NO_CACHE,
        /**
         * Flag for skipping the disk cache, both for retrieval and storing,
         * useful for images already fetched from disk.
         */
        SKIP_DISK_CACHE
    }

    private String url;
    private Transformation transformation;
    private EnumSet<Flag> flags = EnumSet.noneOf(Flag.class);

    /**
     * Create a request for a resource in /res.
     *
     * Note that this sets the SKIP_DISK_CACHE to skip disk cache
     *
     * @param c the context to use
     * @param resId the resource if
     * @return a request for this resource
     */
    public static Request forResource(Context c, int resId) {
        String url = createUrl(ContentResolver.SCHEME_ANDROID_RESOURCE, c.getPackageName(), String.valueOf(resId));
        return new Request(url).addFlag(Flag.SKIP_DISK_CACHE);
    }

    /**
     * Create a request for an asset in /assets.
     *
     * Note that this sets the SKIP_DISK_CACHE to skip disk cache
     *
     * @param path the path of this asset
     * @return a request for this asset
     */
    public static Request forAsset(String path) {
        String url = createUrl(ContentResolver.SCHEME_FILE, "/android_asset/", path);
        return new Request(url).addFlag(Flag.SKIP_DISK_CACHE);
    }

    /**
     * Create a request for this file on the local file system.
     *
     * Note that this sets the SKIP_DISK_CACHE to skip disk cache
     *
     * @param file path to the file
     * @return a request for this file
     */
    public static Request forFile(File file) {
        String url = Uri.fromFile(file).toString();
        return new Request(url).addFlag(Flag.SKIP_DISK_CACHE);