// Path: app/src/main/java/com/sjcqs/rawlauncher/items/apps/AppManager.java
// public class AppManager extends Manager {
//     private static final String TAG = AppManager.class.getName();
// 
//     public AppManager(Context context, LoaderManager loaderManager) {
//         super(context, loaderManager);
//         loaderManager.initLoader(ManagerUtils.ID_APP_LOADER, null, this);
//     }
// 
//     @Override
//     public Loader<List<Item>> onCreateLoader(int id, Bundle args) {
//         return new AppsLoader(context);
//     }
// 
//     @Override
//     public void reload() {
//         loaderManager.restartLoader(ManagerUtils.ID_APP_LOADER, null, this);
//     }
// }
// 
// Path: app/src/main/java/com/sjcqs/rawlauncher/items/device_settings/DeviceSettingManager.java
// public class DeviceSettingManager extends Manager{
// 
//     public static final double PENALTY = 0.3;
// 
//     public DeviceSettingManager(Context context, LoaderManager loaderManager) {
//         super(context, loaderManager);
//         loaderManager.initLoader(ManagerUtils.ID_DEVICE_SETTINGS_LOADER, null, this);
//     }
// 
//     @Override
//     public Loader<List<Item>> onCreateLoader(int id, Bundle args) {
//         return new DeviceSettingLoader(context);
//     }
// 
//     @Override
//     public Collection<Suggestion> getSuggestions(String input) {
//         List<Suggestion> suggestions = new ArrayList<>();
//         for (Item app : items) {
//             String str2 = app.getLabel();
//             double rate = StringUtil.canBeSuggested(input, str2);
//             if (rate < StringUtil.MAX_RATE) {
//                 suggestions.add(new Suggestion(app, rate + PENALTY));
//             }
//         }
// 
//         return suggestions;
//     }
// }
// 
// Path: app/src/main/java/com/sjcqs/rawlauncher/utils/interfaces/Manager.java
// public abstract class Manager implements LoaderManager.LoaderCallbacks<List<Item>>{
//     private static final String TAG = Manager.class.getName();
// 
//     protected final Context context;
//     protected final LoaderManager loaderManager;
//     protected List<Item> items;
// 
//     protected Manager(Context context, LoaderManager loaderManager) {
//         this.context = context;
//         this.loaderManager = loaderManager;
//     }
// 
//     @Override
//     public void onLoadFinished(Loader<List<Item>> loader, List<Item> data) {
//         items = data;
//     }
// 
//     @Override
//     public void onLoaderReset(Loader<List<Item>> loader) {
//         items = null;
//     }
// 
//     public boolean isLoaded(){
//         return items != null;
//     }
// 
//     public Intent getIntent(String str) {
//         str = StringUtil.normalize(str);
//         for (Item item : items) {
//             if (str.equalsIgnoreCase(item.getLabel())){
//                 return item.getIntent();
//             }
//         }
//         return null;
//     }
// 
// 
//     public Collection<Suggestion> getSuggestions(String input){
//         List<Suggestion> suggestions = new ArrayList<>();
//         if (items != null) {
//             for (Item app : items) {
//                 String str2 = app.getLabel();
//                 double rate = StringUtil.canBeSuggested(input, str2);
// 
//                 if (rate < StringUtil.MAX_RATE) {
//                     suggestions.add(new Suggestion(app, rate));
//                 }
//             }
//         }
//         return suggestions;
//     }
// 
//     public void reload() {
// 
//     }
// 
//     public List<Item> getItems() {
//         return items;
//     }
// 
//     public List<Item> getItems(int fromIndex, int toIndex) {
//         return items.subList(fromIndex, toIndex);
//     }
// 
//     public Item getItem(int index) {
//         return items.get(index);
//     }
// }


import android.content.Context;
import android.support.v4.app.LoaderManager;
import android.support.v4.util.ArrayMap;
import com.sjcqs.rawlauncher.items.apps.AppManager;
import com.sjcqs.rawlauncher.items.device_settings.DeviceSettingManager;
import com.sjcqs.rawlauncher.utils.interfaces.Manager;
import java.util.Map;
package com.sjcqs.rawlauncher.utils;




/**
 * Created by satyan on 8/27/17.
 */

public final class ManagerUtils {
    public final static int ID_SUGGESTION_LOADER = 0;
    public final static int ID_APP_LOADER = 1;
    public final static int ID_DEVICE_SETTINGS_LOADER = 2;
    public final static int ID_SEARCH_LOADER = 3;
    public static final int ID_SHORTCUTS_LOADER = 4;

    public final static int MANAGER_APPS = 0;
    public final static int MANAGER_DEVICE_SETTINGS = 1;

