// Path: app/src/main/java/com/choices/imagecompare/Drawables.java
// public class Drawables {
//     public static Drawable sPlaceholderDrawable;
//     public static Drawable sErrorDrawable;
//     private Drawables() {
//     }
// 
//     public static void init(final Resources resources) {
//         if (sPlaceholderDrawable == null) {
//             sPlaceholderDrawable = resources.getDrawable(R.color.placeholder);
//         }
//         if (sErrorDrawable == null) {
//             sErrorDrawable = resources.getDrawable(R.color.error);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/choices/imagecompare/configs/ConfigConstants.java
// public class ConfigConstants {
//     public static final int MAX_DISK_CACHE_SIZE = 40 * ByteConstants.MB;
//     private static final int MAX_HEAP_SIZE = (int) Runtime.getRuntime().maxMemory();
//     public static final int MAX_MEMORY_CACHE_SIZE = MAX_HEAP_SIZE / 4;
// }


import android.content.Context;
import com.choices.imagecompare.Drawables;
import com.choices.imagecompare.configs.ConfigConstants;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
/*
 * This file provided by Facebook is for non-commercial testing and evaluation
 * purposes only.  Facebook reserves all rights not expressly granted.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.choices.imagecompare.configs.uil;



/**
 * Provides instance of ImageLoader with appropriately configured caches and placeholder/failure
 * drawables.
 */
public class SampleUilFactory {
    private static ImageLoader sImageLoader;

    public static ImageLoader getImageLoader(Context context) {
        if (sImageLoader == null) {
            DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
                    .showImageOnLoading(Drawables.sPlaceholderDrawable)
                    .showImageOnFail(Drawables.sErrorDrawable)
                    .cacheInMemory(true)
                    .cacheOnDisk(true)
                    .build();
            ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                    .defaultDisplayImageOptions(displayImageOptions)
// Path: app/src/main/java/com/choices/imagecompare/Drawables.java
// public class Drawables {
//     public static Drawable sPlaceholderDrawable;
//     public static Drawable sErrorDrawable;
//     private Drawables() {
//     }
// 
//     public static void init(final Resources resources) {
//         if (sPlaceholderDrawable == null) {
//             sPlaceholderDrawable = resources.getDrawable(R.color.placeholder);
//         }
//         if (sErrorDrawable == null) {
//             sErrorDrawable = resources.getDrawable(R.color.error);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/choices/imagecompare/configs/ConfigConstants.java
// public class ConfigConstants {
//     public static final int MAX_DISK_CACHE_SIZE = 40 * ByteConstants.MB;
//     private static final int MAX_HEAP_SIZE = (int) Runtime.getRuntime().maxMemory();
//     public static final int MAX_MEMORY_CACHE_SIZE = MAX_HEAP_SIZE / 4;
// }


// Path: app/src/main/java/com/choices/imagecompare/configs/uil/SampleUilFactory.java
import android.content.Context;
import com.choices.imagecompare.Drawables;
import com.choices.imagecompare.configs.ConfigConstants;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

/*
 * This file provided by Facebook is for non-commercial testing and evaluation
 * purposes only.  Facebook reserves all rights not expressly granted.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.choices.imagecompare.configs.uil;



/**
 * Provides instance of ImageLoader with appropriately configured caches and placeholder/failure
 * drawables.
 */
public class SampleUilFactory {
    private static ImageLoader sImageLoader;

    public static ImageLoader getImageLoader(Context context) {
        if (sImageLoader == null) {
            DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
                    .showImageOnLoading(Drawables.sPlaceholderDrawable)
                    .showImageOnFail(Drawables.sErrorDrawable)
                    .cacheInMemory(true)
                    .cacheOnDisk(true)
                    .build();
            ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                    .defaultDisplayImageOptions(displayImageOptions)
                    .diskCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)