Add Folder to mime types, don't display null data
Bug: 62787889
Change-Id: I90041922feb55612cee0a654b47d94d4e90c122c
diff --git a/res/values/mimes.xml b/res/values/mimes.xml
index 38c0276..6823ed9 100644
--- a/res/values/mimes.xml
+++ b/res/values/mimes.xml
@@ -64,4 +64,6 @@
<string name="gmap_file_type">Google map</string>
<!-- Google site file type shown in type column in list view. [CHAR LIMIT=24] -->
<string name="gsite_file_type">Google site</string>
+ <!-- Generic directory type shown when viewing a folder in the properties view -->
+ <string name="directory_type">Folder</string>
</resources>
\ No newline at end of file
diff --git a/src/com/android/documentsui/FileTypeMap.java b/src/com/android/documentsui/FileTypeMap.java
index 29f7e4c..d4969be 100644
--- a/src/com/android/documentsui/FileTypeMap.java
+++ b/src/com/android/documentsui/FileTypeMap.java
@@ -84,6 +84,9 @@
mFileTypeMap.put("application/vnd.google-apps.map", R.string.gmap_file_type);
mFileTypeMap.put("application/vnd.google-apps.sites", R.string.gsite_file_type);
+ // Directory type
+ mFileTypeMap.put("vnd.android.document/directory", R.string.directory_type);
+
// Archive types
mArchiveTypeMap.put("application/rar", "RAR");
mArchiveTypeMap.put("application/zip", "Zip");
diff --git a/src/com/android/documentsui/inspector/DetailsView.java b/src/com/android/documentsui/inspector/DetailsView.java
index 6c27519..d79b8a2 100644
--- a/src/com/android/documentsui/inspector/DetailsView.java
+++ b/src/com/android/documentsui/inspector/DetailsView.java
@@ -66,10 +66,13 @@
final Lookup<String, String> fileTypeLookup
= DocumentsApplication.getFileTypeLookup(getContext());
setRow(R.string.sort_dimension_file_type, fileTypeLookup.lookup(info.mimeType));
- setRow(R.string.sort_dimension_size, Formatter.formatFileSize(getContext(), info.size));
- setRow(R.string.sort_dimension_date,
- DateFormat.getDateFormat(getContext()).format(info.lastModified));
-
+ if (info.size > 0) {
+ setRow(R.string.sort_dimension_size, Formatter.formatFileSize(getContext(), info.size));
+ }
+ if (info.lastModified > 0) {
+ setRow(R.string.sort_dimension_date,
+ DateFormat.getDateFormat(getContext()).format(info.lastModified));
+ }
if(info.numberOfChildren != -1) {
setRow(R.string.directory_children, String.valueOf(info.numberOfChildren));
}