1
0
Fork 0
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:
Nikolay Pultsin 2014-04-17 19:27:15 +01:00
parent 026b80320c
commit c4418f673c

View file

@ -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;