diff --git a/app/build.gradle b/app/build.gradle index 60046f8..95b107e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ ext { // App version in semver format (https://semver.org/) versionMajor = 0 versionMinor = 4 - versionPatch = 3 + versionPatch = 4 } project.version = "${versionMajor}.${versionMinor}.${versionPatch}" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0fbe860..2cfbc95 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,10 +7,11 @@ + android:theme="@style/AppTheme" + android:requestLegacyExternalStorage="true"> + android:launchMode="singleTask"> diff --git a/app/src/main/java/su/comp/bk/ui/BkEmuFileDialog.java b/app/src/main/java/su/comp/bk/ui/BkEmuFileDialog.java index 5452e31..d3c26a4 100644 --- a/app/src/main/java/su/comp/bk/ui/BkEmuFileDialog.java +++ b/app/src/main/java/su/comp/bk/ui/BkEmuFileDialog.java @@ -341,6 +341,7 @@ private static String getFormatFilterString(String[] formatFilterArray) { } protected SimpleAdapter getDirList(final String dirPath) { + File[] files = null; currentDirElements = new ArrayList<>(); ArrayList> dirItems = new ArrayList<>(); @@ -348,23 +349,26 @@ protected SimpleAdapter getDirList(final String dirPath) { if (!f.isDirectory()) { f = f.getParentFile(); } - String currentPath = f.getPath(); - File[] files = f.listFiles(); - if (files == null) { - currentPath = Environment.getExternalStorageDirectory().getPath(); - f = new File(currentPath); - files = f.listFiles(); + if (!isDirectoryReadable(f)) { + f = Environment.getExternalStorageDirectory(); + } + if (!isDirectoryReadable(f)) { + f = getApplicationContext().getExternalFilesDir(null); } - pushDirToHistory(currentPath); - if (!currentPath.equals(ROOT_PATH)) { - if (isDirectoryReadable(ROOT_PATH)) { - addDirItem(dirItems, ROOT_PATH, R.drawable.ic_folder_white_24dp); - currentDirElements.add(ROOT_PATH); - } - if (isDirectoryReadable(f.getParent())) { - addDirItem(dirItems, "../", R.drawable.ic_folder_white_24dp); - currentDirElements.add(f.getParent()); + if (f != null) { + files = f.listFiles(); + String currentPath = f.getPath(); + pushDirToHistory(currentPath); + if (!currentPath.equals(ROOT_PATH)) { + if (isDirectoryReadable(ROOT_PATH)) { + addDirItem(dirItems, ROOT_PATH, R.drawable.ic_folder_white_24dp); + currentDirElements.add(ROOT_PATH); + } + if (isDirectoryReadable(f.getParent())) { + addDirItem(dirItems, "../", R.drawable.ic_folder_white_24dp); + currentDirElements.add(f.getParent()); + } } } @@ -372,22 +376,24 @@ protected SimpleAdapter getDirList(final String dirPath) { TreeMap dirsPathMap = new TreeMap<>(); TreeMap filesMap = new TreeMap<>(); TreeMap filesPathMap = new TreeMap<>(); - for (File file : files) { - if (file.isDirectory()) { - String dirName = file.getName(); - dirsMap.put(dirName, dirName); - dirsPathMap.put(dirName, file.getPath()); - } else { - final String fileName = file.getName(); - if (formatFilter != null) { - boolean isFormatMatched = isFileNameFormatMatched(fileName, formatFilter); - if (isFormatMatched) { + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + String dirName = file.getName(); + dirsMap.put(dirName, dirName); + dirsPathMap.put(dirName, file.getPath()); + } else { + final String fileName = file.getName(); + if (formatFilter != null) { + boolean isFormatMatched = isFileNameFormatMatched(fileName, formatFilter); + if (isFormatMatched) { + filesMap.put(fileName, fileName); + filesPathMap.put(fileName, file.getPath()); + } + } else { filesMap.put(fileName, fileName); filesPathMap.put(fileName, file.getPath()); } - } else { - filesMap.put(fileName, fileName); - filesPathMap.put(fileName, file.getPath()); } } } @@ -420,7 +426,13 @@ private static boolean isDirectoryReadable(String dirName) { if (dirName == null) { return false; } - File dir = new File(dirName); + return isDirectoryReadable(new File(dirName)); + } + + private static boolean isDirectoryReadable(File dir) { + if (dir == null) { + return false; + } return dir.exists() && dir.listFiles() != null; } diff --git a/app/src/main/res/raw-ru/changelog_data.xml b/app/src/main/res/raw-ru/changelog_data.xml index 4674786..1a0a0e0 100644 --- a/app/src/main/res/raw-ru/changelog_data.xml +++ b/app/src/main/res/raw-ru/changelog_data.xml @@ -1,5 +1,10 @@ + + + Исправлена ошибка в диалоге выбора BIN-файла на Android 10. + + Исправлена обработка команды WAIT. diff --git a/app/src/main/res/raw/changelog_data.xml b/app/src/main/res/raw/changelog_data.xml index 8df34ec..7c16efb 100644 --- a/app/src/main/res/raw/changelog_data.xml +++ b/app/src/main/res/raw/changelog_data.xml @@ -1,5 +1,10 @@ + + + Fixed open BIN file dialog error on Android 10. + + Fixed WAIT opcode handling. diff --git a/build.gradle b/build.gradle index 5880d16..ba8927f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.1' + classpath 'com.android.tools.build:gradle:3.5.3' } }