// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/AccessPolicy.java
// @Beta
// public enum AccessPolicy {
// 
//     /**
//      * Normal content fetching: passes through all levels of cache, if there is a cache miss,
//      * download the content from the server.
//      */
//     NORMAL,
// 
//     /**
//      * Attempt a cache only content fetching.<br> If there is a total cache miss, do nothing.
//      */
//     CACHE_ONLY,
// 
//     /**
//      * Pre-fetch data that could be needed soon.<br> If the data is not available in cache, schedule
//      * a content download.
//      */
//     PRE_FETCH,
// 
//     /**
//      * Refresh the cache data, and return the updated content if any.
//      */
//     REFRESH;
// 
// }
// 
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/ContentCache.java
// @Beta
// public enum CacheSource {
//     MEMORY,
//     DISK,
//     NETWORK;
// }
// 
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/keys/CacheUrlKey.java
// @Beta
// @SuppressLint("ParcelCreator")
// public interface CacheUrlKey extends CacheKey, Parcelable {
// 
//     /**
//      * Gets the hash string used as a key
//      */
//     @NonNull
//     public String hash();
// 
//     /**
//      * Gets the string URL hold by this {@link CacheUrlKey}
//      */
//     @NonNull
//     public String getUrl();
// 
// }
// 
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/proxies/ContentProxy.java
// @Beta
// public interface ContentProxy {
// 
//     /**
//      * Completely clears the memory cache of this content manager.
//      */
//     public void clearMemoryCache();
// 
//     /**
//      * Synchronously clears permanent storage (DB or flash disk) cache items of this content proxy
//      * according to the passed {@link SimpleDiskCache.ClearMode}
//      */
//     public void clearDiskCache(SimpleDiskCache.ClearMode mode);
// 
//     /**
//      * Completely wipes any permanent storage (DB or flash disk) cache for this content proxy.
//      *
//      * Note: implementations must be asynchronous and non-blocking.
//      */
//     public void scheduleClearDiskCache();
// 
//     /**
//      * Synchronously wipe any kind of cache for this content proxy.
//      */
//     public void clearCache();
// 
// }


import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import com.github.marcosalis.kraken.cache.AccessPolicy;
import com.github.marcosalis.kraken.cache.ContentCache.CacheSource;
import com.github.marcosalis.kraken.cache.keys.CacheUrlKey;
import com.github.marcosalis.kraken.cache.proxies.ContentProxy;
import com.google.common.annotations.Beta;
/*
 * Copyright 2013 Marco Salis - fast3r(at)gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.marcosalis.kraken.cache.bitmap;



/**
 * Public interface to access a {@link Bitmap}s cache.
 *
 * All the methods implementations are asynchronous and must be executed from the UI thread.
 *
 * @author Marco Salis
 * @since 1.0
 */
@Beta
public interface BitmapCache extends ContentProxy {

    /**
     * Callback interface to retrieve the result of a Bitmap loading from a {@link BitmapCache}.
     *
     * The callback methods can be executed in an internal pool thread, not in the caller thread.
     * Make sure you are handling this when dealing with UI and non-thread safe code.
     */
    @Beta
    public interface OnBitmapRetrievalListener {

        /**
         * Called when a Bitmap has been retrieved from the cache.
         *
         * @param key    The {@link CacheUrlKey} of the bitmap
         * @param bitmap The retrieved Bitmap
         * @param source The {@link CacheSource} from where the bitmap has been retrieved
         */
        public void onBitmapRetrieved(@NonNull CacheUrlKey key, @NonNull Bitmap bitmap,
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/AccessPolicy.java
// @Beta
// public enum AccessPolicy {
// 
//     /**
//      * Normal content fetching: passes through all levels of cache, if there is a cache miss,
//      * download the content from the server.
//      */
//     NORMAL,
// 
//     /**
//      * Attempt a cache only content fetching.<br> If there is a total cache miss, do nothing.
//      */
//     CACHE_ONLY,
// 
//     /**
//      * Pre-fetch data that could be needed soon.<br> If the data is not available in cache, schedule
//      * a content download.
//      */
//     PRE_FETCH,
// 
//     /**
//      * Refresh the cache data, and return the updated content if any.
//      */
//     REFRESH;
// 
// }
// 
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/ContentCache.java
// @Beta
// public enum CacheSource {
//     MEMORY,
//     DISK,
//     NETWORK;
// }
// 
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/keys/CacheUrlKey.java
// @Beta
// @SuppressLint("ParcelCreator")
// public interface CacheUrlKey extends CacheKey, Parcelable {
// 
//     /**
//      * Gets the hash string used as a key
//      */
//     @NonNull
//     public String hash();
// 
//     /**
//      * Gets the string URL hold by this {@link CacheUrlKey}
//      */
//     @NonNull
//     public String getUrl();
// 
// }
// 
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/proxies/ContentProxy.java
// @Beta
// public interface ContentProxy {
// 
//     /**
//      * Completely clears the memory cache of this content manager.
//      */
//     public void clearMemoryCache();
// 
//     /**
//      * Synchronously clears permanent storage (DB or flash disk) cache items of this content proxy
//      * according to the passed {@link SimpleDiskCache.ClearMode}
//      */
//     public void clearDiskCache(SimpleDiskCache.ClearMode mode);
// 
//     /**
//      * Completely wipes any permanent storage (DB or flash disk) cache for this content proxy.
//      *
//      * Note: implementations must be asynchronous and non-blocking.
//      */
//     public void scheduleClearDiskCache();
// 
//     /**
//      * Synchronously wipe any kind of cache for this content proxy.
//      */
//     public void clearCache();
// 
// }


// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/bitmap/BitmapCache.java
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import com.github.marcosalis.kraken.cache.AccessPolicy;
import com.github.marcosalis.kraken.cache.ContentCache.CacheSource;
import com.github.marcosalis.kraken.cache.keys.CacheUrlKey;
import com.github.marcosalis.kraken.cache.proxies.ContentProxy;
import com.google.common.annotations.Beta;

/*
 * Copyright 2013 Marco Salis - fast3r(at)gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.marcosalis.kraken.cache.bitmap;



/**
 * Public interface to access a {@link Bitmap}s cache.
 *
 * All the methods implementations are asynchronous and must be executed from the UI thread.
 *
 * @author Marco Salis
 * @since 1.0
 */
@Beta
public interface BitmapCache extends ContentProxy {

    /**
     * Callback interface to retrieve the result of a Bitmap loading from a {@link BitmapCache}.
     *
     * The callback methods can be executed in an internal pool thread, not in the caller thread.
     * Make sure you are handling this when dealing with UI and non-thread safe code.
     */
    @Beta
    public interface OnBitmapRetrievalListener {

        /**
         * Called when a Bitmap has been retrieved from the cache.
         *
         * @param key    The {@link CacheUrlKey} of the bitmap
         * @param bitmap The retrieved Bitmap
         * @param source The {@link CacheSource} from where the bitmap has been retrieved
         */
        public void onBitmapRetrieved(@NonNull CacheUrlKey key, @NonNull Bitmap bitmap,
                                      @NonNull CacheSource source);