mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-29 04:29:31 +00:00
Expose download directory
This commit is contained in:
parent
d497810c23
commit
c054be6612
|
@ -57,6 +57,7 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||||
private final ArrayList<String> mPathStack = new ArrayList<String>();
|
private final ArrayList<String> mPathStack = new ArrayList<String>();
|
||||||
|
|
||||||
private static File sExternalFilesDir = null;
|
private static File sExternalFilesDir = null;
|
||||||
|
private static File sDownloadFilesDir = null;
|
||||||
private static boolean sInitializedPath = false;
|
private static boolean sInitializedPath = false;
|
||||||
|
|
||||||
public Apple2DisksMenu(Apple2Activity activity) {
|
public Apple2DisksMenu(Apple2Activity activity) {
|
||||||
|
@ -92,6 +93,9 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||||
sExternalFilesDir = externalDir;
|
sExternalFilesDir = externalDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sDownloadFilesDir == null) {
|
||||||
|
sDownloadFilesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||||
|
}
|
||||||
return sExternalFilesDir;
|
return sExternalFilesDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,16 +430,23 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||||
|
|
||||||
getExternalStorageDirectory();
|
getExternalStorageDirectory();
|
||||||
final boolean includeExternalStoragePath = (sExternalFilesDir != null && isRootPath);
|
final boolean includeExternalStoragePath = (sExternalFilesDir != null && isRootPath);
|
||||||
final int offset = includeExternalStoragePath ? 1 : 0;
|
final boolean includeDownloadsPath = (sDownloadFilesDir != null && isRootPath);
|
||||||
|
final int offset = includeExternalStoragePath ? (includeDownloadsPath ? 2 : 1) : (includeDownloadsPath ? 1 : 0);
|
||||||
final String[] fileNames = new String[files.length + offset];
|
final String[] fileNames = new String[files.length + offset];
|
||||||
final boolean[] isDirectory = new boolean[files.length + offset];
|
final boolean[] isDirectory = new boolean[files.length + offset];
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
if (includeExternalStoragePath) {
|
if (includeExternalStoragePath) {
|
||||||
fileNames[0] = sExternalFilesDir.getPath();
|
fileNames[idx] = sExternalFilesDir.getPath();
|
||||||
isDirectory[0] = true;
|
isDirectory[idx] = true;
|
||||||
|
++idx;
|
||||||
|
}
|
||||||
|
if (includeDownloadsPath) {
|
||||||
|
fileNames[idx] = sDownloadFilesDir.getAbsolutePath();
|
||||||
|
isDirectory[idx] = true;
|
||||||
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int idx = offset;
|
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
isDirectory[idx] = file.isDirectory();
|
isDirectory[idx] = file.isDirectory();
|
||||||
fileNames[idx] = file.getName();
|
fileNames[idx] = file.getName();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user