// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
// 
//     public ShopLoader(Context context) {
//         super(context);
//     }
// 
//     @Override
//     public List<Shop> loadInBackground() {
//         final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
//                 new String[] {
//                         Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
//                 }, null, null,
//                 null);
// 
//         List<Shop> shops = Lists.newArrayList();
// 
//         if (query != null) {
//             while (query.moveToNext()) {
//                 Shop shop = new Shop();
//                 shop.id(query.getInt(0));
//                 shop.name(query.getString(1));
//                 shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
//                 shops.add(shop);
//             }
// 
//             query.close();
//         }
// 
//         return shops;
//     }
// 
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
// 
//     private int id;
//     private String name;
//     private LatLng location;
// 
//     public int id() {
//         return id;
//     }
// 
//     public Shop id(int id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String name() {
//         return name;
//     }
// 
//     public Shop name(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     public LatLng location() {
//         return location;
//     }
// 
//     public Shop location(LatLng location) {
//         this.location = location;
//         return this;
//     }
// 
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
// 
//     public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
//     public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
//     public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
// 
//     public static int getMaxRecommendations(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context).getInt(
//                 KEY_MAX_RECOMMENDATIONS, 9);
//     }
// 
//     public static boolean isUsingFakeLocation(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
//                 false);
//     }
// 
//     public static boolean isUsingDiversity(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
//                 KEY_USING_DIVERSITY, true);
//     }
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
//     /**
//      * Holds a list of shop ids and how many recommendations are shown for
//      * each shop.
//      */
//     Map<Integer, Integer> shopMap;
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }


import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map;
    private List<Marker> mShopMarkers;
    private boolean mIsInitialized;
    private Map<Integer, Integer> mShopsWithItems;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mIsInitialized = false;

        // enable my location feature
        getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity()));

        getLoaderManager().initLoader(LAODER_ID, null, this);
    }

    @Override
    public void onStart() {
        super.onStart();
        EventBus.getDefault()
                .registerSticky(this, LocationUpdateEvent.class, ShopUpdateEvent.class);
    }

    @Override
    public void onStop() {
        EventBus.getDefault().unregister(this);
        super.onStop();
    }

    private void onInitializeMap() {
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
// 
//     public ShopLoader(Context context) {
//         super(context);
//     }
// 
//     @Override
//     public List<Shop> loadInBackground() {
//         final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
//                 new String[] {
//                         Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
//                 }, null, null,
//                 null);
// 
//         List<Shop> shops = Lists.newArrayList();
// 
//         if (query != null) {
//             while (query.moveToNext()) {
//                 Shop shop = new Shop();
//                 shop.id(query.getInt(0));
//                 shop.name(query.getString(1));
//                 shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
//                 shops.add(shop);
//             }
// 
//             query.close();
//         }
// 
//         return shops;
//     }
// 
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
// 
//     private int id;
//     private String name;
//     private LatLng location;
// 
//     public int id() {
//         return id;
//     }
// 
//     public Shop id(int id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String name() {
//         return name;
//     }
// 
//     public Shop name(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     public LatLng location() {
//         return location;
//     }
// 
//     public Shop location(LatLng location) {
//         this.location = location;
//         return this;
//     }
// 
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
// 
//     public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
//     public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
//     public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
// 
//     public static int getMaxRecommendations(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context).getInt(
//                 KEY_MAX_RECOMMENDATIONS, 9);
//     }
// 
//     public static boolean isUsingFakeLocation(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
//                 false);
//     }
// 
//     public static boolean isUsingDiversity(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
//                 KEY_USING_DIVERSITY, true);
//     }
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
//     /**
//      * Holds a list of shop ids and how many recommendations are shown for
//      * each shop.
//      */
//     Map<Integer, Integer> shopMap;
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }


// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map;

    private List<Marker> mShopMarkers;
    private boolean mIsInitialized;
    private Map<Integer, Integer> mShopsWithItems;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mIsInitialized = false;

        // enable my location feature
        getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity()));

        getLoaderManager().initLoader(LAODER_ID, null, this);
    }

    @Override
    public void onStart() {
        super.onStart();
        EventBus.getDefault()
                .registerSticky(this, LocationUpdateEvent.class, ShopUpdateEvent.class);
    }

    @Override
    public void onStop() {
        EventBus.getDefault().unregister(this);
        super.onStop();
    }

    private void onInitializeMap() {
        if (!mIsInitialized) {