mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
File.canExecute() is only accessible on SDKs 9 and higher
This commit is contained in:
parent
026b80320c
commit
c4418f673c
1 changed files with 18 additions and 10 deletions
|
@ -40,6 +40,14 @@ public class FileUtils {
|
|||
_MapFileIcons.put(MimeTypes._RegexFileTypePlainTexts, R.drawable.afc_file_plain_text);
|
||||
}
|
||||
|
||||
private static boolean accessDenied(IFile file) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= 9) {
|
||||
return file instanceof File && !((File)file).canExecute();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets resource icon ID of an {@link IFile}.
|
||||
*
|
||||
|
@ -63,7 +71,7 @@ public class FileUtils {
|
|||
if (file instanceof File && !((File)file).canWrite()) {
|
||||
if (file instanceof ParentFile) {
|
||||
return R.drawable.afc_folder;
|
||||
}else if(!((File)file).canExecute()){
|
||||
} else if (accessDenied(file)) {
|
||||
return R.drawable.afc_folder_no_access;
|
||||
} else {
|
||||
return R.drawable.afc_folder_locked;
|
||||
|
@ -72,7 +80,7 @@ public class FileUtils {
|
|||
return R.drawable.afc_folder;
|
||||
}
|
||||
} else {
|
||||
if(file instanceof File && !((File)file).canExecute()){
|
||||
if (accessDenied(file)) {
|
||||
return R.drawable.afc_folder_no_access;
|
||||
} else {
|
||||
return R.drawable.afc_folder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue