mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
parent
5c1eda3392
commit
21dbc800d5
@ -22,8 +22,6 @@ public class DocumentStat {
|
|||||||
private final Boolean isDirectory;
|
private final Boolean isDirectory;
|
||||||
private final long size;
|
private final long size;
|
||||||
private final long lastModified;
|
private final long lastModified;
|
||||||
private static final String encodedSlash = Uri.encode("/");
|
|
||||||
private static final String PATH_DOCUMENT = "document";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cursor columns must be in the following format:
|
* Cursor columns must be in the following format:
|
||||||
@ -51,11 +49,30 @@ public class DocumentStat {
|
|||||||
this.internalUri = this.uri;
|
this.internalUri = this.uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int mimeTypeColIndex = c.getColumnIndex(DocumentsContract.Document.COLUMN_MIME_TYPE);
|
||||||
|
final int sizeColIndex = c.getColumnIndex(DocumentsContract.Document.COLUMN_SIZE);
|
||||||
|
final int lastModifiedColIndex = c.getColumnIndex(DocumentsContract.Document.COLUMN_LAST_MODIFIED);
|
||||||
|
|
||||||
this.displayName = c.getString(1);
|
this.displayName = c.getString(1);
|
||||||
this.mimeType = c.getString(2);
|
|
||||||
this.size = c.getLong(3);
|
if (mimeTypeColIndex != -1) {
|
||||||
this.lastModified = c.getLong(4);
|
this.mimeType = c.getString(mimeTypeColIndex);
|
||||||
|
} else {
|
||||||
|
this.mimeType = "*/*";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeColIndex != -1) {
|
||||||
|
this.size = c.getLong(sizeColIndex);
|
||||||
|
} else {
|
||||||
|
this.size = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastModifiedColIndex != -1) {
|
||||||
|
this.lastModified = c.getLong(lastModifiedColIndex);
|
||||||
|
}else {
|
||||||
|
this.lastModified = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
this.isDirectory = DocumentsContract.Document.MIME_TYPE_DIR.equals(this.mimeType);
|
this.isDirectory = DocumentsContract.Document.MIME_TYPE_DIR.equals(this.mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class EfficientDocumentHelper {
|
|||||||
|
|
||||||
uri = Uri.fromFile(targetFile);
|
uri = Uri.fromFile(targetFile);
|
||||||
return uri;
|
return uri;
|
||||||
} else if (UriHelper.isDocumentUri(uri)) {
|
} else if (UriHelper.isDocumentUri(uri) || !DocumentsContract.isTreeUri(uri)) {
|
||||||
// It's a document picked by user, nothing much we can do. operations limited.
|
// It's a document picked by user, nothing much we can do. operations limited.
|
||||||
DocumentStat stat = null;
|
DocumentStat stat = null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user