<string name="auth_unsupported_multiaccount">%1$s does not support multiple accounts</string>
<string name="auth_fail_get_user_name">Your server is not returning a correct user id, please contact an administrator
</string>
- <string name="auth_can_not_auth_against_server">Can not authenticate against this server</string>
+ <string name="auth_can_not_auth_against_server">Cannot authenticate against this server</string>
<string name="fd_keep_in_sync">Keep file up to date</string>
<string name="common_rename">Rename</string>
<string name="common_remove">Remove</string>
- <string name="confirmation_remove_alert">"Do you really want to remove %1$s ?"</string>
- <string name="confirmation_remove_folder_alert">"Do you really want to remove %1$s and its contents ?"</string>
+ <string name="confirmation_remove_alert">"Do you really want to remove %1$s?"</string>
+ <string name="confirmation_remove_folder_alert">"Do you really want to remove %1$s and its contents?"</string>
<string name="confirmation_remove_local">Local only</string>
<string name="confirmation_remove_folder_local">Local contents only</string>
<string name="confirmation_remove_remote">Remove from server</string>
<string name="conflict_dont_upload">Don\'t upload</string>
<string name="preview_image_description">Image preview</string>
- <string name="preview_image_error_unknown_format">This image can not be shown</string>
+ <string name="preview_image_error_unknown_format">This image cannot be shown</string>
<string name="error__upload__local_file_not_copied">%1$s could not be copied to %2$s local folder</string>
<string name="actionbar_failed_instant_upload">Failed InstantUpload</string>
<string name="copy_link">Copy link</string>
<string name="clipboard_text_copied">Copied to clipboard</string>
- <string name="error_cant_bind_to_operations_service">Critical error: can not perform operations</string>
+ <string name="error_cant_bind_to_operations_service">Critical error: cannot perform operations</string>
<string name="network_error_socket_exception">An error occurred while connecting with the server.</string>
<string name="network_error_socket_timeout_exception">An error occurred while waiting for the server, the operation couldn\'t have been done</string>
<string name="network_error_connect_timeout_exception">An error occurred while waiting for the server, the operation couldn\'t have been done</string>
<string name="network_host_not_available">The operation couldn\'t be completed, server is unavaliable</string>
-
</resources>
// set file details
setFilename(file.getFileName());
- setFiletype(file.getMimetype());
+ setFiletype(file.getMimetype(), file.getFileName());
setFilesize(file.getFileLength());
if(ocVersionSupportsTimeCreated()){
setTimeCreated(file.getCreationTimestamp());
* Updates the MIME type in view
* @param mimetype to set
*/
- private void setFiletype(String mimetype) {
+ private void setFiletype(String mimetype, String filename) {
TextView tv = (TextView) getView().findViewById(R.id.fdType);
if (tv != null) {
String printableMimetype = DisplayUtils.convertMIMEtoPrettyPrint(mimetype);;
}
ImageView iv = (ImageView) getView().findViewById(R.id.fdIcon);
if (iv != null) {
- iv.setImageResource(DisplayUtils.getResourceId(mimetype));
+ iv.setImageResource(DisplayUtils.getResourceId(mimetype, filename));
}
}
import java.util.HashSet;\r
import java.util.Set;\r
\r
+import android.util.Log;\r
+\r
import com.owncloud.android.R;\r
\r
/**\r
private static final String TYPE_VIDEO = "video";\r
\r
private static final String SUBTYPE_PDF = "pdf";\r
- private static final String[] SUBTYPES_DOCUMENT = { "msword", "mspowerpoint", "msexcel", \r
- "vnd.oasis.opendocument.presentation",\r
- "vnd.oasis.opendocument.spreadsheet",\r
- "vnd.oasis.opendocument.text"\r
+ private static final String[] SUBTYPES_DOCUMENT = { "msword",\r
+ "vnd.openxmlformats-officedocument.wordprocessingml.document",\r
+ "vnd.oasis.opendocument.text",\r
+ "rtf"\r
};\r
private static Set<String> SUBTYPES_DOCUMENT_SET = new HashSet<String>(Arrays.asList(SUBTYPES_DOCUMENT));\r
+ private static final String[] SUBTYPES_SPREADSHEET = { "msexcel",\r
+ "vnd.openxmlformats-officedocument.spreadsheetml.sheet",\r
+ "vnd.oasis.opendocument.spreadsheet"\r
+ };\r
+ private static Set<String> SUBTYPES_SPREADSHEET_SET = new HashSet<String>(Arrays.asList(SUBTYPES_SPREADSHEET));\r
+ private static final String[] SUBTYPES_PRESENTATION = { "mspowerpoint",\r
+ "vnd.openxmlformats-officedocument.presentationml.presentation",\r
+ "vnd.oasis.opendocument.presentation"\r
+ };\r
+ private static Set<String> SUBTYPES_PRESENTATION_SET = new HashSet<String>(Arrays.asList(SUBTYPES_PRESENTATION));\r
private static final String[] SUBTYPES_COMPRESSED = {"x-tar", "x-gzip", "zip"};\r
private static final Set<String> SUBTYPES_COMPRESSED_SET = new HashSet<String>(Arrays.asList(SUBTYPES_COMPRESSED));\r
+ private static final String SUBTYPE_OCTET_STREAM = "octet-stream";\r
+ private static final String EXTENSION_RAR = "rar";\r
+ private static final String EXTENSION_RTF = "rtf";\r
+ private static final String EXTENSION_3GP = "3gp";\r
\r
/**\r
* Converts the file size in bytes to human readable output.\r
* @param mimetype MIME type string.\r
* @return Resource identifier of an image resource.\r
*/\r
- public static int getResourceId(String mimetype) {\r
+ public static int getResourceId(String mimetype, String filename) {\r
\r
if (mimetype == null || "DIR".equals(mimetype)) {\r
return R.drawable.ic_menu_archive;\r
} else if (SUBTYPES_DOCUMENT_SET.contains(subtype)) {\r
return R.drawable.file_doc;\r
\r
+ } else if (SUBTYPES_SPREADSHEET_SET.contains(subtype)) {\r
+ return R.drawable.file_xls;\r
+\r
+ } else if (SUBTYPES_PRESENTATION_SET.contains(subtype)) {\r
+ return R.drawable.file_ppt;\r
+\r
} else if (SUBTYPES_COMPRESSED_SET.contains(subtype)) {\r
return R.drawable.file_zip;\r
- }\r
- \r
+ \r
+ } else if (SUBTYPE_OCTET_STREAM.equals(subtype) ) {\r
+ if (getExtension(filename).equalsIgnoreCase(EXTENSION_RAR)) {\r
+ return R.drawable.file_zip;\r
+ \r
+ } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_RTF)) {\r
+ return R.drawable.file_doc;\r
+ \r
+ } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_3GP)) {\r
+ return R.drawable.file_movie;\r
+ \r
+ } \r
+ } \r
}\r
- // problems: RAR, RTF, 3GP are send as application/octet-stream from the server ; extension in the filename should be explicitly reviewed\r
}\r
\r
// default icon\r
}\r
\r
\r
-\r
+ private static String getExtension(String filename) {\r
+ String extension = filename.substring(filename.lastIndexOf(".") + 1);\r
+ \r
+ return extension;\r
+ }\r
+ \r
/**\r
* Converts Unix time to human readable format\r
* @param miliseconds that have passed since 01/01/1970\r