private List<StorageMount> getSecondayExternals(Context context) { List<StorageMount> mounts = new ArrayList<StorageMount>(); String primaryPath = context.getExternalFilesDir(null).getParent(); int i = 0; for (File f : SystemUtils.getExternalFilesDirs(context)) { if (!f.getAbsolutePath().startsWith(primaryPath) && SystemUtils.isSecondaryExternalStorageMounted(f)) { String label = context.getString(R.string.sdcard_storage) + " " + (++i); String description = UIUtils.getBytesInHuman(SystemUtils.getAvailableStorageSize(f)) + " " + context.getString(R.string.available); String path = f.getAbsolutePath(); StorageMount mount = new StorageMount(label, description, path, false); mounts.add(mount); } } return mounts; }
private StorageMount getPrimaryExternal(Context context) { StorageMount mount = null; if (SystemUtils.isPrimaryExternalStorageMounted()) { File dir = Environment.getExternalStorageDirectory(); String label = context.getString(R.string.device_storage); String description = UIUtils.getBytesInHuman(SystemUtils.getAvailableStorageSize(dir)) + " " + context.getString(R.string.available); String path = dir.getAbsolutePath(); mount = new StorageMount(label, description, path, true); } return mount; }