// Path: app/src/main/java/ua/naiksoftware/util/ProcessUtils.java
// public class ProcessUtils {
// 
//     public static String readFromProcess(java.lang.Process process, boolean err) {
//         StringBuilder result = new StringBuilder();
//         String line;
//         BufferedReader br = new BufferedReader(new InputStreamReader(err ? process.getErrorStream() : process.getInputStream()));
//         try {
//             while ((line = br.readLine()) != null) {
//                 result.append(line).append("\n");
//             }
//         } catch (IOException e) {
//             //Log.e("Main", "read From Process", e);
//         }
//         return result.toString();
//     }
// }
// 
// Path: app/src/main/java/ua/naiksoftware/util/MathUtils.java
// public class MathUtils {
// 
//     /**
//      *
//      * @param sourceNum
//      * @return rounded to two decimal places
//      */
//     public static float round(float sourceNum) {
//         int temp = (int) (sourceNum / 0.01f);
//         return temp / 100f;
//     }
// }
// 
// Path: app/src/main/java/filelog/Log.java
// public class Log {
// 
//     private static final String token = " : ";
//     private static final long MAX_LEN = 300 * 1024;//50 Kb
// 
//     public static void d(String tag, String message) {
//         try {
//             boolean noClear;
//             File file = new File(Environment.getExternalStorageDirectory(), "log_j2meloader.txt");
//             if (file.length() > MAX_LEN) {
//                 noClear = false;
//             } else {
//                 noClear = true;
//             }
//             FileWriter fw = new FileWriter(file, noClear);
//             String msg = "\n" + new Date().toLocaleString() + token + tag + token + message;
//             fw.write(msg);
//             fw.flush();
//             fw.close();
//             //Log.d("L", msg);
//         } catch (IOException e) {
//             android.util.Log.e("L", "err in logging", e);
//         }
//     }
// }


import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import android.widget.TextView;
import ua.naiksoftware.util.ProcessUtils;
import java.io.IOException;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Collections;
import ua.naiksoftware.util.MathUtils;
import filelog.Log;
	private void showGlobalContextActionBar() {
		ActionBar actionBar = getActionBar();
		actionBar.setDisplayShowTitleEnabled(true);
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
		actionBar.setTitle(R.string.open_jar);
	}

	private ActionBar getActionBar() {
		return ((ActionBarActivity) getActivity()).getSupportActionBar();
	}

	/**
	 * Callbacks interface that all activities using this fragment must
	 * implement.
	 */
	public static interface SelectedCallback {
		/**
		 * Called when clicked on file
		 */
		void onSelected(String path);
	}

	private void readFolder(String folderStr) {
		Log.d(tag, "read : " + folderStr);
		String[] lsOutputDet;// Детальная информация
		String[] names;
		String error;
		try {
			java.lang.Process proc = new ProcessBuilder().command("ls", "-l",
					"-a", folderStr + "/").start();
// Path: app/src/main/java/ua/naiksoftware/util/ProcessUtils.java
// public class ProcessUtils {
// 
//     public static String readFromProcess(java.lang.Process process, boolean err) {
//         StringBuilder result = new StringBuilder();
//         String line;
//         BufferedReader br = new BufferedReader(new InputStreamReader(err ? process.getErrorStream() : process.getInputStream()));
//         try {
//             while ((line = br.readLine()) != null) {
//                 result.append(line).append("\n");
//             }
//         } catch (IOException e) {
//             //Log.e("Main", "read From Process", e);
//         }
//         return result.toString();
//     }
// }
// 
// Path: app/src/main/java/ua/naiksoftware/util/MathUtils.java
// public class MathUtils {
// 
//     /**
//      *
//      * @param sourceNum
//      * @return rounded to two decimal places
//      */
//     public static float round(float sourceNum) {
//         int temp = (int) (sourceNum / 0.01f);
//         return temp / 100f;
//     }
// }
// 
// Path: app/src/main/java/filelog/Log.java
// public class Log {
// 
//     private static final String token = " : ";
//     private static final long MAX_LEN = 300 * 1024;//50 Kb
// 
//     public static void d(String tag, String message) {
//         try {
//             boolean noClear;
//             File file = new File(Environment.getExternalStorageDirectory(), "log_j2meloader.txt");
//             if (file.length() > MAX_LEN) {
//                 noClear = false;
//             } else {
//                 noClear = true;
//             }
//             FileWriter fw = new FileWriter(file, noClear);
//             String msg = "\n" + new Date().toLocaleString() + token + tag + token + message;
//             fw.write(msg);
//             fw.flush();
//             fw.close();
//             //Log.d("L", msg);
//         } catch (IOException e) {
//             android.util.Log.e("L", "err in logging", e);
//         }
//     }
// }


// Path: app/src/main/java/ua/naiksoftware/j2meloader/NavigationDrawerFragment.java
import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import android.widget.TextView;
import ua.naiksoftware.util.ProcessUtils;
import java.io.IOException;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Collections;
import ua.naiksoftware.util.MathUtils;
import filelog.Log;

	private void showGlobalContextActionBar() {
		ActionBar actionBar = getActionBar();
		actionBar.setDisplayShowTitleEnabled(true);
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
		actionBar.setTitle(R.string.open_jar);
	}

	private ActionBar getActionBar() {
		return ((ActionBarActivity) getActivity()).getSupportActionBar();
	}

	/**
	 * Callbacks interface that all activities using this fragment must
	 * implement.
	 */
	public static interface SelectedCallback {
		/**
		 * Called when clicked on file
		 */
		void onSelected(String path);
	}

	private void readFolder(String folderStr) {
		Log.d(tag, "read : " + folderStr);
		String[] lsOutputDet;// Детальная информация
		String[] names;
		String error;
		try {
			java.lang.Process proc = new ProcessBuilder().command("ls", "-l",
					"-a", folderStr + "/").start();
			lsOutputDet = ProcessUtils.readFromProcess(proc, false).split("\n");