From: masensio Date: Fri, 30 May 2014 10:40:55 +0000 (+0200) Subject: Merge branch 'master' into vanish_notifications X-Git-Tag: oc-android-1.7.0_signed~294^2~5 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/dbfbc10af43b10fc23e56fa62ef0cde6df71f0e4?hp=c407a568e09de0c13c9a42fcd3e4662e38744cb2 Merge branch 'master' into vanish_notifications --- diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 48d5b0c1..4cd20c0a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,8 +18,8 @@ along with this program. If not, see . --> + android:versionCode="105006" + android:versionName="1.5.6" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/oc_jb_workaround/AndroidManifest.xml b/oc_jb_workaround/AndroidManifest.xml index 640b6aba..0d6002ab 100644 --- a/oc_jb_workaround/AndroidManifest.xml +++ b/oc_jb_workaround/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="0100015" + android:versionName="1.0.15" > %1$s does not support multiple accounts Your server is not returning a correct user id, please contact an administrator - Can not authenticate against this server + Cannot authenticate against this server Keep file up to date Rename Remove - "Do you really want to remove %1$s ?" - "Do you really want to remove %1$s and its contents ?" + "Do you really want to remove %1$s?" + "Do you really want to remove %1$s and its contents?" Local only Local contents only Remove from server @@ -246,7 +246,7 @@ Don\'t upload Image preview - This image can not be shown + This image cannot be shown %1$s could not be copied to %2$s local folder Failed InstantUpload @@ -256,7 +256,7 @@ retry all selected delete all selected from uploadqueue retry to upload the image: - Load more Picrures + Load more Pictures do nothing you are not online for instant upload Failure Message: Please check your server configuration,maybe your quota is exceeded. @@ -273,12 +273,11 @@ Copy link Copied to clipboard - Critical error: can not perform operations + Critical error: cannot perform operations An error occurred while connecting with the server. An error occurred while waiting for the server, the operation couldn\'t have been done An error occurred while waiting for the server, the operation couldn\'t have been done - The operation couldn\'t be completed, server is unavaliable - + The operation couldn\'t be completed, server is unavailable diff --git a/src/com/owncloud/android/ui/activity/FileActivity.java b/src/com/owncloud/android/ui/activity/FileActivity.java index 02025226..6b8fa43d 100644 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@ -447,6 +447,13 @@ implements OnRemoteOperationListener, ComponentsGetter { )) { requestCredentialsUpdate(); + + if (result.getCode() == ResultCode.UNAUTHORIZED) { + dismissLoadingDialog(); + Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), + Toast.LENGTH_LONG); + t.show(); + } } else if (operation instanceof CreateShareOperation) { onCreateShareOperationFinish((CreateShareOperation) operation, result); diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 04d28134..4babd9db 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -181,11 +181,6 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener mRightFragmentContainer = findViewById(R.id.right_fragment_container); if (savedInstanceState == null) { createMinFragments(); - } else { - Log_OC.d(TAG, "Init the secondFragment again"); - if (mDualPane) { - initFragmentsWithFile(); - } } // Action bar setup diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 38ade7c8..656e0042 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -113,7 +113,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { fileName.setText(name); ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1); - fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype())); + fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())); ImageView localStateView = (ImageView) view.findViewById(R.id.imageView2); FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 76cee973..768275cd 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -330,7 +330,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener // set file details setFilename(file.getFileName()); - setFiletype(file.getMimetype()); + setFiletype(file.getMimetype(), file.getFileName()); setFilesize(file.getFileLength()); if(ocVersionSupportsTimeCreated()){ setTimeCreated(file.getCreationTimestamp()); @@ -382,8 +382,9 @@ public class FileDetailFragment extends FileFragment implements OnClickListener /** * Updates the MIME type in view * @param mimetype to set + * @param filename */ - 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);; @@ -391,7 +392,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener } ImageView iv = (ImageView) getView().findViewById(R.id.fdIcon); if (iv != null) { - iv.setImageResource(DisplayUtils.getResourceId(mimetype)); + iv.setImageResource(DisplayUtils.getResourceId(mimetype, filename)); } } diff --git a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 0697868b..03cf250f 100644 --- a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -181,7 +181,8 @@ public class PreviewMediaFragment extends FileFragment implements } } else { - setFile((OCFile)savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE)); + file = (OCFile)savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE); + setFile(file); mAccount = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_ACCOUNT); mSavedPlaybackPosition = savedInstanceState.getInt(PreviewMediaFragment.EXTRA_PLAY_POSITION); diff --git a/src/com/owncloud/android/utils/DisplayUtils.java b/src/com/owncloud/android/utils/DisplayUtils.java index 680107b8..682d2be0 100644 --- a/src/com/owncloud/android/utils/DisplayUtils.java +++ b/src/com/owncloud/android/utils/DisplayUtils.java @@ -63,14 +63,28 @@ public class DisplayUtils { private static final String TYPE_VIDEO = "video"; private static final String SUBTYPE_PDF = "pdf"; - private static final String[] SUBTYPES_DOCUMENT = { "msword", "mspowerpoint", "msexcel", - "vnd.oasis.opendocument.presentation", - "vnd.oasis.opendocument.spreadsheet", - "vnd.oasis.opendocument.text" + private static final String[] SUBTYPES_DOCUMENT = { "msword", + "vnd.openxmlformats-officedocument.wordprocessingml.document", + "vnd.oasis.opendocument.text", + "rtf" }; private static Set SUBTYPES_DOCUMENT_SET = new HashSet(Arrays.asList(SUBTYPES_DOCUMENT)); + private static final String[] SUBTYPES_SPREADSHEET = { "msexcel", + "vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "vnd.oasis.opendocument.spreadsheet" + }; + private static Set SUBTYPES_SPREADSHEET_SET = new HashSet(Arrays.asList(SUBTYPES_SPREADSHEET)); + private static final String[] SUBTYPES_PRESENTATION = { "mspowerpoint", + "vnd.openxmlformats-officedocument.presentationml.presentation", + "vnd.oasis.opendocument.presentation" + }; + private static Set SUBTYPES_PRESENTATION_SET = new HashSet(Arrays.asList(SUBTYPES_PRESENTATION)); private static final String[] SUBTYPES_COMPRESSED = {"x-tar", "x-gzip", "zip"}; private static final Set SUBTYPES_COMPRESSED_SET = new HashSet(Arrays.asList(SUBTYPES_COMPRESSED)); + private static final String SUBTYPE_OCTET_STREAM = "octet-stream"; + private static final String EXTENSION_RAR = "rar"; + private static final String EXTENSION_RTF = "rtf"; + private static final String EXTENSION_3GP = "3gp"; /** * Converts the file size in bytes to human readable output. @@ -135,9 +149,10 @@ public class DisplayUtils { * known MIME type. * * @param mimetype MIME type string. + * @param filename name, with extension * @return Resource identifier of an image resource. */ - public static int getResourceId(String mimetype) { + public static int getResourceId(String mimetype, String filename) { if (mimetype == null || "DIR".equals(mimetype)) { return R.drawable.ic_menu_archive; @@ -167,12 +182,28 @@ public class DisplayUtils { } else if (SUBTYPES_DOCUMENT_SET.contains(subtype)) { return R.drawable.file_doc; + } else if (SUBTYPES_SPREADSHEET_SET.contains(subtype)) { + return R.drawable.file_xls; + + } else if (SUBTYPES_PRESENTATION_SET.contains(subtype)) { + return R.drawable.file_ppt; + } else if (SUBTYPES_COMPRESSED_SET.contains(subtype)) { return R.drawable.file_zip; - } - + + } else if (SUBTYPE_OCTET_STREAM.equals(subtype) ) { + if (getExtension(filename).equalsIgnoreCase(EXTENSION_RAR)) { + return R.drawable.file_zip; + + } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_RTF)) { + return R.drawable.file_doc; + + } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_3GP)) { + return R.drawable.file_movie; + + } + } } - // problems: RAR, RTF, 3GP are send as application/octet-stream from the server ; extension in the filename should be explicitly reviewed } // default icon @@ -180,7 +211,12 @@ public class DisplayUtils { } - + private static String getExtension(String filename) { + String extension = filename.substring(filename.lastIndexOf(".") + 1); + + return extension; + } + /** * Converts Unix time to human readable format * @param miliseconds that have passed since 01/01/1970