// Path: application/src/main/java/com/projectsexception/myapplist/model/AppInfo.java
// public class AppInfo implements Comparable<AppInfo>, Parcelable {
//     
//     private final Collator sCollator = Collator.getInstance();
//     
//     private String packageName;
//     private String name;
//     private boolean installed;
// 
//     public String getPackageName() {
//         return packageName;
//     }
// 
//     public void setPackageName(String packageName) {
//         this.packageName = packageName;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public boolean isInstalled() {
//         return installed;
//     }
// 
//     public void setInstalled(boolean installed) {
//         this.installed = installed;
//     }
// 
//     @Override
//     public int compareTo(AppInfo another) {
//         if (!installed && another.installed) {
//             return -1;
//         } else  if (installed && !another.installed) {
//             return 1;
//         }
//         return sCollator.compare(getName(), another.getName());
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(name);
//         dest.writeString(packageName);
//         dest.writeString(Boolean.toString(installed));
//     }
//     
//     public static final Parcelable.Creator<AppInfo> CREATOR = new Parcelable.Creator<AppInfo>() {
// 
//         @Override
//         public AppInfo createFromParcel(Parcel source) {
//             AppInfo appInfo = new AppInfo();
//             appInfo.setName(source.readString());
//             appInfo.setPackageName(source.readString());
//             appInfo.setInstalled(Boolean.parseBoolean(source.readString()));
//             return appInfo;
//         }
// 
//         @Override
//         public AppInfo[] newArray(int size) {
//             return new AppInfo[size];
//         }
//         
//         
//     };
//     
// 
// }
// 
// Path: application/src/main/java/com/projectsexception/myapplist/work/AppListLoader.java
// public class AppListLoader extends AbstractListLoader {
//     
//     private final PackageManager mPm;
//     private final boolean mHideSystemApps;
// 
//     public AppListLoader(Context context) {
//         super(context);
//         
//         // Retrieve the package manager for later use; note we don't
//         // use 'context' directly but instead the save global application
//         // context returned by getContext().
//         mPm = getContext().getPackageManager();
//         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//         mHideSystemApps = prefs.getBoolean(MyAppListPreferenceActivity.KEY_HIDE_SYSTEM_APPS, true);
//     }
// 
//     @Override
//     public ArrayList<AppInfo> loadAppInfoList() {
//         return AppUtil.loadAppInfoList(mPm, mHideSystemApps);
//     }
// 
//     @Override
//     public boolean isPackageIntentReceiver() {
//         return true;
//     }
// }


import android.app.Activity;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
import com.projectsexception.myapplist.R;
import com.projectsexception.myapplist.model.AppInfo;
import com.projectsexception.myapplist.work.AppListLoader;
import java.util.ArrayList;
import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
    @Override
    public void onDetach() {
        mCallBack = null;
        super.onDetach();
    }

    @Override
    int getMenuAdapter() {
        return R.menu.adapter_app;
    }

    @Override
    int getMenuResource() {
        return R.menu.fragment_app;
    }

    @Override
    Loader<ArrayList<AppInfo>> createLoader(int id, Bundle args) {
        return new AppListLoader(getActivity());
    }

    @Override
    void showAppInfo(String name, String packageName) {
        if (mCallBack != null) {
            mCallBack.showAppInfo(name, packageName);
        }
    }

    @Override
    int getTitle() {
// Path: application/src/main/java/com/projectsexception/myapplist/model/AppInfo.java
// public class AppInfo implements Comparable<AppInfo>, Parcelable {
//     
//     private final Collator sCollator = Collator.getInstance();
//     
//     private String packageName;
//     private String name;
//     private boolean installed;
// 
//     public String getPackageName() {
//         return packageName;
//     }
// 
//     public void setPackageName(String packageName) {
//         this.packageName = packageName;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public boolean isInstalled() {
//         return installed;
//     }
// 
//     public void setInstalled(boolean installed) {
//         this.installed = installed;
//     }
// 
//     @Override
//     public int compareTo(AppInfo another) {
//         if (!installed && another.installed) {
//             return -1;
//         } else  if (installed && !another.installed) {
//             return 1;
//         }
//         return sCollator.compare(getName(), another.getName());
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(name);
//         dest.writeString(packageName);
//         dest.writeString(Boolean.toString(installed));
//     }
//     
//     public static final Parcelable.Creator<AppInfo> CREATOR = new Parcelable.Creator<AppInfo>() {
// 
//         @Override
//         public AppInfo createFromParcel(Parcel source) {
//             AppInfo appInfo = new AppInfo();
//             appInfo.setName(source.readString());
//             appInfo.setPackageName(source.readString());
//             appInfo.setInstalled(Boolean.parseBoolean(source.readString()));
//             return appInfo;
//         }
// 
//         @Override
//         public AppInfo[] newArray(int size) {
//             return new AppInfo[size];
//         }
//         
//         
//     };
//     
// 
// }
// 
// Path: application/src/main/java/com/projectsexception/myapplist/work/AppListLoader.java
// public class AppListLoader extends AbstractListLoader {
//     
//     private final PackageManager mPm;
//     private final boolean mHideSystemApps;
// 
//     public AppListLoader(Context context) {
//         super(context);
//         
//         // Retrieve the package manager for later use; note we don't
//         // use 'context' directly but instead the save global application
//         // context returned by getContext().
//         mPm = getContext().getPackageManager();
//         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//         mHideSystemApps = prefs.getBoolean(MyAppListPreferenceActivity.KEY_HIDE_SYSTEM_APPS, true);
//     }
// 
//     @Override
//     public ArrayList<AppInfo> loadAppInfoList() {
//         return AppUtil.loadAppInfoList(mPm, mHideSystemApps);
//     }
// 
//     @Override
//     public boolean isPackageIntentReceiver() {
//         return true;
//     }
// }


// Path: application/src/main/java/com/projectsexception/myapplist/fragments/AppListFragment.java
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
import com.projectsexception.myapplist.R;
import com.projectsexception.myapplist.model.AppInfo;
import com.projectsexception.myapplist.work.AppListLoader;
import java.util.ArrayList;
import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;

    @Override
    public void onDetach() {
        mCallBack = null;
        super.onDetach();
    }

    @Override
    int getMenuAdapter() {
        return R.menu.adapter_app;
    }

    @Override
    int getMenuResource() {
        return R.menu.fragment_app;
    }

    @Override
    Loader<ArrayList<AppInfo>> createLoader(int id, Bundle args) {
        return new AppListLoader(getActivity());
    }

    @Override
    void showAppInfo(String name, String packageName) {
        if (mCallBack != null) {
            mCallBack.showAppInfo(name, packageName);
        }
    }

    @Override
    int getTitle() {
        return R.string.app_name;