Solve bug of empty filename #51

This commit is contained in:
J-Jamet committed 2018-03-19 16:33:43 +01:00
1 parent f2566abdcd
commit 758914a80a
1 file changed
+11 -3
@@ -31,12 +31,16 @@ public class FileSelectBean implements Serializable {
private static final String EXTERNAL_STORAGE_AUTHORITY = "com.android.externalstorage.documents";
private String fileName = "";
private String fileName;
private Uri fileUri;
private Date lastModification = new Date();
private long size = 0;
private Date lastModification;
private long size;
public FileSelectBean(Context context, String pathFile) {
fileName = "";
lastModification = new Date();
size = 0;
fileUri = Uri.parse(pathFile);
if (EXTERNAL_STORAGE_AUTHORITY.equals(fileUri.getAuthority())) {
DocumentFile file = DocumentFile.fromSingleUri(context, fileUri);
@@ -49,6 +53,10 @@ public class FileSelectBean implements Serializable {
fileName = file.getName();
lastModification = new Date(file.lastModified());
}
if (fileName == null || fileName.isEmpty()) {
fileName = fileUri.getPath();
}
}
public boolean notFound() {