// Path: library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java
// public static final String EXTRA_ALLOW_MULTIPLE = "android.intent.extra" + ".ALLOW_MULTIPLE";
// 
// Path: library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java
// public static final String EXTRA_PATHS = "nononsense.intent.PATHS";


import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.nononsenseapps.filepicker.AbstractFilePickerActivity.EXTRA_ALLOW_MULTIPLE;
import static com.nononsenseapps.filepicker.AbstractFilePickerActivity.EXTRA_PATHS;
                    String.format("Can't decode paths to '%s', only for 'root' paths.",
                            tag));
        }

        final File root = new File("/");

        File file = new File(root, path);
        try {
            file = file.getCanonicalFile();
        } catch (IOException e) {
            throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
        }

        if (!file.getPath().startsWith(root.getPath())) {
            throw new SecurityException("Resolved path jumped beyond configured root");
        }

        return file;
    }

    /**
     * Parses the returned files from a filepicker activity into a nice list
     *
     * @param data returned by the {@link AbstractFilePickerActivity}
     * @return a {@link List<Uri>} of files (uris) which the user selected in the picker.
     */
    @NonNull
    public static List<Uri> getSelectedFilesFromResult(@NonNull Intent data) {
        List<Uri> result = new ArrayList<>();
        if (data.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, false)) {
// Path: library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java
// public static final String EXTRA_ALLOW_MULTIPLE = "android.intent.extra" + ".ALLOW_MULTIPLE";
// 
// Path: library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java
// public static final String EXTRA_PATHS = "nononsense.intent.PATHS";


// Path: library/src/main/java/com/nononsenseapps/filepicker/Utils.java
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.nononsenseapps.filepicker.AbstractFilePickerActivity.EXTRA_ALLOW_MULTIPLE;
import static com.nononsenseapps.filepicker.AbstractFilePickerActivity.EXTRA_PATHS;

                    String.format("Can't decode paths to '%s', only for 'root' paths.",
                            tag));
        }

        final File root = new File("/");

        File file = new File(root, path);
        try {
            file = file.getCanonicalFile();
        } catch (IOException e) {
            throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
        }

        if (!file.getPath().startsWith(root.getPath())) {
            throw new SecurityException("Resolved path jumped beyond configured root");
        }

        return file;
    }

    /**
     * Parses the returned files from a filepicker activity into a nice list
     *
     * @param data returned by the {@link AbstractFilePickerActivity}
     * @return a {@link List<Uri>} of files (uris) which the user selected in the picker.
     */
    @NonNull
    public static List<Uri> getSelectedFilesFromResult(@NonNull Intent data) {
        List<Uri> result = new ArrayList<>();
        if (data.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, false)) {
            List<String> paths = data.getStringArrayListExtra(EXTRA_PATHS);