// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/ToolkitApplication.java
// public class ToolkitApplication extends Application {
// 
//     private static String dir;
// 
//     private static boolean isExternalStorageAvailable = false;
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for unzipped apks
//      */
//     public static String getUnZipDir() {
//         return dir + Constants.UNZIP;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         storagePathsValidate();
//     }
// 
//     public void storagePathsValidate() {
//         if (checkExternalStorage()) {
//             isExternalStorageAvailable = true;
//             dir = Environment.getExternalStorageDirectory().getAbsolutePath();
//         } else {
//             dir = getFilesDir().getAbsolutePath();
//         }
// 
//         ArrayList<String> paths = new ArrayList<>();
//         paths.add(getProjectDir());
//         paths.add(getApkDir());
//         paths.add(getSavedDir());
//         paths.add(getUnZipDir());
// 
//         for (String path : paths) {
//             File f = new File(path);
//             if (!f.isDirectory()) {
//                 f.mkdirs();
//             }
//         }
//     }
// 
//     /**
//      * @return folder file
//      * @brief Returns external storage directory.
//      */
//     public File getDir() {
//         return Environment.getExternalStorageDirectory();
//     }
// 
//     /**
//      * @return folder path
//      * @brief Returns directory for BuildmLearn toolkit  manually created files.
//      */
//     public String getProjectDir() {
//         return dir + Constants.BUILD_M_LEARN_PATH;
// 
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for saved projects
//      */
//     public String getSavedDir() {
//         return dir + Constants.SAVED_DIR;
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for saved projects
//      */
//     public String getDraftDir() {
//         return dir + Constants.DRAFT_DIR;
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for storing generated apks
//      */
//     public String getApkDir() {
//         return dir + Constants.APK_DIR;
//     }
// 
//     /**
//      * @return true if external storage is present, else false
//      * @brief Checks if external storage is present for storing data
//      */
//     public boolean checkExternalStorage() {
// 
//         boolean result = false;
//         File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/BuildmLearn123/");
//         if (!f.isDirectory()) {
//             result = f.mkdirs();
//             f.delete();
//         }
//         return result;
//     }
// 
//     public boolean isExternalStorageAvailable() {
//         return isExternalStorageAvailable;
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for Download directory
//      */
//     public String getDownloadDirectory() {
//         return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
//     }
// }


import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.Toast;
import org.buildmlearn.toolkit.R;
import org.buildmlearn.toolkit.ToolkitApplication;
import org.buildmlearn.toolkit.adapter.SavedApiAdapter;
import org.buildmlearn.toolkit.model.SavedApi;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
package org.buildmlearn.toolkit.fragment;




/**
 * Created by opticod (Anupam Das) on 29/2/16.
 *
 * @brief Fragment used for loading existing APKs into a list.
 */

public class LoadApkFragment extends Fragment implements AbsListView.OnItemClickListener {

    private static final String TAG = "Load API Fragment";
    private AbsListView mListView;

    private boolean showTemplateSelectedMenu;
    private SavedApiAdapter mAdapter;
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/ToolkitApplication.java
// public class ToolkitApplication extends Application {
// 
//     private static String dir;
// 
//     private static boolean isExternalStorageAvailable = false;
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for unzipped apks
//      */
//     public static String getUnZipDir() {
//         return dir + Constants.UNZIP;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         storagePathsValidate();
//     }
// 
//     public void storagePathsValidate() {
//         if (checkExternalStorage()) {
//             isExternalStorageAvailable = true;
//             dir = Environment.getExternalStorageDirectory().getAbsolutePath();
//         } else {
//             dir = getFilesDir().getAbsolutePath();
//         }
// 
//         ArrayList<String> paths = new ArrayList<>();
//         paths.add(getProjectDir());
//         paths.add(getApkDir());
//         paths.add(getSavedDir());
//         paths.add(getUnZipDir());
// 
//         for (String path : paths) {
//             File f = new File(path);
//             if (!f.isDirectory()) {
//                 f.mkdirs();
//             }
//         }
//     }
// 
//     /**
//      * @return folder file
//      * @brief Returns external storage directory.
//      */
//     public File getDir() {
//         return Environment.getExternalStorageDirectory();
//     }
// 
//     /**
//      * @return folder path
//      * @brief Returns directory for BuildmLearn toolkit  manually created files.
//      */
//     public String getProjectDir() {
//         return dir + Constants.BUILD_M_LEARN_PATH;
// 
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for saved projects
//      */
//     public String getSavedDir() {
//         return dir + Constants.SAVED_DIR;
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for saved projects
//      */
//     public String getDraftDir() {
//         return dir + Constants.DRAFT_DIR;
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for storing generated apks
//      */
//     public String getApkDir() {
//         return dir + Constants.APK_DIR;
//     }
// 
//     /**
//      * @return true if external storage is present, else false
//      * @brief Checks if external storage is present for storing data
//      */
//     public boolean checkExternalStorage() {
// 
//         boolean result = false;
//         File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/BuildmLearn123/");
//         if (!f.isDirectory()) {
//             result = f.mkdirs();
//             f.delete();
//         }
//         return result;
//     }
// 
//     public boolean isExternalStorageAvailable() {
//         return isExternalStorageAvailable;
//     }
// 
//     /**
//      * @return Folder path
//      * @brief Returns folder path for Download directory
//      */
//     public String getDownloadDirectory() {
//         return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
//     }
// }


// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/fragment/LoadApkFragment.java
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.Toast;
import org.buildmlearn.toolkit.R;
import org.buildmlearn.toolkit.ToolkitApplication;
import org.buildmlearn.toolkit.adapter.SavedApiAdapter;
import org.buildmlearn.toolkit.model.SavedApi;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

package org.buildmlearn.toolkit.fragment;




/**
 * Created by opticod (Anupam Das) on 29/2/16.
 *
 * @brief Fragment used for loading existing APKs into a list.
 */

public class LoadApkFragment extends Fragment implements AbsListView.OnItemClickListener {

    private static final String TAG = "Load API Fragment";
    private AbsListView mListView;

    private boolean showTemplateSelectedMenu;
    private SavedApiAdapter mAdapter;
    private ToolkitApplication mToolkit;