    public static Map<Integer, Manager> loadManagers(Context context, LoaderManager loaderManager) {
        Map<Integer, Manager> managers = new ArrayMap<>();
        //APPS
        AppManager appManager = new AppManager(context,loaderManager);
        managers.put(MANAGER_APPS, appManager);
        //DEVICE SETTINGS
// Path: app/src/main/java/com/sjcqs/rawlauncher/items/apps/AppManager.java
// public class AppManager extends Manager {
//     private static final String TAG = AppManager.class.getName();
// 
//     public AppManager(Context context, LoaderManager loaderManager) {
//         super(context, loaderManager);
//         loaderManager.initLoader(ManagerUtils.ID_APP_LOADER, null, this);
//     }
// 
//     @Override
//     public Loader<List<Item>> onCreateLoader(int id, Bundle args) {
//         return new AppsLoader(context);
//     }
// 
//     @Override
//     public void reload() {
//         loaderManager.restartLoader(ManagerUtils.ID_APP_LOADER, null, this);
//     }
// }
// 
// Path: app/src/main/java/com/sjcqs/rawlauncher/items/device_settings/DeviceSettingManager.java
// public class DeviceSettingManager extends Manager{
// 
//     public static final double PENALTY = 0.3;
// 
//     public DeviceSettingManager(Context context, LoaderManager loaderManager) {
//         super(context, loaderManager);
//         loaderManager.initLoader(ManagerUtils.ID_DEVICE_SETTINGS_LOADER, null, this);
//     }
// 
//     @Override
//     public Loader<List<Item>> onCreateLoader(int id, Bundle args) {
//         return new DeviceSettingLoader(context);
//     }
// 
//     @Override
//     public Collection<Suggestion> getSuggestions(String input) {
//         List<Suggestion> suggestions = new ArrayList<>();
//         for (Item app : items) {
//             String str2 = app.getLabel();
//             double rate = StringUtil.canBeSuggested(input, str2);
//             if (rate < StringUtil.MAX_RATE) {
//                 suggestions.add(new Suggestion(app, rate + PENALTY));
//             }
//         }
// 
//         return suggestions;
//     }
// }
// 
// Path: app/src/main/java/com/sjcqs/rawlauncher/utils/interfaces/Manager.java
// public abstract class Manager implements LoaderManager.LoaderCallbacks<List<Item>>{
//     private static final String TAG = Manager.class.getName();
// 
//     protected final Context context;
//     protected final LoaderManager loaderManager;
//     protected List<Item> items;
// 
//     protected Manager(Context context, LoaderManager loaderManager) {
//         this.context = context;
//         this.loaderManager = loaderManager;
//     }
// 
//     @Override
//     public void onLoadFinished(Loader<List<Item>> loader, List<Item> data) {
//         items = data;
//     }
// 
//     @Override
//     public void onLoaderReset(Loader<List<Item>> loader) {
//         items = null;
//     }
// 
//     public boolean isLoaded(){
//         return items != null;
//     }
// 
//     public Intent getIntent(String str) {
//         str = StringUtil.normalize(str);
//         for (Item item : items) {
//             if (str.equalsIgnoreCase(item.getLabel())){
//                 return item.getIntent();
//             }
//         }
//         return null;
//     }
// 
// 
//     public Collection<Suggestion> getSuggestions(String input){
//         List<Suggestion> suggestions = new ArrayList<>();
//         if (items != null) {
//             for (Item app : items) {
//                 String str2 = app.getLabel();
//                 double rate = StringUtil.canBeSuggested(input, str2);
// 
//                 if (rate < StringUtil.MAX_RATE) {
//                     suggestions.add(new Suggestion(app, rate));
//                 }
//             }
//         }
//         return suggestions;
//     }
// 
//     public void reload() {
// 
//     }
// 
//     public List<Item> getItems() {
//         return items;
//     }
// 
//     public List<Item> getItems(int fromIndex, int toIndex) {
//         return items.subList(fromIndex, toIndex);
//     }
// 
//     public Item getItem(int index) {
//         return items.get(index);
//     }
// }


// Path: app/src/main/java/com/sjcqs/rawlauncher/utils/ManagerUtils.java
import android.content.Context;
import android.support.v4.app.LoaderManager;
import android.support.v4.util.ArrayMap;
import com.sjcqs.rawlauncher.items.apps.AppManager;
import com.sjcqs.rawlauncher.items.device_settings.DeviceSettingManager;
import com.sjcqs.rawlauncher.utils.interfaces.Manager;
import java.util.Map;

package com.sjcqs.rawlauncher.utils;




/**
 * Created by satyan on 8/27/17.
 */

public final class ManagerUtils {
    public final static int ID_SUGGESTION_LOADER = 0;
    public final static int ID_APP_LOADER = 1;
    public final static int ID_DEVICE_SETTINGS_LOADER = 2;
    public final static int ID_SEARCH_LOADER = 3;
    public static final int ID_SHORTCUTS_LOADER = 4;

    public final static int MANAGER_APPS = 0;
    public final static int MANAGER_DEVICE_SETTINGS = 1;

    public static Map<Integer, Manager> loadManagers(Context context, LoaderManager loaderManager) {
        Map<Integer, Manager> managers = new ArrayMap<>();
        //APPS
        AppManager appManager = new AppManager(context,loaderManager);
        managers.put(MANAGER_APPS, appManager);
        //DEVICE SETTINGS
        DeviceSettingManager deviceSettingManager = new DeviceSettingManager(context,loaderManager);