Merge branch 'develop' into accessibility
authormasensio <masensio@solidgear.es>
Tue, 10 Mar 2015 13:58:21 +0000 (14:58 +0100)
committermasensio <masensio@solidgear.es>
Tue, 10 Mar 2015 13:58:21 +0000 (14:58 +0100)
Conflicts:
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

300 files changed:
.gitmodules
AndroidManifest.xml
CHANGELOG.md [new file with mode: 0644]
build.gradle
gradle/wrapper/gradle-wrapper.properties
oc_jb_workaround/AndroidManifest.xml
oc_jb_workaround/res/values/setup.xml
oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
owncloud-android-library
res/anim/disappear.xml
res/anim/grow_from_bottom.xml
res/anim/grow_from_bottomleft_to_topright.xml
res/anim/grow_from_bottomright_to_topleft.xml
res/anim/grow_from_top.xml
res/anim/grow_from_topleft_to_bottomright.xml
res/anim/grow_from_topright_to_bottomleft.xml
res/anim/pump_bottom.xml
res/anim/pump_top.xml
res/anim/shrink_from_bottom.xml
res/anim/shrink_from_bottomleft_to_topright.xml
res/anim/shrink_from_bottomright_to_topleft.xml
res/anim/shrink_from_top.xml
res/anim/shrink_from_topleft_to_bottomright.xml
res/anim/shrink_from_topright_to_bottomleft.xml
res/drawable-hdpi/copy_link.png
res/drawable-hdpi/ic_favorite.png
res/drawable-hdpi/shared_with_me.png
res/drawable-hdpi/sharedlink.png
res/drawable-ldpi/copy_link.png
res/drawable-mdpi/copy_link.png
res/drawable-mdpi/ic_favorite.png
res/drawable-mdpi/shared_with_me.png
res/drawable-mdpi/sharedlink.png
res/drawable-xhdpi/copy_link.png
res/drawable-xhdpi/file.png [new file with mode: 0644]
res/drawable-xhdpi/file_doc.png [new file with mode: 0644]
res/drawable-xhdpi/file_image.png [new file with mode: 0644]
res/drawable-xhdpi/file_movie.png [new file with mode: 0644]
res/drawable-xhdpi/file_pdf.png [new file with mode: 0644]
res/drawable-xhdpi/file_ppt.png [new file with mode: 0644]
res/drawable-xhdpi/file_sound.png [new file with mode: 0644]
res/drawable-xhdpi/file_xls.png [new file with mode: 0644]
res/drawable-xhdpi/file_zip.png [new file with mode: 0644]
res/drawable-xhdpi/folder_public.png [new file with mode: 0644]
res/drawable-xhdpi/ic_favorite.png
res/drawable-xhdpi/ic_menu_archive.png [new file with mode: 0644]
res/drawable-xhdpi/shared_with_me.png
res/drawable-xhdpi/shared_with_me_folder.png [new file with mode: 0644]
res/drawable-xhdpi/sharedlink.png
res/drawable/action_item_btn.xml
res/drawable/btn.xml
res/drawable/btn_round.xml
res/drawable/btn_round_pressed.xml
res/drawable/downloading_file_indicator.png
res/drawable/list_selector.xml
res/drawable/main_header_bg.xml
res/drawable/progress_small.xml
res/drawable/split_action_bg.xml
res/drawable/uploader_list_separator.xml
res/layout-land/account_setup.xml
res/layout-v11/activity_row.xml
res/layout-v11/notification_with_progress_bar.xml
res/layout-v14/generic_explanation.xml
res/layout/account_setup.xml
res/layout/action_item.xml
res/layout/activity_row.xml
res/layout/edit_box_dialog.xml
res/layout/file_details_empty.xml
res/layout/file_details_fragment.xml
res/layout/file_download_fragment.xml
res/layout/file_preview.xml
res/layout/files.xml
res/layout/files_folder_picker.xml
res/layout/generic_explanation.xml
res/layout/grid_image.xml [new file with mode: 0644]
res/layout/grid_item.xml [new file with mode: 0644]
res/layout/list_fragment.xml
res/layout/list_item.xml
res/layout/loading_dialog.xml
res/layout/log_item.xml
res/layout/log_send_file.xml
res/layout/media_control.xml
res/layout/notification_with_progress_bar.xml
res/layout/pincodelock.xml
res/layout/popup.xml
res/layout/preview_image_activity.xml
res/layout/preview_image_fragment.xml
res/layout/ssl_untrusted_cert_layout.xml
res/layout/ssl_validator_layout.xml
res/layout/sso_dialog.xml
res/layout/upload_files_layout.xml
res/layout/uploader_layout.xml
res/layout/uploader_list_item_layout.xml
res/layout/video_layout.xml
res/menu/account_picker_long_click.xml
res/menu/file_actions_menu.xml
res/menu/main_menu.xml
res/raw-de/changelog.html
res/raw-es/changelog.html
res/raw/changelog.html
res/values-ar/strings.xml
res/values-az/strings.xml
res/values-bg-rBG/strings.xml
res/values-bs/strings.xml
res/values-ca/strings.xml
res/values-cs-rCZ/strings.xml
res/values-da/strings.xml
res/values-de-rDE/strings.xml
res/values-de/strings.xml
res/values-el/strings.xml
res/values-en-rGB/strings.xml
res/values-es-rAR/strings.xml
res/values-es-rCR/strings.xml
res/values-es/strings.xml
res/values-eu/strings.xml
res/values-fi-rFI/strings.xml
res/values-fr/strings.xml
res/values-gl/strings.xml
res/values-hr/strings.xml
res/values-it/strings.xml
res/values-ja-rJP/strings.xml
res/values-km/strings.xml
res/values-kn/strings.xml
res/values-ko/strings.xml
res/values-large-land/bools.xml
res/values-lo/strings.xml [new file with mode: 0644]
res/values-lt-rLT/strings.xml
res/values-lv/strings.xml
res/values-mn/strings.xml
res/values-mr/strings.xml [new file with mode: 0644]
res/values-nb-rNO/strings.xml
res/values-nl/strings.xml
res/values-pl/strings.xml
res/values-pt-rBR/strings.xml
res/values-pt-rPT/strings.xml
res/values-ro/strings.xml
res/values-ru/strings.xml
res/values-sk-rSK/strings.xml
res/values-sl/strings.xml
res/values-sr-rSP/strings.xml
res/values-sr/strings.xml
res/values-sv/strings.xml
res/values-tr/strings.xml
res/values-uk/strings.xml
res/values-yo/strings.xml [new file with mode: 0644]
res/values-zh-rCN/strings.xml
res/values-zh-rHK/strings.xml
res/values-zh-rTW/strings.xml
res/values/bools.xml
res/values/colors.xml
res/values/dims.xml
res/values/strings.xml
res/values/styles.xml
res/xml/authenticator.xml
res/xml/preferences.xml
res/xml/syncadapter_files.xml
src/com/owncloud/android/MainApp.java
src/com/owncloud/android/authentication/AccountAuthenticator.java
src/com/owncloud/android/authentication/AccountAuthenticatorService.java
src/com/owncloud/android/authentication/AccountUtils.java
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/authentication/AuthenticatorAsyncTask.java [new file with mode: 0644]
src/com/owncloud/android/authentication/OAuth2Constants.java
src/com/owncloud/android/authentication/SsoWebViewClient.java
src/com/owncloud/android/datamodel/FileDataStorageManager.java
src/com/owncloud/android/datamodel/OCFile.java
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
src/com/owncloud/android/db/DbHandler.java
src/com/owncloud/android/db/ProviderMeta.java
src/com/owncloud/android/files/BootupBroadcastReceiver.java
src/com/owncloud/android/files/FileMenuFilter.java
src/com/owncloud/android/files/FileOperationsHelper.java
src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java
src/com/owncloud/android/files/services/FileDownloader.java
src/com/owncloud/android/files/services/FileUploader.java
src/com/owncloud/android/files/services/IndexedForest.java [new file with mode: 0644]
src/com/owncloud/android/files/services/OnUploadCompletedListener.java
src/com/owncloud/android/media/MediaControlView.java
src/com/owncloud/android/media/MediaService.java
src/com/owncloud/android/media/MediaServiceBinder.java
src/com/owncloud/android/notifications/NotificationBuilderWithProgressBar.java
src/com/owncloud/android/notifications/NotificationDelayer.java
src/com/owncloud/android/operations/CreateFolderOperation.java
src/com/owncloud/android/operations/CreateShareOperation.java
src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java
src/com/owncloud/android/operations/DownloadFileOperation.java
src/com/owncloud/android/operations/GetServerInfoOperation.java
src/com/owncloud/android/operations/GetSharesForFileOperation.java
src/com/owncloud/android/operations/GetSharesOperation.java
src/com/owncloud/android/operations/MoveFileOperation.java
src/com/owncloud/android/operations/OAuth2GetAccessToken.java
src/com/owncloud/android/operations/RefreshFolderOperation.java [new file with mode: 0644]
src/com/owncloud/android/operations/RemoveFileOperation.java
src/com/owncloud/android/operations/RenameFileOperation.java
src/com/owncloud/android/operations/SynchronizeFileOperation.java
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
src/com/owncloud/android/operations/UnshareLinkOperation.java
src/com/owncloud/android/operations/UpdateOCVersionOperation.java
src/com/owncloud/android/operations/UploadFileOperation.java
src/com/owncloud/android/operations/common/SyncOperation.java
src/com/owncloud/android/providers/FileContentProvider.java
src/com/owncloud/android/services/OperationsService.java
src/com/owncloud/android/services/SyncFolderHandler.java [new file with mode: 0644]
src/com/owncloud/android/services/observer/FileObserverService.java
src/com/owncloud/android/services/observer/FolderObserver.java
src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java
src/com/owncloud/android/syncadapter/ContactSyncAdapter.java
src/com/owncloud/android/syncadapter/ContactSyncService.java
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
src/com/owncloud/android/syncadapter/FileSyncService.java
src/com/owncloud/android/ui/ActionItem.java
src/com/owncloud/android/ui/CheckBoxPreferenceWithLongTitle.java
src/com/owncloud/android/ui/CustomPopup.java
src/com/owncloud/android/ui/ExtendedListView.java
src/com/owncloud/android/ui/PreferenceWithLongSummary.java
src/com/owncloud/android/ui/QuickAction.java
src/com/owncloud/android/ui/RadioButtonPreference.java
src/com/owncloud/android/ui/SquareImageView.java [new file with mode: 0644]
src/com/owncloud/android/ui/SquareLinearLayout.java [new file with mode: 0644]
src/com/owncloud/android/ui/activity/ComponentsGetter.java
src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java
src/com/owncloud/android/ui/activity/CopyToClipboardActivity.java
src/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java
src/com/owncloud/android/ui/activity/FileActivity.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/activity/FolderPickerActivity.java
src/com/owncloud/android/ui/activity/GenericExplanationActivity.java
src/com/owncloud/android/ui/activity/HookActivity.java
src/com/owncloud/android/ui/activity/LogHistoryActivity.java
src/com/owncloud/android/ui/activity/OnEnforceableRefreshListener.java
src/com/owncloud/android/ui/activity/PinCodeActivity.java
src/com/owncloud/android/ui/activity/Preferences.java
src/com/owncloud/android/ui/activity/UploadFilesActivity.java
src/com/owncloud/android/ui/activity/UploadPathActivity.java
src/com/owncloud/android/ui/activity/Uploader.java
src/com/owncloud/android/ui/adapter/CertificateCombinedExceptionViewAdapter.java
src/com/owncloud/android/ui/adapter/DiskLruImageCache.java
src/com/owncloud/android/ui/adapter/FileListListAdapter.java
src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
src/com/owncloud/android/ui/adapter/LogListAdapter.java
src/com/owncloud/android/ui/adapter/SslCertificateViewAdapter.java
src/com/owncloud/android/ui/adapter/SslErrorViewAdapter.java
src/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java
src/com/owncloud/android/ui/dialog/ChangelogDialog.java
src/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java
src/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
src/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java
src/com/owncloud/android/ui/dialog/CredentialsDialogFragment.java
src/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java
src/com/owncloud/android/ui/dialog/LoadingDialog.java
src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java
src/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java
src/com/owncloud/android/ui/dialog/SamlWebViewDialog.java
src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java
src/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java
src/com/owncloud/android/ui/dialog/SslValidatorDialog.java
src/com/owncloud/android/ui/dialog/SsoWebView.java
src/com/owncloud/android/ui/fragment/AuthenticatorAccountDetailsFragment.java
src/com/owncloud/android/ui/fragment/AuthenticatorGetStartedFragment.java
src/com/owncloud/android/ui/fragment/ExtendedListFragment.java
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
src/com/owncloud/android/ui/fragment/FileFragment.java
src/com/owncloud/android/ui/fragment/LocalFileListFragment.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java
src/com/owncloud/android/ui/preview/FileDownloadFragment.java
src/com/owncloud/android/ui/preview/PreviewImageActivity.java
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
src/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java
src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
src/com/owncloud/android/ui/preview/PreviewVideoActivity.java
src/com/owncloud/android/utils/BitmapUtils.java
src/com/owncloud/android/utils/DisplayUtils.java
src/com/owncloud/android/utils/ErrorMessageAdapter.java
src/com/owncloud/android/utils/FileStorageUtils.java
src/com/owncloud/android/utils/OwnCloudSession.java
src/com/owncloud/android/utils/RecursiveFileObserver.java
src/com/owncloud/android/utils/TouchImageViewCustom.java [deleted file]
src/com/owncloud/android/utils/UriUtils.java
src/com/owncloud/android/widgets/ActionEditText.java
src/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java [new file with mode: 0644]
src/third_parties/in/srain/cube/lapache-2.0.txt [new file with mode: 0644]
src/third_parties/michaelOrtiz/TouchImageViewCustom.java [new file with mode: 0644]
tests/src/com/owncloud/android/test/AccountUtilsTest.java
user_manual/Makefile [new file with mode: 0644]
user_manual/android_app.rst [new file with mode: 0644]
user_manual/conf.py [new file with mode: 0644]
user_manual/images/android-downloads.png [new file with mode: 0644]
user_manual/images/android-file-list.png [new file with mode: 0644]
user_manual/images/android-file-options.png [new file with mode: 0644]
user_manual/images/android-file.png [new file with mode: 0644]
user_manual/images/android-files-page.png [new file with mode: 0644]
user_manual/images/android-first-screen.jpg [new file with mode: 0644]
user_manual/images/android-help.png [new file with mode: 0644]
user_manual/images/android-new-account.png [new file with mode: 0644]
user_manual/images/android-settings.png [new file with mode: 0644]
user_manual/images/android-ssl-cert.png [new file with mode: 0644]
user_manual/images/android-upload.png [new file with mode: 0644]
user_manual/index.rst [new file with mode: 0644]
user_manual/make.bat [new file with mode: 0644]
user_manual/ocdoc [new submodule]

index fa52fcd..38f0f58 100644 (file)
@@ -3,3 +3,7 @@
        path = owncloud-android-library
        url = git://github.com/owncloud/android-library.git
        branch = develop
+[submodule "ocdoc"]
+       path = user_manual/ocdoc
+       url = https://github.com/owncloud/documentation
+       branch = master
index fd92d3d..f0d1e9d 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2014 ownCloud Inc.
+  Copyright (C) 2012-2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
@@ -18,8 +18,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
 <manifest package="com.owncloud.android"
-    android:versionCode="10600200"
-    android:versionName="1.6.2" xmlns:android="http://schemas.android.com/apk/res/android">
+    android:versionCode="10700000"
+    android:versionName="1.7.0" xmlns:android="http://schemas.android.com/apk/res/android">
 
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />
@@ -86,9 +86,6 @@
             android:name=".ui.activity.Preferences"
             android:theme="@style/Theme.ownCloud" >
         </activity>
-        <activity android:name=".ui.activity.PreferencesNewSessionewSession" >
-        </activity>
-        
         <activity      
             android:name=".ui.preview.PreviewImageActivity" 
             />
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644 (file)
index 0000000..51d5242
--- /dev/null
@@ -0,0 +1,20 @@
+## 1.7.0 (19 February 2015)
+
+- Download full folders
+- Grid view for images
+- Remote thumbnails (OC Server 8.0+)
+- Added number of files and folders at the end of the list
+- "Open with" in contextual menu
+- Downloads added to Media Provider
+- Uploads:
+  + Local thumbnails in section "Files"
+  + Multiple selection in "Content from other apps" (Android 4.3+)
+- Gallery: 
+  + proper handling of EXIF
+  + obey sorting in the list of files
+- Settings view updated
+- Improved subjects in e-mails
+- Bugs fixed
+...
+
+
index 46308ac..57ec86e 100644 (file)
@@ -3,7 +3,7 @@ buildscript {
         mavenCentral()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:0.14.0'
+        classpath 'com.android.tools.build:gradle:1.0.0'
     }
 }
 
index 8d63f89..5a1c438 100644 (file)
@@ -1,6 +1,6 @@
-#Wed Oct 15 10:45:44 CEST 2014
+#Sun Jan 18 17:01:43 CET 2015
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
index 478e3c4..18ffb4c 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.owncloud.android.workaround.accounts"
-    android:versionCode="0100020"
-    android:versionName="1.0.20" >
+    android:versionCode="0100021"
+    android:versionName="1.0.21" >
 
     <uses-sdk
         android:minSdkVersion="16"
index 0bf5e1d..d4d347e 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 5a7c57e..6526f94 100644 (file)
@@ -1,5 +1,5 @@
 /* ownCloud Jelly Bean Workaround for lost credentials
- *   Copyright (C) 2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 8261865..0dd68c1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 8261865ff24c1bfc05be19ae9364a66dac8f26c3
+Subproject commit 0dd68c1f65c31bd716b2de26e644c87c98e9b9c2
index 8bb865d..5fd6f07 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 78bd62b..774c8d8 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 32b251b..c7920d3 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index f92b219..aff710a 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index 851f847..eec19be 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 951ca01..4054bcb 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 972a5b7..6e77a2f 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index 6016e00..800c583 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index fa0b6c9..f27627d 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index c330980..7de2c91 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 086eab3..e66e675 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index c96ea9a..4529965 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 4438ebf..1cb18e3 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 680e848..6647158 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index 773b51d..19bb0ef 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 35df55f..0c58f65 100644 (file)
Binary files a/res/drawable-hdpi/copy_link.png and b/res/drawable-hdpi/copy_link.png differ
index 1cb4d85..d95f724 100644 (file)
Binary files a/res/drawable-hdpi/ic_favorite.png and b/res/drawable-hdpi/ic_favorite.png differ
index 222172a..9ec18ce 100644 (file)
Binary files a/res/drawable-hdpi/shared_with_me.png and b/res/drawable-hdpi/shared_with_me.png differ
index a3c42a9..f4279f3 100644 (file)
Binary files a/res/drawable-hdpi/sharedlink.png and b/res/drawable-hdpi/sharedlink.png differ
index b3caf52..7384309 100644 (file)
Binary files a/res/drawable-ldpi/copy_link.png and b/res/drawable-ldpi/copy_link.png differ
index 4e2af28..6bac9b9 100644 (file)
Binary files a/res/drawable-mdpi/copy_link.png and b/res/drawable-mdpi/copy_link.png differ
index dead474..487b89d 100644 (file)
Binary files a/res/drawable-mdpi/ic_favorite.png and b/res/drawable-mdpi/ic_favorite.png differ
index 8300eac..0b17c76 100644 (file)
Binary files a/res/drawable-mdpi/shared_with_me.png and b/res/drawable-mdpi/shared_with_me.png differ
index 772838a..1d27294 100644 (file)
Binary files a/res/drawable-mdpi/sharedlink.png and b/res/drawable-mdpi/sharedlink.png differ
index c69eb05..45acfc4 100644 (file)
Binary files a/res/drawable-xhdpi/copy_link.png and b/res/drawable-xhdpi/copy_link.png differ
diff --git a/res/drawable-xhdpi/file.png b/res/drawable-xhdpi/file.png
new file mode 100644 (file)
index 0000000..d249e5f
Binary files /dev/null and b/res/drawable-xhdpi/file.png differ
diff --git a/res/drawable-xhdpi/file_doc.png b/res/drawable-xhdpi/file_doc.png
new file mode 100644 (file)
index 0000000..a8c10c8
Binary files /dev/null and b/res/drawable-xhdpi/file_doc.png differ
diff --git a/res/drawable-xhdpi/file_image.png b/res/drawable-xhdpi/file_image.png
new file mode 100644 (file)
index 0000000..84b2803
Binary files /dev/null and b/res/drawable-xhdpi/file_image.png differ
diff --git a/res/drawable-xhdpi/file_movie.png b/res/drawable-xhdpi/file_movie.png
new file mode 100644 (file)
index 0000000..bd84c72
Binary files /dev/null and b/res/drawable-xhdpi/file_movie.png differ
diff --git a/res/drawable-xhdpi/file_pdf.png b/res/drawable-xhdpi/file_pdf.png
new file mode 100644 (file)
index 0000000..e272562
Binary files /dev/null and b/res/drawable-xhdpi/file_pdf.png differ
diff --git a/res/drawable-xhdpi/file_ppt.png b/res/drawable-xhdpi/file_ppt.png
new file mode 100644 (file)
index 0000000..c898895
Binary files /dev/null and b/res/drawable-xhdpi/file_ppt.png differ
diff --git a/res/drawable-xhdpi/file_sound.png b/res/drawable-xhdpi/file_sound.png
new file mode 100644 (file)
index 0000000..82fbc7b
Binary files /dev/null and b/res/drawable-xhdpi/file_sound.png differ
diff --git a/res/drawable-xhdpi/file_xls.png b/res/drawable-xhdpi/file_xls.png
new file mode 100644 (file)
index 0000000..2e98d6c
Binary files /dev/null and b/res/drawable-xhdpi/file_xls.png differ
diff --git a/res/drawable-xhdpi/file_zip.png b/res/drawable-xhdpi/file_zip.png
new file mode 100644 (file)
index 0000000..28130ec
Binary files /dev/null and b/res/drawable-xhdpi/file_zip.png differ
diff --git a/res/drawable-xhdpi/folder_public.png b/res/drawable-xhdpi/folder_public.png
new file mode 100644 (file)
index 0000000..7680712
Binary files /dev/null and b/res/drawable-xhdpi/folder_public.png differ
index c187f0c..8a777a4 100644 (file)
Binary files a/res/drawable-xhdpi/ic_favorite.png and b/res/drawable-xhdpi/ic_favorite.png differ
diff --git a/res/drawable-xhdpi/ic_menu_archive.png b/res/drawable-xhdpi/ic_menu_archive.png
new file mode 100644 (file)
index 0000000..3ee6028
Binary files /dev/null and b/res/drawable-xhdpi/ic_menu_archive.png differ
index 3879663..ef7779c 100644 (file)
Binary files a/res/drawable-xhdpi/shared_with_me.png and b/res/drawable-xhdpi/shared_with_me.png differ
diff --git a/res/drawable-xhdpi/shared_with_me_folder.png b/res/drawable-xhdpi/shared_with_me_folder.png
new file mode 100644 (file)
index 0000000..060728c
Binary files /dev/null and b/res/drawable-xhdpi/shared_with_me_folder.png differ
index 9ef8f3e..11f8afa 100644 (file)
Binary files a/res/drawable-xhdpi/sharedlink.png and b/res/drawable-xhdpi/sharedlink.png differ
index dd27833..25fcd40 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index 0b0a399..ec8ccee 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1a47be5..a9d8cdc 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index bc138c7..ab90d28 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 7c49554..e735542 100644 (file)
Binary files a/res/drawable/downloading_file_indicator.png and b/res/drawable/downloading_file_indicator.png differ
index e0e86b3..7d193c3 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 8cd82e4..f3544df 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1233647..d1ce788 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 99219b6..b449e7f 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1e53367..bc9cdbd 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 9170782..fa357c2 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
@@ -32,7 +32,7 @@
         android:orientation="horizontal" >\r
         \r
                <ImageView\r
-                       android:id="@+id/imageView1"\r
+                       android:id="@+id/thumbnail"\r
                        android:layout_width="0dp"\r
                        android:layout_height="wrap_content"\r
                        android:layout_weight="1"\r
index 95c7dfc..a85c3ee 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2014 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index f4d4fab..c67b9a9 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 
     ownCloud Android client application
-    Copyright (C) 2014 ownCloud Inc.
+    Copyright (C) 2015 ownCloud Inc.
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2,
index fcf5429..bd4b0b6 100644 (file)
@@ -2,7 +2,7 @@
 <!-- 
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1e58764..1f712ee 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
@@ -35,7 +35,7 @@
         android:padding="8dp" >\r
 \r
         <ImageView\r
-            android:id="@+id/imageView1"\r
+            android:id="@+id/thumbnail"\r
             android:layout_width="match_parent"\r
             android:layout_height="wrap_content"\r
             android:layout_marginBottom="10dp"\r
index 0951958..940c3bc 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index b917600..9297bcd 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2014 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 500945b..875a40c 100644 (file)
@@ -3,7 +3,7 @@
     ownCloud Android client application
 
     Copyright (C) 2012  Bartek Przybylski
-    Copyright (C) 2012-2013 ownCloud Inc.
+    Copyright (C) 2015 ownCloud Inc.
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2,
index 56438e9..5d16b07 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index db41532..93983c2 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 8f571dc..0494b8a 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013  ownCloud Inc.
+  Copyright (C) 2015  ownCloud Inc.
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
   as published by the Free Software Foundation.
index 483a369..d371e10 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013  ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 50bc105..5d62c13 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index 6db8377..0b11589 100644 (file)
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
+    <!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
index 183f926..e684397 100644 (file)
@@ -2,7 +2,7 @@
 <!-- 
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
diff --git a/res/layout/grid_image.xml b/res/layout/grid_image.xml
new file mode 100644 (file)
index 0000000..383c615
--- /dev/null
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+  ownCloud Android client application\r
+  Copyright (C) 2015 ownCloud Inc.\r
+\r
+  This program is free software: you can redistribute it and/or modify\r
+  it under the terms of the GNU General Public License version 2,\r
+  as published by the Free Software Foundation.\r
+\r
+  This program is distributed in the hope that it will be useful,\r
+  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+  GNU General Public License for more details.\r
+\r
+  You should have received a copy of the GNU General Public License\r
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+  \r
+-->\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/ListItemLayout"\r
+    android:layout_width="match_parent"\r
+    android:layout_height="match_parent"\r
+    android:layout_gravity="center_horizontal"\r
+    android:background="@drawable/list_selector"\r
+    android:gravity="center_horizontal"\r
+    android:orientation="vertical" >\r
+\r
+    <FrameLayout\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content" >\r
+\r
+        <com.owncloud.android.ui.SquareImageView\r
+            android:id="@+id/thumbnail"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="match_parent"\r
+            android:paddingLeft="10dp"\r
+            android:paddingRight="10dp"\r
+            android:scaleType="centerCrop"\r
+            android:src="@drawable/ic_menu_archive"/>\r
+\r
+        <LinearLayout\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="top|right"\r
+            android:orientation="vertical"\r
+            android:layout_margin="4dp">\r
+\r
+            <ImageView\r
+                android:id="@+id/sharedIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="center"\r
+                android:layout_marginBottom="4dp"\r
+                android:src="@drawable/sharedlink" />\r
+\r
+            <ImageView\r
+                android:id="@+id/sharedWithMeIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="center"\r
+                android:layout_marginTop="4dp"\r
+                android:src="@drawable/shared_with_me"\r
+                android:visibility="invisible" />\r
+        </LinearLayout>\r
+\r
+        <ImageView\r
+            android:id="@+id/localFileIndicator"\r
+            android:layout_width="@dimen/file_icon_size"\r
+            android:layout_height="@dimen/file_icon_size"\r
+            android:layout_gravity="bottom|right"\r
+            android:layout_marginTop="4dp"\r
+            android:layout_marginBottom="4dp"\r
+            android:layout_marginRight="4dp"\r
+            android:src="@drawable/local_file_indicator" />\r
+\r
+        <ImageView\r
+            android:id="@+id/favoriteIcon"\r
+            android:layout_width="15dp"\r
+            android:layout_height="15dp"\r
+            android:layout_gravity="bottom|right"\r
+            android:layout_marginBottom="4dp"\r
+            android:layout_marginRight="4dp"\r
+            android:src="@drawable/ic_favorite" />\r
+    </FrameLayout>\r
+\r
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/grid_item.xml b/res/layout/grid_item.xml
new file mode 100644 (file)
index 0000000..d0f3d0f
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+  ownCloud Android client application\r
+  Copyright (C) 2015 ownCloud Inc.\r
+\r
+  This program is free software: you can redistribute it and/or modify\r
+  it under the terms of the GNU General Public License version 2,\r
+  as published by the Free Software Foundation.\r
+\r
+  This program is distributed in the hope that it will be useful,\r
+  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+  GNU General Public License for more details.\r
+\r
+  You should have received a copy of the GNU General Public License\r
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+  \r
+-->\r
+<com.owncloud.android.ui.SquareLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/ListItemLayout"\r
+    android:layout_width="match_parent"\r
+    android:layout_height="match_parent"\r
+    android:layout_gravity="center_horizontal"\r
+    android:background="@drawable/list_selector"\r
+    android:gravity="center"\r
+    android:orientation="vertical" >\r
+\r
+    <FrameLayout\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_gravity="center_horizontal" >\r
+\r
+        <ImageView\r
+            android:id="@+id/thumbnail"\r
+            android:layout_width="72dp"\r
+            android:layout_height="72dp"\r
+            android:layout_gravity="center_horizontal"\r
+            android:layout_marginLeft="10dp"\r
+            android:layout_marginRight="10dp"\r
+            android:src="@drawable/ic_menu_archive" />\r
+\r
+        <LinearLayout\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="top|right"\r
+            android:orientation="vertical"\r
+            android:layout_margin="2dp">\r
+\r
+            <ImageView\r
+                android:id="@+id/sharedIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="center"\r
+                android:layout_marginBottom="2dp"\r
+                android:src="@drawable/sharedlink" />\r
+\r
+            <ImageView\r
+                android:id="@+id/sharedWithMeIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="center"\r
+                android:layout_marginTop="2dp"\r
+                android:src="@drawable/shared_with_me"\r
+                android:visibility="invisible" />\r
+        </LinearLayout>\r
+\r
+        <ImageView\r
+            android:id="@+id/localFileIndicator"\r
+            android:layout_width="@dimen/file_icon_size"\r
+            android:layout_height="@dimen/file_icon_size"\r
+            android:layout_gravity="bottom|right"\r
+            android:layout_marginTop="2dp"\r
+            android:layout_marginRight="2dp"\r
+            android:src="@drawable/local_file_indicator" />\r
+\r
+        <ImageView\r
+            android:id="@+id/favoriteIcon"\r
+            android:layout_width="15dp"\r
+            android:layout_height="15dp"\r
+            android:layout_gravity="bottom|right"\r
+            android:layout_marginBottom="2dp"\r
+            android:layout_marginRight="2dp"\r
+            android:src="@drawable/ic_favorite" />\r
+\r
+\r
+\r
+    </FrameLayout>\r
+\r
+    <TextView\r
+        android:id="@+id/Filename"\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_marginLeft="4dp"\r
+        android:layout_marginRight="4dp"\r
+        android:ellipsize="middle"\r
+        android:gravity="center_horizontal"\r
+        android:singleLine="true"\r
+        android:text="TextView"\r
+        android:textColor="@color/textColor"\r
+        android:textSize="16dip" />\r
+\r
+</com.owncloud.android.ui.SquareLinearLayout>
\ No newline at end of file
index 160edc1..81b5210 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- 
+<!--
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- -->
+-->
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-       android:layout_width="0dp"
-       android:layout_height="match_parent"
-       android:layout_weight="1" >
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_weight="1" >
 
     <android.support.v4.widget.SwipeRefreshLayout
-        android:id="@+id/swipe_refresh_files"
+        android:id="@+id/swipe_containing_list"
         android:layout_width="match_parent"
         android:layout_height="match_parent" 
         android:layout_weight="1"
-        android:footerDividersEnabled="false" > 
+        android:footerDividersEnabled="false"
+        android:visibility="visible" >
         
         <com.owncloud.android.ui.ExtendedListView
             android:id="@+id/list_root"
             android:layout_width="match_parent"
-            android:layout_height="match_parent" />
-            
+            android:layout_height="match_parent"
+            android:visibility="visible" />
+
     </android.support.v4.widget.SwipeRefreshLayout>
-       
-       <android.support.v4.widget.SwipeRefreshLayout
-        android:id="@+id/swipe_refresh_files_emptyView"
+
+    <android.support.v4.widget.SwipeRefreshLayout
+        android:id="@+id/swipe_containing_grid"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:footerDividersEnabled="false"
         android:visibility="gone" >
 
-        <ScrollView
+        <third_parties.in.srain.cube.GridViewWithHeaderAndFooter
+            android:id="@+id/grid_root"
             android:layout_width="match_parent"
-            android:layout_height="match_parent" >
-
-                   <TextView
-                               android:id="@+id/empty_list_view"
-                               android:layout_width="match_parent"
-                               android:layout_height="wrap_content"
-                               android:gravity="center_vertical|center_horizontal"
-                               android:text="@string/empty"
-                                       android:layout_gravity="center"
-                               android:visibility="visible" />
-
-        </ScrollView>
+            android:layout_height="match_parent"
+            android:columnWidth="100dp"
+            android:gravity="center"
+            android:horizontalSpacing="2dp"
+            android:stretchMode="columnWidth"
+            android:verticalSpacing="2dp"
+            android:visibility="visible" />
+
+    </android.support.v4.widget.SwipeRefreshLayout>
+
+    <android.support.v4.widget.SwipeRefreshLayout
+        android:id="@+id/swipe_containing_empty"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:visibility="gone" >
+            <ScrollView
+                android:layout_width="match_parent"
+                android:layout_height="match_parent" >
+                <TextView
+                    android:id="@+id/empty_list_view"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:gravity="center_vertical|center_horizontal"
+                    android:text="@string/empty"
+                    android:visibility="visible" />
+            </ScrollView>
     </android.support.v4.widget.SwipeRefreshLayout>
-</FrameLayout>
+
+</FrameLayout>
\ No newline at end of file
index c6c7b92..c66ff73 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
  -->\r
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
     android:id="@+id/ListItemLayout"\r
-    android:layout_width="fill_parent"\r
+    android:layout_width="match_parent"\r
     android:background="@drawable/list_selector"\r
-    android:orientation="horizontal"\r
+    android:orientation="vertical"\r
     android:layout_height="56dp">\r
 \r
-    <FrameLayout\r
-        android:layout_width="56dp"\r
-        android:layout_height="56dp"\r
-        android:focusable="false"\r
-        android:focusableInTouchMode="false">\r
-\r
-        <ImageView\r
-            android:id="@+id/imageView2"\r
-            android:layout_width="@dimen/file_icon_size"\r
-            android:layout_height="@dimen/file_icon_size"\r
-            android:layout_gravity="center_vertical"\r
-            android:layout_marginLeft="22dp"\r
-            android:src="@drawable/local_file_indicator" />\r
-\r
-        <ImageView\r
-            android:id="@+id/imageView1"\r
-            android:layout_width="@dimen/file_icon_size"\r
-            android:layout_height="@dimen/file_icon_size"\r
-            android:layout_gravity="center_vertical"\r
-            android:layout_marginLeft="9dp"\r
-            android:src="@drawable/ic_menu_archive" />\r
-\r
-        <ImageView\r
-            android:id="@+id/imageView3"\r
-            android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content"\r
-            android:layout_gravity="bottom|right"\r
-            android:layout_marginBottom="10dp"\r
-            android:layout_marginRight="2dp"\r
-            android:src="@drawable/ic_favorite" />\r
-    </FrameLayout>\r
-\r
     <LinearLayout\r
-        android:layout_width="0dp"\r
+        android:layout_width="match_parent"\r
         android:layout_height="match_parent"\r
-        android:layout_weight="1"\r
-        android:gravity="center_vertical"\r
-        android:orientation="vertical" >\r
-\r
-        <TextView\r
-            android:id="@+id/Filename"\r
-            android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content"\r
-            android:layout_gravity="center_vertical"\r
-            android:layout_marginLeft="4dp"\r
-            android:layout_marginRight="4dp"\r
-            android:ellipsize="middle"\r
-            android:singleLine="true"\r
-            android:text="TextView"\r
-            android:textColor="#303030"\r
-            android:textSize="16dip" />\r
+        android:orientation="horizontal">\r
+\r
+        <FrameLayout\r
+            android:layout_width="56dp"\r
+            android:layout_height="56dp"\r
+            android:focusable="false"\r
+            android:focusableInTouchMode="false">\r
+\r
+            <ImageView\r
+                android:id="@+id/localFileIndicator"\r
+                android:layout_width="@dimen/file_icon_size"\r
+                android:layout_height="@dimen/file_icon_size"\r
+                android:layout_gravity="center_vertical"\r
+                android:layout_marginLeft="22dp"\r
+                android:src="@drawable/local_file_indicator" />\r
+\r
+            <ImageView\r
+                android:id="@+id/thumbnail"\r
+                android:layout_width="@dimen/file_icon_size"\r
+                android:layout_height="@dimen/file_icon_size"\r
+                android:layout_gravity="center_vertical"\r
+                android:layout_marginLeft="9dp"\r
+                android:src="@drawable/ic_menu_archive" />\r
+\r
+            <ImageView\r
+                android:id="@+id/favoriteIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="bottom|right"\r
+                android:layout_marginBottom="10dp"\r
+                android:layout_marginRight="2dp"\r
+                android:src="@drawable/ic_favorite" />\r
+        </FrameLayout>\r
 \r
         <LinearLayout\r
-            android:layout_width="match_parent"\r
-            android:layout_height="wrap_content"\r
-            android:layout_marginLeft="4dp"\r
-            android:layout_marginRight="4dp"\r
-            android:weightSum="1">\r
+            android:layout_width="0dp"\r
+            android:layout_height="match_parent"\r
+            android:layout_weight="1"\r
+            android:gravity="center_vertical"\r
+            android:orientation="vertical" >\r
 \r
             <TextView\r
-                android:id="@+id/last_mod"\r
+                android:id="@+id/Filename"\r
                 android:layout_width="wrap_content"\r
                 android:layout_height="wrap_content"\r
+                android:layout_gravity="center_vertical"\r
+                android:layout_marginLeft="4dp"\r
+                android:layout_marginRight="4dp"\r
+                android:ellipsize="middle"\r
+                android:singleLine="true"\r
                 android:text="TextView"\r
-                android:layout_weight=".5"\r
-                android:textColor="@color/list_item_lastmod_and_filesize_text"\r
-                android:textSize="12dip"/>\r
+                android:textColor="#303030"\r
+                android:textSize="16dip" />\r
 \r
-            <TextView\r
-                android:id="@+id/file_size"\r
-                android:layout_width="wrap_content"\r
+            <LinearLayout\r
+                android:layout_width="match_parent"\r
                 android:layout_height="wrap_content"\r
-                android:gravity="right"\r
-                android:text="TextView"\r
-                android:textColor="@color/list_item_lastmod_and_filesize_text"\r
-                android:layout_weight=".5"\r
-                android:textSize="12dip"/>\r
+                android:layout_marginLeft="4dp"\r
+                android:layout_marginRight="4dp"\r
+                android:weightSum="1">\r
+\r
+                <TextView\r
+                    android:id="@+id/last_mod"\r
+                    android:layout_width="wrap_content"\r
+                    android:layout_height="wrap_content"\r
+                    android:text="TextView"\r
+                    android:layout_weight=".5"\r
+                    android:textColor="@color/list_item_lastmod_and_filesize_text"\r
+                    android:textSize="12dip"/>\r
+\r
+                <TextView\r
+                    android:id="@+id/file_size"\r
+                    android:layout_width="wrap_content"\r
+                    android:layout_height="wrap_content"\r
+                    android:gravity="right"\r
+                    android:text="TextView"\r
+                    android:textColor="@color/list_item_lastmod_and_filesize_text"\r
+                    android:layout_weight=".5"\r
+                    android:textSize="12dip"/>\r
+\r
+            </LinearLayout>\r
 \r
         </LinearLayout>\r
 \r
-    </LinearLayout>\r
+        <LinearLayout\r
+            android:layout_width="25dp"\r
+            android:layout_height="match_parent"\r
+            android:gravity="center_vertical"\r
+            android:orientation="vertical">\r
 \r
-    <LinearLayout\r
-        android:layout_width="25dp"\r
-        android:layout_height="match_parent"\r
-        android:gravity="center_vertical"\r
-        android:orientation="vertical">\r
-\r
-    <ImageView\r
-        android:id="@+id/sharedIcon"\r
-        android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content"\r
-        android:layout_gravity="center"\r
-        android:layout_marginLeft="4dp"\r
-        android:layout_marginBottom="4dp"\r
-        android:layout_marginRight="4dp"\r
-        android:src="@drawable/sharedlink" />\r
-\r
-    <ImageView\r
-        android:id="@+id/sharedWithMeIcon"\r
-        android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content"\r
-        android:layout_gravity="center"\r
-        android:layout_marginLeft="4dp"\r
-        android:layout_marginRight="4dp"\r
-        android:layout_marginTop="4dp"\r
-        android:src="@drawable/shared_with_me" />\r
+            <ImageView\r
+                android:id="@+id/sharedIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="center"\r
+                android:layout_marginLeft="4dp"\r
+                android:layout_marginBottom="4dp"\r
+                android:layout_marginRight="4dp"\r
+                android:src="@drawable/sharedlink" />\r
+\r
+            <ImageView\r
+                android:id="@+id/sharedWithMeIcon"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="center"\r
+                android:layout_marginLeft="4dp"\r
+                android:layout_marginRight="4dp"\r
+                android:layout_marginTop="4dp"\r
+                android:src="@drawable/shared_with_me"\r
+                android:visibility="invisible" />\r
 \r
+        </LinearLayout>\r
+\r
+        <ImageView\r
+            android:id="@+id/custom_checkbox"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_vertical"\r
+            android:layout_marginLeft="4dp"\r
+            android:layout_marginRight="4dp"\r
+            android:gravity=""\r
+            android:src="@android:drawable/checkbox_off_background" />\r
     </LinearLayout>\r
 \r
-    <ImageView\r
-        android:id="@+id/custom_checkbox"\r
-        android:layout_width="wrap_content"\r
-        android:layout_height="wrap_content"\r
-        android:layout_gravity="center_vertical"\r
-        android:layout_marginLeft="4dp"\r
-        android:layout_marginRight="4dp"\r
-        android:gravity=""\r
-        android:src="@android:drawable/checkbox_off_background" />\r
+    <View\r
+        android:layout_width="match_parent"\r
+        android:layout_height="1dp"\r
+        android:background="@color/list_divider_background"></View>\r
 \r
 </LinearLayout>\r
index 629d8e2..0dbb9ef 100644 (file)
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/loadingLayout"
     android:layout_width="match_parent"
index d9326ff..2353b19 100644 (file)
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
index 6f129eb..756a2ed 100644 (file)
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
index f308edc..27900c4 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013  ownCloud Inc.
+  Copyright (C) 2015  ownCloud Inc.
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1df31dc..ae2dbfa 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 
     ownCloud Android client application
-    Copyright (C) 2014 ownCloud Inc.
+    Copyright (C) 2015 ownCloud Inc.
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2,
index b2cf5df..8c95c72 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
@@ -34,7 +34,8 @@
         android:textColor="@android:color/black"\r
         android:gravity="center_horizontal"\r
          />\r
-\r    <TextView\r
+\r
+    <TextView\r
         android:id="@+id/pinHdrExpl"\r
         android:layout_width="wrap_content"\r
         android:layout_height="wrap_content"\r
index ad0676b..52dadd7 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application\r
 \r
   Copyright (C) 2012  Bartek Przybylski\r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
index d712b7f..9baf6c2 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013  ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 9467d34..611351b 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013  ownCloud Inc.
+  Copyright (C) 2015  ownCloud Inc.
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
@@ -43,7 +43,7 @@
         android:layout_centerInParent="true"
         />
     
-    <com.owncloud.android.utils.TouchImageViewCustom
+    <third_parties.michaelOrtiz.TouchImageViewCustom
         android:id="@+id/image"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
index 6a30c2e..813d677 100644 (file)
@@ -2,7 +2,7 @@
 <!-- 
     ownCloud Android client application
 
-    Copyright (C) 2012-2013 ownCloud Inc.
+    Copyright (C) 2015 ownCloud Inc.
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2,
index 27204a2..f3153b3 100644 (file)
@@ -2,7 +2,7 @@
 <!-- 
     ownCloud Android client application
 
-    Copyright (C) 2012-2013 ownCloud Inc.
+    Copyright (C) 2015 ownCloud Inc.
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2,
index ccfb04b..652acb4 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 6c15ff7..42bdcdd 100644 (file)
@@ -2,7 +2,7 @@
 <!-- \r
   ownCloud Android client application\r
 \r
-  Copyright (C) 2012-2013 ownCloud Inc.\r
+  Copyright (C) 2015 ownCloud Inc.\r
 \r
   This program is free software: you can redistribute it and/or modify\r
   it under the terms of the GNU General Public License version 2,\r
     android:layout_height="fill_parent"\r
     android:background="@color/background_color"\r
     android:orientation="vertical" >\r
-
+\r
     <fragment\r
         android:id="@+id/local_files_list"\r
         android:layout_width="match_parent"\r
         android:layout_height="0dip"\r
         android:layout_weight="1"\r
         class="com.owncloud.android.ui.fragment.LocalFileListFragment" />\r
-
+\r
     <LinearLayout\r
         android:layout_width="match_parent"\r
         android:layout_height="wrap_content"\r
         android:gravity="center"\r
         android:orientation="horizontal" >\r
-\r        <Button\r
+\r
+        <Button\r
             android:id="@+id/upload_files_btn_cancel"\r
             android:layout_width="wrap_content"\r
             android:layout_height="wrap_content"\r
             android:layout_weight="1"\r
             android:text="@string/common_cancel" />\r
-\r              <Button\r
+\r
+               <Button\r
                    android:id="@+id/upload_files_btn_upload"\r
                    android:layout_width="wrap_content"\r
                    android:layout_height="wrap_content"\r
index ff27429..b618263 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1cb9361..e093269 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
@@ -30,7 +30,7 @@
         android:layout_gravity="center_vertical|center"
         android:layout_margin="4dp"
         android:src="@drawable/ic_menu_archive" 
-        android:id="@+id/imageView1" />
+        android:id="@+id/thumbnail" />
     
     <TextView 
         android:text="TextView" 
index 8063ab4..ac0ca6a 100644 (file)
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <FrameLayout   xmlns:android="http://schemas.android.com/apk/res/android"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent" >
index b7e2dd3..df83e37 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index b60d542..545f8ea 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 0705601..d35eba0 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index a54a664..d651120 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
 -->
        <body>
        <p>
-               Dieses Gerät läuft mit Android 4.1.x.
+               Dieses Ger�t l�uft mit Android 4.1.x.
        </p>
        <p>
-               In dieser Version von Android existiert ein Bug, der nach jedem Neustart eine erneute Eingabe der ownCloud Login-Informationen nötig macht. Um das zu umgehen installieren Sie bitte diese kostenlose Hilfs-App: 
+               In dieser Version von Android existiert ein Bug, der nach jedem Neustart eine erneute Eingabe der ownCloud Login-Informationen ntig macht. Um das zu umgehen installieren Sie bitte diese kostenlose Hilfs-App: 
        </p>
        <p style="text-align:center">
                <a href="http://play.google.com/store/apps/details?id=com.owncloud.android.workaround.accounts">ownCloud Jelly Bean Workaround</a> 
index 9321d52..e8f0e77 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
@@ -21,7 +21,7 @@
                Su dispositivo ejecuta Android 4.1.x. 
        </p>
        <p>
-               Para prevenir la pérdida de las credenciales de sus cuentas ownCloud en cada reinicio, por favor, instale esta app gratuita que evita el problema en Jelly Bean:        
+               Para prevenir la p�rdida de las credenciales de sus cuentas ownCloud en cada reinicio, por favor, instale esta app gratuita que evita el problema en Jelly Bean:      
        </p>
        <p style="text-align:center">
                <a href="http://play.google.com/store/apps/details?id=com.owncloud.android.workaround.accounts">ownCloud Jelly Bean Workaround</a>
index 754cf6f..fd5a20d 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 5134014..49d6c3c 100644 (file)
   <string name="file_list_seconds_ago">منذ ثواني</string>
   <string name="file_list_empty">لا يوجد شيء هنا. إرفع بعض الملفات!</string>
   <string name="file_list_loading">جاري التحميل ...</string>
+  <string name="file_list_folder">مجلد</string>
+  <string name="file_list_folders">مجلدات</string>
+  <string name="file_list_file">ملف</string>
+  <string name="file_list_files">ملفات</string>
   <string name="filedetails_select_file">اضغظ على الملف ليتم عرض خيارات أكثر</string>
   <string name="filedetails_size">الحجم :</string>
   <string name="filedetails_type">النوع :</string>
index d3a9060..c6c8f69 100644 (file)
   <string name="actionbar_settings">Quraşdırmalar</string>
   <string name="actionbar_see_details">Detallar</string>
   <string name="actionbar_send_file">Göndər</string>
+  <string name="actionbar_sort">Çeşidləmək</string>
+  <string name="actionbar_sort_title">Təyinata görə çeşidləmək </string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Yenisi - Köhnəsi</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Ümumi</string>
@@ -32,6 +38,8 @@
   <string name="prefs_recommend">Dostuna məsləhət gör</string>
   <string name="prefs_feedback">Geriyə cavab</string>
   <string name="prefs_imprint">İşarələmək</string>
+  <string name="prefs_remember_last_share_location">Paylaşma ünvanını yadda saxla</string>
+  <string name="prefs_remember_last_upload_location_summary">Son paylaşılmış yüklənmə ünvanını yadda saxla</string>
   <string name="recommend_subject">%1$s-i ağıllı telefonunuzda yoxlayın!</string>
   <string name="recommend_text">Mən sizi öz smartfonunuzda %1$s istifadə etmək üçün dəvət etmək istəyirəm! Burdan endirin: %2$s</string>
   <string name="auth_check_server">Serveri yoxla</string>
   <string name="uploader_wrn_no_content_text">Heç bir kontent gəlmədi. Yukləmək üçün heçnə yoxdur.</string>
   <string name="uploader_error_forbidden_content">%1$s yayımlanmış kontent üçün yetkili deyil</string>
   <string name="uploader_info_uploading">Yüklənmə gedir</string>
+  <string name="file_list_seconds_ago">saniyələr öncə</string>
   <string name="file_list_empty">Burda heçnə yoxdur. Nese yükləyin!</string>
   <string name="file_list_loading">Yüklənir...</string>
   <string name="local_file_list_empty">Bu qovluqda heç bir fayl movcud deyil.</string>
+  <string name="file_list_folder">qovluq</string>
+  <string name="file_list_folders">qovluqlar</string>
+  <string name="file_list_file">fayl</string>
+  <string name="file_list_files">fayllar</string>
   <string name="filedetails_select_file">Faylın üstünə sıxın ki, əlavə məlumat ekrana çıxsın.</string>
   <string name="filedetails_size">Həcm:</string>
   <string name="filedetails_type">Tip:</string>
@@ -177,6 +190,7 @@ Aşağıda göstərilən %5$s-də olan daxili və xarici fayl(lar) link edilmiş
   <string name="auth_unsupported_multiaccount">%1$s çoxlu hesab dəstəkləmir</string>
   <string name="auth_fail_get_user_name">Sizin server düzgün istifadəçi id-si qaytarmır, xahiş olunur inzibatçı ilə əlaqə saxlayasınız</string>
   <string name="auth_can_not_auth_against_server">Bu serverdə yenidən qeydiyyatdan keçmək olmur</string>
+  <string name="auth_account_does_not_exist">Hesab göstərilən avadanlıqda mövcud deyil</string>
   <string name="fd_keep_in_sync">Faylı gündəmdə saxla</string>
   <string name="common_rename">Adı dəyiş</string>
   <string name="common_remove">Sil</string>
@@ -206,18 +220,88 @@ Aşağıda göstərilən %5$s-də olan daxili və xarici fayl(lar) link edilmiş
   <string name="ssl_validator_reason_cert_not_trusted">Server sertifikati inamlı deyil</string>
   <string name="ssl_validator_reason_cert_expired">- Server sertifikatının vaxtı bitmişdir</string>
   <string name="ssl_validator_reason_cert_not_yet_valid">- Server sertifikatının düzgün tarixi gələcəkdədir</string>
+  <string name="ssl_validator_reason_hostname_not_verified">URL sertifikatda olan host adına uyğun deyil</string>
+  <string name="ssl_validator_question">İstənilən halda bu sertifikata inanmaq istəyirsinizmi?</string>
+  <string name="ssl_validator_not_saved">Sertifikat saxlanıla bilməz</string>
   <string name="ssl_validator_btn_details_see">Detallar</string>
+  <string name="ssl_validator_btn_details_hide">Gizlə</string>
+  <string name="ssl_validator_label_subject">Verilir:</string>
+  <string name="ssl_validator_label_issuer">Tərəfindən verilib:</string>
+  <string name="ssl_validator_label_CN">Ümumi ad:</string>
+  <string name="ssl_validator_label_O">Təşkilat:</string>
+  <string name="ssl_validator_label_OU">Alt təşkilatOrganizational unit:</string>
+  <string name="ssl_validator_label_C">Ölkə:</string>
+  <string name="ssl_validator_label_ST">Dövlət:</string>
+  <string name="ssl_validator_label_L">Ərazi:</string>
+  <string name="ssl_validator_label_validity">Etibarlılıq:</string>
+  <string name="ssl_validator_label_validity_from">Kimdən:</string>
+  <string name="ssl_validator_label_validity_to">Kimə:</string>
+  <string name="ssl_validator_label_signature">İmza:</string>
+  <string name="ssl_validator_label_signature_algorithm">Alqıritm:</string>
+  <string name="ssl_validator_null_cert">Sertifikat görünə bilməz.</string>
+  <string name="ssl_validator_no_info_about_error">- Səhv haqqında məlumat yoxdur</string>
+  <string name="placeholder_sentence">Bu bir yer doldurucusudur</string>
+  <string name="placeholder_filename">yerdoldurucusu.txt</string>
+  <string name="placeholder_filetype">PNG Şəkil</string>
+  <string name="placeholder_filesize">389 KB</string>
+  <string name="placeholder_timestamp">2012/05/18 12:23</string>
+  <string name="placeholder_media_time">12:23:45</string>
+  <string name="instant_upload_on_wifi">Şəkilləri yalnız WiFi üzərindən yüklə</string>
+  <string name="instant_video_upload_on_wifi">Videoları yalnız WiFi üzərindən yüklə</string>
+  <string name="instant_upload_path">/CəldYükləmə</string>
+  <string name="conflict_title">Yüklənmə konflikti</string>
+  <string name="conflict_message">Uzaq fayl %s local faylla sinxronizasiya edilmədi. Faylın kontentinin serverdə dəyişdirilməsinə davam edirik.</string>
+  <string name="conflict_keep_both">Birlikdə saxla</string>
+  <string name="conflict_overwrite">Sil yenidən yaz</string>
+  <string name="conflict_dont_upload">Yükləmə</string>
+  <string name="preview_image_description">Şəkili göstər</string>
+  <string name="preview_image_error_unknown_format">Bu şəkil göstərilə bilməz</string>
+  <string name="error__upload__local_file_not_copied">%1$s nüsxələnə bilməz %2$s local qovluğa</string>
+  <string name="prefs_instant_upload_path_title">Yüklənmə ünvanı</string>
+  <string name="share_link_no_support_share_api">Üzr istəyirik, sizin yerverdə paylaşıma izin verilmir. Xahiş olunur
+inzibatçınızla əlaqə saxlayasınız.</string>
+  <string name="share_link_file_no_exist">Paylaşa bilinmir.</string>
+  <string name="share_link_file_error">Bu faylın yada qovluğun paylaşımı zamanı səhv baş verdi </string>
+  <string name="unshare_link_file_no_exist">Paylaşımı dayandırmaq olmur. Xahiş olunur fayl mövcudluğunu yoxlayasınız</string>
   <string name="unshare_link_file_error">Bu fayl və ya qovluğun yayımlanmasının dayandırılmasında səhv baş verdi</string>
   <string name="activity_chooser_send_file_title">Göndər</string>
   <string name="copy_link">linki nüsxələ</string>
   <string name="clipboard_text_copied">Mübadilə buferinə nüsxələndi</string>
+  <string name="error_cant_bind_to_operations_service">Kritik səhv: əməliyyat yerinə yetirilə bilinmir</string>
+  <string name="network_error_socket_exception">Serverlə əlaqəyə girdikdə səhv baş verdi.</string>
+  <string name="network_error_socket_timeout_exception">Serveri gözlədiyimiz müddətdə səhv baş verdi, əməliyyat bitə bilməz</string>
+  <string name="network_error_connect_timeout_exception">Serveri gözlədiyimiz müddətdə səhv baş verdi, əməliyyat bitə bilməz</string>
+  <string name="network_host_not_available">Əməliyyat bitə bilməz, serverə çatmaq mümkün deyil </string>
   <string name="empty"></string>
   <string name="forbidden_permissions">Sizin yetkiniz yoxdur %s</string>
+  <string name="forbidden_permissions_rename">faylın adını dəyişmək</string>
   <string name="forbidden_permissions_delete">bu faylı silmək üçün</string>
   <string name="share_link_forbidden_permissions">bu faylı yayımlamaq üçün</string>
+  <string name="unshare_link_forbidden_permissions">fayl paylaşımını dayandırmaq</string>
   <string name="forbidden_permissions_create">fayl yaratmaq üçün</string>
   <string name="uploader_upload_forbidden_permissions">bu qovluğa yükləmək üçün</string>
+  <string name="downloader_download_file_not_found">Bu fayla serverdə artıq uzun müddətdir ki, çatmaq mümkün deyil</string>
   <string name="prefs_category_accounts">Hesablar</string>
   <string name="prefs_add_account">Hesab əlavə et</string>
+  <string name="auth_redirect_non_secure_connection_title">Təhlükəsiz qoşulma, təhlükəsiz olmayan istiqamətə yönlədirilmişdir</string>
+  <string name="actionbar_logger">Jurnallar</string>
+  <string name="log_send_history_button">Tarixçəni göndər</string>
+  <string name="log_send_no_mail_app">Jurnalların ötürülməsi üçün proqram təminatı tapılmadı!</string>
+  <string name="log_send_mail_subject">%1$s Android proqram jurnalları</string>
+  <string name="log_progress_dialog_text">Data yüklənir...</string>
+  <string name="saml_authentication_required_text">Qeydiyyat tələb edilir</string>
   <string name="saml_authentication_wrong_pass">Yalnış şifrə</string>
+  <string name="actionbar_move">Köçürmək</string>
+  <string name="file_list_empty_moving">Burda heçnə yoxdur. Siz qovluq əlavə edə bilərsiniz!</string>
+  <string name="folder_picker_choose_button_text">Seç</string>
+  <string name="move_file_not_found">Köçürmə mümkün olmur. Xahiş olunur faylın mövcudluğunu yoxlayasınız.</string>
+  <string name="move_file_invalid_into_descendent">Qovluğu bu nəsilə köçürmək mümkün deyil</string>
+  <string name="move_file_invalid_overwrite">Fayl artıq mənsəb qovluğunda mövcuddur</string>
+  <string name="move_file_error">Fayl və ya qovluğun köçürülməsi müddətində səhv baş verdi</string>
+  <string name="forbidden_permissions_move">bu faylı köçürtmək</string>
+  <string name="prefs_category_instant_uploading">Anında yükləmələr</string>
+  <string name="prefs_category_security">Təhlükəsizlik</string>
+  <string name="prefs_instant_video_upload_path_title">Video ünvanını yüklə</string>
+  <string name="download_folder_failed_content">Qovluğun endirilməsinin %1$s hissəsi tamamlana bilməz </string>
+  <string name="subject_token">%1$s paylaşdı \"%2$s\" sizinlə</string>
 </resources>
index 27178f2..2cd1c81 100644 (file)
   <string name="auth_redirect_non_secure_connection_title">Сигурна връзка е пренасочена по несигурен път.</string>
   <string name="actionbar_logger">Доклади</string>
   <string name="log_send_history_button">Изпрати История</string>
+  <string name="log_send_no_mail_app">Не са намерени журнали за изпращане от приложението. Инсталирайте приложението за електронна поща!</string>
+  <string name="log_send_mail_subject">%1$s Android журнали на приложенията</string>
+  <string name="log_progress_dialog_text">Зареждане на данни...</string>
   <string name="saml_authentication_required_text">Нужна е идентификация</string>
   <string name="saml_authentication_wrong_pass">Грешна парола</string>
   <string name="actionbar_move">Премести</string>
   <string name="forbidden_permissions_move">за да преместиш този файл</string>
   <string name="prefs_category_instant_uploading">Незабавно качване</string>
   <string name="prefs_category_security">Сигурност</string>
+  <string name="prefs_instant_video_upload_path_title">Качване на видео път</string>
+  <string name="download_folder_failed_content">Свалянето на директорията %1$s не може да бъде завършено</string>
 </resources>
index 4c2f869..9ab386c 100644 (file)
@@ -1,7 +1,34 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="actionbar_upload">Učitaj</string>
+  <string name="actionbar_upload_files">Datoteke</string>
   <string name="actionbar_mkdir">Nova fascikla</string>
+  <string name="actionbar_settings">Postavke</string>
+  <string name="actionbar_send_file">Pošalji</string>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
+  <string name="prefs_category_more">Više</string>
+  <string name="prefs_help">Pomoć</string>
+  <string name="auth_username">Korisničko ime</string>
+  <string name="auth_password">Lozinka</string>
+  <string name="sync_string_files">Datoteke</string>
+  <string name="uploader_btn_upload_text">Učitaj</string>
+  <string name="filedetails_download">Preuzmite</string>
+  <string name="action_share_file">Podijelite vezu</string>
+  <string name="common_yes">Da</string>
+  <string name="common_no">Ne</string>
+  <string name="common_ok">Ok</string>
+  <string name="common_cancel_upload">Prekini učitavanje</string>
+  <string name="common_cancel">Odustani</string>
+  <string name="common_error">Greška</string>
+  <string name="common_error_unknown">Nepoznata greška</string>
+  <string name="change_password">Promijeni lozinku</string>
+  <string name="create_account">Kreiraj račun</string>
+  <string name="common_rename">Preimenuj</string>
+  <string name="activity_chooser_send_file_title">Pošalji</string>
   <string name="empty"></string>
+  <string name="saml_authentication_required_text">Potrebna autentifikacija</string>
+  <string name="saml_authentication_wrong_pass">Pogrešna lozinka</string>
+  <string name="folder_picker_choose_button_text">Izaberite</string>
+  <string name="prefs_category_security">Sigurnost</string>
 </resources>
index 9980cf2..d0cd67a 100644 (file)
   <string name="actionbar_settings">Configuració</string>
   <string name="actionbar_see_details">Detalls</string>
   <string name="actionbar_send_file">Envia</string>
+  <string name="actionbar_sort">Ordena</string>
+  <string name="actionbar_sort_title">Ordena per</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Més nou - Més antic</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">General</string>
index 56b7702..897be00 100644 (file)
@@ -40,7 +40,7 @@
   <string name="prefs_imprint">Imprint</string>
   <string name="prefs_remember_last_share_location">Zapamatovat umístění sdílení</string>
   <string name="prefs_remember_last_upload_location_summary">Zapamatovat poslední umístění pro nahrání sdílených souborů</string>
-  <string name="recommend_subject">Zkuste %1$s na vašem smartphonu!</string>
+  <string name="recommend_subject">Zkuste %1$s na svém chytrém telefonu!</string>
   <string name="recommend_text">Chtěl bych vás pozvat k používání %1$s na vašem chytrém telefonu!\nKe stažení zde: %2$s</string>
   <string name="auth_check_server">Zkontrolovat server</string>
   <string name="auth_host_url">Adresa serveru https://...</string>
   <string name="auth_oauth_error">Neúspěšné přihlášení</string>
   <string name="auth_oauth_error_access_denied">Přístup zamítnut autorizačním serverem</string>
   <string name="auth_wtf_reenter_URL">Neočekávaný stav; prosím vložte znovu URL adresu serveru</string>
-  <string name="auth_expired_oauth_token_toast">Vaše přihlášení vypršelo. Přihlašte se, prosím, znovu</string>
+  <string name="auth_expired_oauth_token_toast">Vaše přihlášení vypršelo. Přihlaste se prosím znovu</string>
   <string name="auth_expired_basic_auth_toast">Zadejte prosím aktuální heslo</string>
-  <string name="auth_expired_saml_sso_token_toast">Vaše přihlášení vypršelo. Přihlašte se, prosím, znovu</string>
+  <string name="auth_expired_saml_sso_token_toast">Vaše přihlášení vypršelo. Přihlaste se prosím znovu</string>
   <string name="auth_connecting_auth_server">Připojuji se k přihlašovacímu serveru...</string>
   <string name="auth_unsupported_auth_method">Server nepodporuje tuto přihlašovací metodu</string>
   <string name="auth_unsupported_multiaccount">%1$s nepodporuje více účtů</string>
   <string name="auth_fail_get_user_name">Váš server nevrací správné přihlašovací ID, kontaktujte prosím svého správce systému</string>
   <string name="auth_can_not_auth_against_server">Není možné provést ověření  </string>
+  <string name="auth_account_does_not_exist">V zařízení není zatím nastaven účet</string>
   <string name="fd_keep_in_sync">Udržovat soubor aktuální</string>
   <string name="common_rename">Přejmenovat</string>
   <string name="common_remove">Odstranit</string>
@@ -281,7 +282,7 @@ správce systému.</string>
   <string name="auth_redirect_non_secure_connection_title">Bezpečné spojení je přesměrováno na nezabezpečenou trasu.</string>
   <string name="actionbar_logger">Logy</string>
   <string name="log_send_history_button">Odeslat historii</string>
-  <string name="log_send_no_mail_app">Nebyla nalezena žádná aplikace pro zasílání logů. Nainstalujte poštovní aplikaci!</string>
+  <string name="log_send_no_mail_app">Nebyla nalezena žádná aplikace pro odesílání logů. Nainstalujte poštovní aplikaci!</string>
   <string name="log_send_mail_subject">%1$s logy aplikace pro Android</string>
   <string name="log_progress_dialog_text">Načítání dat…</string>
   <string name="saml_authentication_required_text">Vyžadováno přihlášení</string>
@@ -297,4 +298,6 @@ správce systému.</string>
   <string name="prefs_category_instant_uploading">Okamžitá odesílání</string>
   <string name="prefs_category_security">Zabezpečení</string>
   <string name="prefs_instant_video_upload_path_title">Cesta pro nahrávání videí</string>
+  <string name="download_folder_failed_content">Stažení adresáře %1$s nemohlo být dokončeno</string>
+  <string name="subject_token">%1$s sdílí \"%2$s\" s vámi</string>
 </resources>
index 149862b..337ea37 100644 (file)
   <string name="auth_unsupported_multiaccount">%1$s understøtter ikke multiple konti</string>
   <string name="auth_fail_get_user_name">Din server retunere ikke et korrekt bruger-id. Kontakt venligst din administrator</string>
   <string name="auth_can_not_auth_against_server">Kan ikke autentificere mod denne server</string>
+  <string name="auth_account_does_not_exist">Kontoen findes endnu ikke på enheden</string>
   <string name="fd_keep_in_sync">Hold filen opdateret</string>
   <string name="common_rename">Omdøb</string>
   <string name="common_remove">Fjern</string>
   <string name="prefs_category_instant_uploading">Øjeblikkelige uploads</string>
   <string name="prefs_category_security">Sikkerhed</string>
   <string name="prefs_instant_video_upload_path_title">Sti til videoupload</string>
+  <string name="download_folder_failed_content">Download af %1$s mappe kunne ikke fuldføres</string>
+  <string name="subject_token">%1$s delt \"%2$s\" med dig</string>
 </resources>
index b1a9e68..9912537 100644 (file)
   <string name="auth_no_net_conn_title">Keine Netzwerkverbindung</string>
   <string name="auth_nossl_plain_ok_title">Sichere Verbindung nicht verfügbar.</string>
   <string name="auth_connection_established">Verbindung hergestellt</string>
-  <string name="auth_testing_connection">Verbindungstest …</string>
+  <string name="auth_testing_connection">Verbindungstest…</string>
   <string name="auth_not_configured_title">Fehlerhafte Server Konfiguration</string>
   <string name="auth_account_not_new">Ein Benutzerkonto für den gleichen Benutzer und Server existiert auf diesem Gerät bereits</string>
   <string name="auth_account_not_the_same">Der eingegebene Benutzer passt nicht zu dem Benutzer dieses Benutzerkontos</string>
   <string name="auth_fail_get_user_name">Ihr Server gibt keine richtige Benutzerkennung zurück, bitte kontaktieren Sie einen Administrator
 ⇥</string>
   <string name="auth_can_not_auth_against_server">Die Legitimierung gegenüber dem Server konnte nicht durchgeführt werden</string>
+  <string name="auth_account_does_not_exist">Das Benutzerkonto ist bis jetzt noch nicht auf dem Gerät vorhanden</string>
   <string name="fd_keep_in_sync">Datei aktuell halten</string>
   <string name="common_rename">Umbenennen</string>
   <string name="common_remove">Löschen</string>
   <string name="prefs_category_instant_uploading">Sofortiges Hochladen</string>
   <string name="prefs_category_security">Sicherheit</string>
   <string name="prefs_instant_video_upload_path_title">Verzeichnis zum Hochladen der Videos</string>
+  <string name="download_folder_failed_content">Herunterladen des %1$s - Ordners konnte nicht abgeschlossen werden</string>
+  <string name="subject_token">%1$s hat „%2$s“ mit Ihnen geteilt</string>
 </resources>
index 23cdb64..aa0fdb9 100644 (file)
@@ -43,7 +43,7 @@
   <string name="recommend_subject">Probiere %1$s auf Deinem Smartphone!</string>
   <string name="recommend_text">Ich möchte Dich zum Benutzen von %1$s auf Deinem Smartphone einladen!\nLade es hier herunter: %2$s</string>
   <string name="auth_check_server">Überprüfe den Server</string>
-  <string name="auth_host_url">Server-Adresse https://…</string>
+  <string name="auth_host_url">Serveradresse https://…</string>
   <string name="auth_username">Benutzername</string>
   <string name="auth_password">Passwort</string>
   <string name="auth_register">Ist %1$s neu für dich?</string>
@@ -61,7 +61,7 @@
   <string name="uploader_info_uploading">Lade hoch</string>
   <string name="file_list_seconds_ago">Gerade eben</string>
   <string name="file_list_empty">Alles leer. Lade etwas hoch!</string>
-  <string name="file_list_loading">Ladevorgang …</string>
+  <string name="file_list_loading">Laden…</string>
   <string name="local_file_list_empty">Es befinden sich keine Dateien in diesem Ordner.</string>
   <string name="file_list_folder">Ordner</string>
   <string name="file_list_folders">Ordner</string>
@@ -75,7 +75,7 @@
   <string name="filedetails_download">Herunterladen</string>
   <string name="filedetails_sync_file">Datei aktualisieren</string>
   <string name="filedetails_renamed_in_upload_msg">Datei wurde wärend des Uploads zu %1$s umbenannt</string>
-  <string name="action_share_file">Link Teilen</string>
+  <string name="action_share_file">Link teilen</string>
   <string name="action_unshare_file">Link nicht mehr freigeben</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nein</string>
   <string name="common_cancel">Abbrechen</string>
   <string name="common_save_exit">Speichern &amp; schließen</string>
   <string name="common_error">Fehler</string>
-  <string name="common_loading">Lädt ...</string>
+  <string name="common_loading">Lade…</string>
   <string name="common_error_unknown">Unbekannter Fehler</string>
   <string name="about_title">Über</string>
   <string name="change_password">Passwort ändern</string>
   <string name="delete_account">Account löschen</string>
   <string name="create_account">Account erstellen</string>
-  <string name="upload_chooser_title">Dateien hochladen von...</string>
+  <string name="upload_chooser_title">Dateien hochladen von</string>
   <string name="uploader_info_dirname">Ordnername</string>
-  <string name="uploader_upload_in_progress_ticker">Hochladen...</string>
+  <string name="uploader_upload_in_progress_ticker">Hochladen</string>
   <string name="uploader_upload_in_progress_content">%1$d%% Hochladen %2$s</string>
   <string name="uploader_upload_succeeded_ticker">Hochladen erfolgreich</string>
   <string name="uploader_upload_succeeded_content_single">%1$s wurde(n) erfolgreich hochgeladen</string>
   <string name="uploader_upload_failed_ticker">Hochladen fehlgeschlagen</string>
   <string name="uploader_upload_failed_content_single">Hochladen von  %1$s konnte nicht abgeschlossen werden</string>
   <string name="uploader_upload_failed_credentials_error">Hochladen fehlgeschlagen, Du musst dich nochmals anmelden</string>
-  <string name="downloader_download_in_progress_ticker">Herunterladen...</string>
+  <string name="downloader_download_in_progress_ticker">Herunterladen</string>
   <string name="downloader_download_in_progress_content">%1$d%% Herunterladen %2$s</string>
   <string name="downloader_download_succeeded_ticker">Herunterladen erfolgreich</string>
   <string name="downloader_download_succeeded_content">%1$s wurde erfolgreich heruntergeladen</string>
   <string name="media_rewind_description">Zurückspielen Knopf</string>
   <string name="media_play_pause_description">Play-/Pause Knopf</string>
   <string name="media_forward_description">Vorspulen Knopf</string>
-  <string name="auth_getting_authorization">Autorisierung empfangen...</string>
-  <string name="auth_trying_to_login">Anmeldungsversuch...</string>
+  <string name="auth_getting_authorization">Autorisierung empfangen</string>
+  <string name="auth_trying_to_login">Anmeldeversuch…</string>
   <string name="auth_no_net_conn_title">Keine Netzwerkverbindung</string>
   <string name="auth_nossl_plain_ok_title">Sichere Verbindung nicht verfügbar.</string>
   <string name="auth_connection_established">Verbindung hergestellt</string>
-  <string name="auth_testing_connection">Verbindung testen...</string>
+  <string name="auth_testing_connection">Verbindung testen</string>
   <string name="auth_not_configured_title">Fehlerhafte Server Konfiguration</string>
   <string name="auth_account_not_new">Ein Benutzerkonto für den gleichen Benutzer und Server existiert auf diesem Gerät bereits</string>
   <string name="auth_account_not_the_same">Der eingegebene Benutzer passt nicht zu dem Benutzer dieses Benutzerkontos</string>
   <string name="auth_fail_get_user_name">Dein Server gibt keine korrekte Benutzer-ID zurück, bitte kontaktiere einen Administrator
 </string>
   <string name="auth_can_not_auth_against_server">Die Authentifizierung gegenüber dem Server konnte nicht durchgeführt werden</string>
+  <string name="auth_account_does_not_exist">Das Benutzerkonto ist bis jetzt noch nicht auf dem Gerät vorhanden</string>
   <string name="fd_keep_in_sync">Datei aktuell halten</string>
   <string name="common_rename">Umbenennen</string>
   <string name="common_remove">Löschen</string>
   <string name="wait_a_moment">Bitte warte einen Moment.</string>
   <string name="filedisplay_unexpected_bad_get_content">Ein unerwartetes Problem ist aufgetreten. Bitte versuche, die Datei in einer anderen App zu öffnen</string>
   <string name="filedisplay_no_file_selected">Es wurde keine Datei ausgewählt.</string>
-  <string name="activity_chooser_title">Link senden an ...</string>
+  <string name="activity_chooser_title">Link senden an</string>
   <string name="oauth_check_onoff">Anmelden mit oAuth2</string>
   <string name="oauth_login_connection">Verbinde mit dem oAuth2-Server.</string>
   <string name="ssl_validator_header">Die Identität der Website konnte nicht überprüft werden</string>
   <string name="prefs_category_instant_uploading">Sofortiges Hochladen</string>
   <string name="prefs_category_security">Sicherheit</string>
   <string name="prefs_instant_video_upload_path_title">Verzeichnis zum Hochladen der Videos</string>
+  <string name="download_folder_failed_content">Herunterladen des %1$s - Ordners konnte nicht abgeschlossen werden</string>
+  <string name="subject_token">%1$s hat „%2$s“ mit Dir geteilt</string>
 </resources>
index b037f01..29f78e9 100644 (file)
   <string name="actionbar_settings">Ρυθμίσεις</string>
   <string name="actionbar_see_details">Λεπτομέρειες</string>
   <string name="actionbar_send_file">Αποστολή</string>
+  <string name="actionbar_sort">Ταξινόμηση</string>
+  <string name="actionbar_sort_title">Ταξινόμηση κατά</string>
   <string-array name="actionbar_sortby">
-    <item>A-Z</item>
+    <item>A-Ω</item>
     <item>Νεότερο - Παλαιότερο</item>
   </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
@@ -36,6 +38,8 @@
   <string name="prefs_recommend">Προτείνετε σε φίλο</string>
   <string name="prefs_feedback">Σχόλια </string>
   <string name="prefs_imprint">Αποτύπωμα</string>
+  <string name="prefs_remember_last_share_location">Αποθήκευση σημείου διαμοιρασμού</string>
+  <string name="prefs_remember_last_upload_location_summary">Αποθήκευση τελευταίου σημείου διαμοιρασμού μεταφόρτωσης</string>
   <string name="recommend_subject">Δοκιμάστε %1$s στο κινητό σας!</string>
   <string name="recommend_text">Θα ήθελα να σε προσκαλέσω να χρησιμοποιήσεις το %1$s στο κινητό σου!\nΛήψη εδώ: %2$s</string>
   <string name="auth_check_server">Έλεγχος Διακομιστή</string>
@@ -56,8 +60,8 @@
   <string name="uploader_error_forbidden_content">Ο %1$s δεν επιτρέπεται να έχει πρόσβαση στο κοινόχρηστο περιεχόμενο</string>
   <string name="uploader_info_uploading">Μεταφόρτωση</string>
   <string name="file_list_seconds_ago">δευτερόλεπτα πριν</string>
-  <string name="file_list_empty">Î\94εν Ï\85Ï\80άÏ\81Ï\87ει Ï\84ίÏ\80οÏ\84α ÎµÎ´Ï\8e. Î\91νεβάστε κάτι!</string>
-  <string name="file_list_loading">Φόρτωση ...</string>
+  <string name="file_list_empty">Î\94εν Ï\85Ï\80άÏ\81Ï\87ει Ï\84ίÏ\80οÏ\84α ÎµÎ´Ï\8e. Î\9cεÏ\84αÏ\86οÏ\81Ï\84Ï\8eστε κάτι!</string>
+  <string name="file_list_loading">Φόρτωση...</string>
   <string name="local_file_list_empty">Δεν υπάρχουν αρχεία σε αυτό τον φάκελο.</string>
   <string name="file_list_folder">φάκελος</string>
   <string name="file_list_folders">φάκελοι</string>
   <string name="auth_fail_get_user_name">Ο διακομιστής σας δεν επιστρέφει το σωστό αναγνωριστικό χρήστη, παρακαλώ επικοινωνήστε με ένα διαχειριστή
 ⇥</string>
   <string name="auth_can_not_auth_against_server">Δεν είναι δυνατή η πιστοποίηση με αυτόν το διακομιστή</string>
+  <string name="auth_account_does_not_exist">Ο λογαριασμός δεν υπάρχει στη συσκευή ακόμα.</string>
   <string name="fd_keep_in_sync">Διατήρηση αρχείου σε ενημέρωση</string>
   <string name="common_rename">Μετονομασία</string>
   <string name="common_remove">Αφαίρεση</string>
                διαχειριστή σας.</string>
   <string name="share_link_file_no_exist">Αδύνατη η κοινή χρήση. Παρακαλώ ελέγξτε αν ο φάκελος υπάρχει</string>
   <string name="share_link_file_error">Ένα σφάλμα προέκυψε κατά την προσπάθεια διαμοιρασμού αυτού του αρχείου ή φακέλου</string>
-  <string name="unshare_link_file_no_exist">Αδύνατη η διακοπή κοινής χρήσης.  Παρακαλώ ελέγξτε αν ο φάκελος υπάρχει</string>
+  <string name="unshare_link_file_no_exist">Αδύνατη η διακοπή κοινής χρήσης.  Παρακαλώ ελέγξτε αν το αρχείο υπάρχει</string>
   <string name="unshare_link_file_error">Ένα σφάλμα προέκυψε κατά τη διάρκεια ακύρωσης διαμοιρασμού αυτού του αρχείου ή φακέλου</string>
   <string name="activity_chooser_send_file_title">Αποστολή</string>
   <string name="copy_link">Αντιγραφή συνδέσμου</string>
   <string name="forbidden_permissions_rename">για να μετονομάσετε αυτό το αρχείο</string>
   <string name="forbidden_permissions_delete">για να διαγράψετε αυτό το αρχείο</string>
   <string name="share_link_forbidden_permissions">για να μοιραστείτε αυτό το αρχείο</string>
-  <string name="unshare_link_forbidden_permissions">για Î½Î± Î¼Î· Î¼Î¿Î¹Ï\81αÏ\83Ï\84είÏ\84ε Î±Ï\85Ï\84Ï\8c Ï\84ο Î±Ï\81Ï\87είο</string>
+  <string name="unshare_link_forbidden_permissions">για Î½Î± Î´Î¹Î±ÎºÏ\8cÏ\88εÏ\84ε Ï\84ο Î´Î¹Î±Î¼Î¿Î¹Ï\81αÏ\83μÏ\8c Î±Ï\85Ï\84οÏ\8d Ï\84οÏ\85 Î±Ï\81Ï\87είοÏ\85</string>
   <string name="forbidden_permissions_create">για να δημιουργήσετε το αρχείο</string>
-  <string name="uploader_upload_forbidden_permissions">για να μεταφορτώσετε σε αυτό τον κατάλογο</string>
+  <string name="uploader_upload_forbidden_permissions">για να μεταφορτώσετε σε αυτό το φάκελο</string>
   <string name="downloader_download_file_not_found">Αυτό το αρχείο δεν είναι πια διαθέσιμο στο διακομιστή</string>
   <string name="prefs_category_accounts">Λογαριασμοί</string>
   <string name="prefs_add_account">Προσθήκη λογαριασμού</string>
   <string name="auth_redirect_non_secure_connection_title">Ασφαλής σύνδεση ανακατευθύνεται σε μια μη ασφαλή διαδρομή.</string>
   <string name="actionbar_logger">Αρχεία καταγραφών</string>
-  <string name="log_send_history_button">Αποστολή ιστορικού</string>
+  <string name="log_send_history_button">Αποστολή Ιστορικού</string>
+  <string name="log_send_no_mail_app">Δεν εντοπίστηκε εφαρμογή αποστολής αναφορών συστήματος. Εγκαταστήστε την εφαρμογή Ηλ. Ταχυδρομείου!!</string>
+  <string name="log_send_mail_subject">%1$s αναφορές της εφαρμογής Android</string>
+  <string name="log_progress_dialog_text">Φόρτωση δεδομένων....</string>
   <string name="saml_authentication_required_text">Απαιτείται πιστοποίηση</string>
-  <string name="saml_authentication_wrong_pass">Εσφαλμένο συνθηματικό</string>
+  <string name="saml_authentication_wrong_pass">Εσφαλμένος κωδικός πρόσβασης</string>
   <string name="actionbar_move">Μετακίνηση</string>
   <string name="file_list_empty_moving">Δεν υπάρχει τίποτα εδώ. Μπορείτε να προσθέσετε ένα φάκελο!</string>
   <string name="folder_picker_choose_button_text">Επιλέξτε</string>
-  <string name="move_file_not_found">Αδύνατη η μετακίνηση. Παρακαλώ ελέγξτε αν ο φάκελος υπάρχει</string>
+  <string name="move_file_not_found">Αδύνατη η μετακίνηση. Παρακαλώ ελέγξτε αν το αρχείο υπάρχει</string>
   <string name="move_file_invalid_into_descendent">Δεν είναι δυνατό να μετακινηθεί ο φάκελος σε έναν απογονικό</string>
   <string name="move_file_invalid_overwrite">Το αρχείο υπάρχει ήδη στο φάκελο προορισμού</string>
   <string name="move_file_error">Ένα σφάλμα προέκυψε κατά την προσπάθεια μετακίνησης αυτού του αρχείου ή φακέλου</string>
   <string name="forbidden_permissions_move">για μετακίνηση αυτού του αρχείου</string>
   <string name="prefs_category_instant_uploading">Στιγμιαίες Μεταφορτώσεις</string>
   <string name="prefs_category_security">Ασφάλεια</string>
+  <string name="prefs_instant_video_upload_path_title">Διαδρομή Μεταφόρτωσης Βίντεο</string>
+  <string name="download_folder_failed_content">Η λήψη του φακέλου %1$s δεν ολοκληρώθηκε με επιτυχία.</string>
+  <string name="subject_token">%1$s μοιράστηκε \"%2$s\" μαζί σας</string>
 </resources>
index 054cb6b..450c2a5 100644 (file)
   <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">Cannot authenticate against this server</string>
+  <string name="auth_account_does_not_exist">Account does not exist on the device yet</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="prefs_category_instant_uploading">Instant Uploads</string>
   <string name="prefs_category_security">Security</string>
   <string name="prefs_instant_video_upload_path_title">Upload Video Path</string>
+  <string name="download_folder_failed_content">Download of %1$s folder could not be completed</string>
+  <string name="subject_token">%1$s shared \"%2$s\" with you</string>
 </resources>
index 3baeea2..dca9e4a 100644 (file)
   <string name="actionbar_settings">Configuración</string>
   <string name="actionbar_see_details">Detalles</string>
   <string name="actionbar_send_file">Mandar</string>
+  <string name="actionbar_sort">Orden</string>
+  <string name="actionbar_sort_title">Ordenar por</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Nuevos - Viejos</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">General</string>
   <string name="prefs_recommend">Recomendar a un amigo</string>
   <string name="prefs_feedback">Sugerencias</string>
   <string name="prefs_imprint">Imprint</string>
+  <string name="prefs_remember_last_share_location">Recordar compartir ubicación </string>
+  <string name="prefs_remember_last_upload_location_summary">Recordar la ultima ubicación compartida de subida</string>
   <string name="recommend_subject">¡Intento %1$s en tu teléfono inteligente!</string>
+  <string name="recommend_text">Quiero invitarte a usar %1$s en tu teléfono inteligente!\nDescárgalo aquí: %2$s</string>
   <string name="auth_check_server">Verificar Servidor</string>
   <string name="auth_host_url">Dirección del servidor https://...</string>
   <string name="auth_username">Nombre de usuario</string>
   <string name="conflict_dont_upload">No subir</string>
   <string name="preview_image_description">Previsualización de imagen</string>
   <string name="preview_image_error_unknown_format">Esta imagen no puede ser mostrada</string>
+  <string name="error__upload__local_file_not_copied">%1$s no pudo ser copiado a la carpeta local %2$s </string>
+  <string name="prefs_instant_upload_path_title">Dirección de subida</string>
+  <string name="share_link_no_support_share_api">Lo sentimos, compartir no esta activado en su servidor. Por favor contacte a su
+⇥⇥administrator.</string>
+  <string name="share_link_file_no_exist">Imposible compartir. Por favor revise si el archivo existe</string>
+  <string name="share_link_file_error">Un error ocurrió cuando se intentaba compartir el archivo o carpeta</string>
+  <string name="unshare_link_file_no_exist">Imposible dejar de compartir. Por favor revise si los archivos existen</string>
+  <string name="unshare_link_file_error">Un error ocurrió cuando se intentaba dejar de compartir el archivo o carpeta</string>
   <string name="activity_chooser_send_file_title">Mandar</string>
+  <string name="copy_link">Copiar dirección url</string>
   <string name="clipboard_text_copied">Copiado al portapapeles</string>
+  <string name="error_cant_bind_to_operations_service">Error critico: no se puede realizar operaciones</string>
+  <string name="network_error_socket_exception">Un error ocurrió mientras se conectaba con el Servidor.</string>
+  <string name="network_error_socket_timeout_exception">Un error ocurrió mientras se conectaba con el Servidor. La operación no se realizó </string>
+  <string name="network_error_connect_timeout_exception">Un error ocurrió esperando al Servidor, la operación no se realizó</string>
+  <string name="network_host_not_available">Operación no completada, Servidor no disponible.</string>
   <string name="empty"></string>
+  <string name="forbidden_permissions">Tu no tienes permiso %s</string>
+  <string name="forbidden_permissions_rename">para renombrar este archivo</string>
+  <string name="forbidden_permissions_delete">para borrar este archivo</string>
+  <string name="share_link_forbidden_permissions">para compartir este archivo</string>
+  <string name="unshare_link_forbidden_permissions">para dejar de compartir este archivo</string>
+  <string name="forbidden_permissions_create">para crear el archivo</string>
+  <string name="uploader_upload_forbidden_permissions">para subir en esta carpeta</string>
+  <string name="downloader_download_file_not_found">El archivo no esta mas disponible en este Servidor</string>
   <string name="prefs_category_accounts">Cuentas</string>
+  <string name="prefs_add_account">Añadir cuenta</string>
+  <string name="auth_redirect_non_secure_connection_title">Conexión segura redireccionada a una ruta insegura.</string>
+  <string name="actionbar_logger">Registro</string>
+  <string name="log_send_history_button">Enviar Historial</string>
+  <string name="log_send_no_mail_app">Aplicación para enviar registros no encontrada. Instale una aplicación de correo!</string>
+  <string name="log_send_mail_subject">%1$s Registros de la aplicación Android</string>
+  <string name="log_progress_dialog_text">Cargando datos...</string>
   <string name="saml_authentication_required_text">Autentificación requerida</string>
   <string name="saml_authentication_wrong_pass">Clave incorrecta</string>
+  <string name="actionbar_move">Mover</string>
+  <string name="file_list_empty_moving">Nada aquí. Puedes agregar una carpeta!</string>
   <string name="folder_picker_choose_button_text">Elegir</string>
+  <string name="move_file_not_found">Imposible mover. Por favor revisa si el archivo existe</string>
+  <string name="move_file_invalid_overwrite">El archivo ya existe en la carpeta destino</string>
+  <string name="move_file_error">Un error ocurrió intentando mover el archivo o carpeta</string>
+  <string name="forbidden_permissions_move">para mover este archivo</string>
+  <string name="prefs_category_instant_uploading">Subida Instantánea </string>
   <string name="prefs_category_security">Seguridad</string>
+  <string name="prefs_instant_video_upload_path_title">Dirección de subida del video</string>
+  <string name="download_folder_failed_content">La descarga de la carpeta %1$s no pudo ser completada</string>
 </resources>
index 69623e1..26dde5f 100644 (file)
@@ -1,6 +1,8 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="actionbar_upload_files">Archivos</string>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
+  <string name="sync_string_files">Archivos</string>
   <string name="empty"></string>
 </resources>
index 793c094..e5faa34 100644 (file)
@@ -7,7 +7,7 @@
   <string name="actionbar_upload_from_apps">Contenido de otras aplicaciones</string>
   <string name="actionbar_upload_files">Archivos</string>
   <string name="actionbar_open_with">Abrir con</string>
-  <string name="actionbar_mkdir">Nueva Carpeta</string>
+  <string name="actionbar_mkdir">Nueva carpeta</string>
   <string name="actionbar_settings">Configuración</string>
   <string name="actionbar_see_details">Detalles</string>
   <string name="actionbar_send_file">Enviar</string>
   <string name="prefs_imprint">pie de imprenta</string>
   <string name="prefs_remember_last_share_location">Recordar la ubicación de los archivos compartidos</string>
   <string name="prefs_remember_last_upload_location_summary">Recordar la ubicación de los últimos archivos compartidos subidos</string>
-  <string name="recommend_subject">Prueba  %1$s en tu smarthphone!</string>
+  <string name="recommend_subject">¡Prueba  %1$s en su smarthphone!</string>
   <string name="recommend_text">¡Quiero invitarle a usar %1$s en su smartphone!\nDescárguelo aquí: %2$s</string>
   <string name="auth_check_server">Compruebe el servidor.</string>
   <string name="auth_host_url">Dirección del servidor https://…</string>
   <string name="auth_username">Nombre de usuario</string>
   <string name="auth_password">Contraseña</string>
-  <string name="auth_register">Nuevo para %1$s?</string>
+  <string name="auth_register">¿Nuevo en %1$s?</string>
   <string name="sync_string_files">Archivos</string>
   <string name="setup_btn_connect">Conectar</string>
   <string name="uploader_btn_upload_text">Subir</string>
   <string name="uploader_top_message">Escoger carpeta de carga:</string>
   <string name="uploader_wrn_no_account_title">No se encontró la cuenta</string>
-  <string name="uploader_wrn_no_account_text">No hay cuentas de %1$s en tu dispositivo. Por favor configura una cuenta primero.</string>
+  <string name="uploader_wrn_no_account_text">No hay cuentas de %1$s en su dispositivo. Por favor, configure una cuenta primero.</string>
   <string name="uploader_wrn_no_account_setup_btn_text">Configuración</string>
   <string name="uploader_wrn_no_account_quit_btn_text">Salir</string>
   <string name="uploader_wrn_no_content_title">No hay contenido para subir</string>
@@ -85,7 +85,7 @@
   <string name="common_cancel">Cancelar</string>
   <string name="common_save_exit">Guardar &amp; Salir</string>
   <string name="common_error">Error</string>
-  <string name="common_loading">Cargando ...</string>
+  <string name="common_loading">Cargando...</string>
   <string name="common_error_unknown">Error desconocido</string>
   <string name="about_title">Acerca de</string>
   <string name="change_password">Cambiar contraseña</string>
   <string name="uploader_upload_failed_ticker">Error en la subida</string>
   <string name="uploader_upload_failed_content_single">La subida de %1$s no se pudo completar</string>
   <string name="uploader_upload_failed_credentials_error">La carga falló, necesita volver a iniciar sesión</string>
-  <string name="downloader_download_in_progress_ticker">Descargando ...</string>
+  <string name="downloader_download_in_progress_ticker">Descargando...</string>
   <string name="downloader_download_in_progress_content">%1$d%% Descargado de %2$s</string>
   <string name="downloader_download_succeeded_ticker">Descarga completa</string>
   <string name="downloader_download_succeeded_content">%1$s se ha descargado con éxito</string>
   <string name="downloader_download_failed_content">La descarga de %1$s no se pudo completar</string>
   <string name="downloader_not_downloaded_yet">No descargado</string>
   <string name="downloader_download_failed_credentials_error">Descarga fallida, necesita reinicar la sesión</string>
-  <string name="common_choose_account">Elige una cuenta</string>
+  <string name="common_choose_account">Elija una cuenta</string>
   <string name="sync_fail_ticker">Falló la sincronización</string>
   <string name="sync_fail_ticker_unauthorized">La sincronización falló, debe reiniciar la sesión</string>
   <string name="sync_fail_content">La sincronización de %1$s s no se pudo completar</string>
   <string name="foreign_files_local_text">Local: %1$s</string>
   <string name="foreign_files_remote_text">Remoto: %1$s</string>
   <string name="upload_query_move_foreign_files">No hay suficiente espacio para copiar los archivos seleccionados a la carpeta %1$s. ¿Desea moverlos en vez de copiarlos?</string>
-  <string name="pincode_enter_pin_code">Por favor, inserta tu PIN de aplicación</string>
+  <string name="pincode_enter_pin_code">Por favor, inserte su PIN de aplicación</string>
   <string name="pincode_configure_your_pin">Introduzca un PIN para la aplicación</string>
   <string name="pincode_configure_your_pin_explanation">Se solicitará el PIN cada vez que se inicie la aplicación</string>
   <string name="pincode_reenter_your_pincode">Repita el PIN para la aplicación, por favor</string>
   <string name="media_event_done">%1$s reproducción finalizada</string>
   <string name="media_err_nothing_to_play">No se encontró el archivo multimedia</string>
   <string name="media_err_no_account">No se ha proporcionado cuenta</string>
-  <string name="media_err_not_in_owncloud">El archivo no esta en una cuenta valida </string>
-  <string name="media_err_unsupported">Codec No Soportado</string>
+  <string name="media_err_not_in_owncloud">El archivo no está en una cuenta válida </string>
+  <string name="media_err_unsupported">Codec no soportado</string>
   <string name="media_err_io">El archivo de medios no pudo ser leído </string>
   <string name="media_err_malformed">Archivo no codificado correctamente</string>
   <string name="media_err_timeout">Tiempo de espera agotado en el intento de reproducción</string>
   <string name="media_err_unknown">El archivo de medios no se puede reproducir con el reproductor de medios por defecto </string>
   <string name="media_err_security_ex">Error de seguridad al intentar reproducir %1$s</string>
   <string name="media_err_io_ex">Error de entrada al intentar reproducir %1$s</string>
-  <string name="media_err_unexpected">Error inesperado intentando reproducir %1$s</string>
-  <string name="media_rewind_description">Botón Rebobinado</string>
+  <string name="media_err_unexpected">Error inesperado al intentar reproducir %1$s</string>
+  <string name="media_rewind_description">Botón de rebobinado</string>
   <string name="media_play_pause_description">Botón de reproducción o pausa </string>
   <string name="media_forward_description">Botón avance rápido</string>
   <string name="auth_getting_authorization">Consiguiendo autorización...</string>
   <string name="auth_bad_oc_version_title">No se reconoce  la versión del servidor </string>
   <string name="auth_wrong_connection_title">No se ha podido establecer la conexión</string>
   <string name="auth_secure_connection">Conexión segura establecida</string>
-  <string name="auth_unauthorized">Nombre de usuario o contraseña incorrecta</string>
+  <string name="auth_unauthorized">Nombre de usuario o contraseña incorrectos</string>
   <string name="auth_oauth_error">Autorización no satisfactoria</string>
   <string name="auth_oauth_error_access_denied">Acceso denegado por servidor de autorización</string>
   <string name="auth_wtf_reenter_URL">Estado inesperado; por favor, introduzca la URL del servidor de nuevo</string>
   <string name="auth_fail_get_user_name">Su servidor no está retornando una identificación de usuario correcta; contacte a un administrador
        </string>
   <string name="auth_can_not_auth_against_server">No puede autenticarse en este servidor.</string>
+  <string name="auth_account_does_not_exist">Aún no existe la cuenta en el dispositivo</string>
   <string name="fd_keep_in_sync">Mantener el archivo actualizado</string>
   <string name="common_rename">Renombrar</string>
   <string name="common_remove">Borrar</string>
   <string name="filename_forbidden_characters">Carácteres ilegales: / \\ &lt; &gt; : \" | ? *</string>
   <string name="filename_empty">El nombre de archivo no puede estar vacío</string>
   <string name="wait_a_moment">Espere un momento</string>
-  <string name="filedisplay_unexpected_bad_get_content">Problema inesperado; por favor, prueba otra app para seleccionar el archivo</string>
+  <string name="filedisplay_unexpected_bad_get_content">Problema inesperado; por favor, pruebe otra app para seleccionar el archivo</string>
   <string name="filedisplay_no_file_selected">No hay ficheros seleccionados.</string>
   <string name="activity_chooser_title">Enviar enlace a...</string>
   <string name="oauth_check_onoff">Ingresar con oAuth2</string>
   <string name="ssl_validator_header">La identidad del sitio no puede ser verificada</string>
   <string name="ssl_validator_reason_cert_not_trusted">- El certificado del servidor no es de confianza</string>
   <string name="ssl_validator_reason_cert_expired">- El certificado del servidor expiró</string>
-  <string name="ssl_validator_reason_cert_not_yet_valid">- El certificado del servidor es de una fecha que aún no llega</string>
+  <string name="ssl_validator_reason_cert_not_yet_valid">- El certificado del servidor es de una fecha que aún no ha llegado</string>
   <string name="ssl_validator_reason_hostname_not_verified">- La URL no coincide con el nombre de dominio del certificado</string>
-  <string name="ssl_validator_question">¿Confías de todas formas en este certificado?</string>
+  <string name="ssl_validator_question">¿Confía de todas formas en este certificado?</string>
   <string name="ssl_validator_not_saved">El certificado no pudo ser guardado</string>
   <string name="ssl_validator_btn_details_see">Detalles</string>
   <string name="ssl_validator_btn_details_hide">Ocultar</string>
   <string name="prefs_category_accounts">Cuentas</string>
   <string name="prefs_add_account">Agregar cuenta</string>
   <string name="auth_redirect_non_secure_connection_title">La conexión segura está siendo desviada por una ruta insegura.</string>
-  <string name="actionbar_logger">Logs</string>
+  <string name="actionbar_logger">Registros</string>
   <string name="log_send_history_button">Enviar historial</string>
   <string name="log_send_no_mail_app">No se ha encontrado una app para enviar logs. Instale la app mail!</string>
   <string name="log_send_mail_subject">Se han encontrado %1$s logs de la app Android</string>
   <string name="saml_authentication_wrong_pass">Contraseña incorrecta</string>
   <string name="actionbar_move">Mover</string>
   <string name="file_list_empty_moving">Aquí no hay nada. ¡Puede agregar una carpeta!</string>
-  <string name="folder_picker_choose_button_text">Seleccionar</string>
+  <string name="folder_picker_choose_button_text">Elegir</string>
   <string name="move_file_not_found">No se puede mover. Revise si el archivo existe</string>
   <string name="move_file_invalid_into_descendent">No se puede mover una carpeta dentro de una de SUS subcarpetas.</string>
   <string name="move_file_invalid_overwrite">El archivo ya existe en la carpeta de destino</string>
   <string name="forbidden_permissions_move">para mover este archivo</string>
   <string name="prefs_category_instant_uploading">Subidas instantáneas</string>
   <string name="prefs_category_security">Seguridad</string>
-  <string name="prefs_instant_video_upload_path_title">Ruta de vídeo de subida</string>
+  <string name="prefs_instant_video_upload_path_title">Guardar videos subidos en la carpeta:</string>
+  <string name="download_folder_failed_content">La descarga de la carpeta %1$s no ha podido ser completada</string>
+  <string name="subject_token">%1$s compartió \"%2$s\" contigo</string>
 </resources>
index d8dd263..0bca462 100644 (file)
@@ -12,6 +12,7 @@
   <string name="actionbar_see_details">Xehetasunak</string>
   <string name="actionbar_send_file">Bidali</string>
   <string name="actionbar_sort">Ordenatu</string>
+  <string name="actionbar_sort_title">Ordenatu honen arabera</string>
   <string-array name="actionbar_sortby">
     <item>A-Z</item>
     <item>Berrienak - Zaharrenak</item>
@@ -38,6 +39,7 @@
   <string name="prefs_feedback">Oharrak</string>
   <string name="prefs_imprint">Imprint</string>
   <string name="recommend_subject">Probatu %1$s zure telefono adimentsuan!</string>
+  <string name="recommend_text">Nik %1$s zure telefono adimentsuan erabitzera gonbidatu nahi zaitut!\nDeskargatu hemen: %2$s</string>
   <string name="auth_check_server">Egiaztatu zerbitzaria</string>
   <string name="auth_host_url">Zerbitzariaren helbidea https://</string>
   <string name="auth_username">Erabiltzaile izena</string>
   <string name="sync_fail_in_favourites_content">%1$d fitxategien edukiak ezin dira sinkronizatu (%2$d gatazka)</string>
   <string name="sync_foreign_files_forgotten_ticker">Bertako fitxategi batzuk ahaztu dira</string>
   <string name="sync_foreign_files_forgotten_content">%2$s karpetako %1$d fitxategi ezin dira dira kopiatu</string>
+  <string name="sync_foreign_files_forgotten_explanation">1.3.16 bertsioan, gailu honetatik igotzen diren fitxategiak bertako %1$s karpetara mugitzen dira datu galera ekiditeko fitxategi bat kontu ezberdinekin sinkronizatzen denean.\n\n Aldaketa hau dela eta, programa honen aurreko bertsioetan igotako fitxategi guztiak %2$s karpetara kopiatu dira. Hala ere, errore batek hau burutzea ekidin du kontuaren sinkronizazioa egiten ari zen bitartean. Orain fitxategiak dauden bezala utz ditzakezu eta %3$s rako lotura ezabatu, edo fitxategiak %1$s karpetara mugi ditzakezu eta %4$srako lotura mantendu.\n\nBehean bertako fitxategien zerrenda eta %5$s era lotuta zeuden urruneko fitxategiena.</string>
   <string name="sync_current_folder_was_removed">%1$s karpeta dagoeneko ez da existitzen</string>
   <string name="foreign_files_move">Mugitu denak</string>
   <string name="foreign_files_success">Fitxategi guztiak mugitu dira</string>
@@ -250,7 +253,9 @@ Mesedez, baimendu berriz</string>
   <string name="error__upload__local_file_not_copied">%1$s ezin da %2$s karpeta lokalera kopiatu</string>
   <string name="prefs_instant_upload_path_title">Igotzetarako Bidea</string>
   <string name="share_link_no_support_share_api">Sentitzen dut, partekatzea ez dago zure zerbitzarian gaituta. Mesedez jarri harremanetan zure administratzailearekin.</string>
+  <string name="share_link_file_no_exist">Ezin izan da partekatu. Mesedez egiaztatu fitxategia existitzen dela</string>
   <string name="share_link_file_error">Errore bat egon da fitxategaia edo karpeta partekatzerakoan</string>
+  <string name="unshare_link_file_no_exist">Ezin izan da partekatzea desegin. Mesedez egiaztatu fitxategia existitzen dela</string>
   <string name="unshare_link_file_error">Errore bat egon da fitxategaia edo karpeta partekatzeari uzterakoan</string>
   <string name="activity_chooser_send_file_title">Bidali</string>
   <string name="copy_link">Lotura kopiatu</string>
@@ -271,10 +276,23 @@ Mesedez, baimendu berriz</string>
   <string name="downloader_download_file_not_found">Fitxategia jadanik ez dago eskuragarri zerbitzarian</string>
   <string name="prefs_category_accounts">Kontuak</string>
   <string name="prefs_add_account">Gehitu kontua</string>
+  <string name="auth_redirect_non_secure_connection_title">Konexio segurua birbideratu da segurua ez den bide batera.</string>
+  <string name="actionbar_logger">Egunkariak</string>
+  <string name="log_send_history_button">Bidali Historia</string>
+  <string name="log_send_no_mail_app">Egunkariak bidaltzeko aplikaziorik ez da aurkitu. Instalatu posta aplikazioa!</string>
+  <string name="log_send_mail_subject">%1$s Android aplikazioaren egunerokoak</string>
+  <string name="log_progress_dialog_text">Datuak kargatzen...</string>
   <string name="saml_authentication_required_text">Autentikazioa beharrezkoa</string>
   <string name="saml_authentication_wrong_pass">Pasahitz okerra</string>
   <string name="actionbar_move">Mugitu</string>
+  <string name="file_list_empty_moving">Hemen ez dago ezer. Karpeta bat gehi dezakezu!</string>
   <string name="folder_picker_choose_button_text">Aukeratu</string>
+  <string name="move_file_not_found">Ezin izan da mugitu. Mesedez egiaztatu fitxategia existitzen dela</string>
+  <string name="move_file_invalid_overwrite">Fitxategia dagoeneko existitzen da helburuko karpetan</string>
+  <string name="move_file_error">Errore bat gertatu da fitxategi edo karpeta hau mugitzen saiatzerakoan</string>
+  <string name="forbidden_permissions_move">fitxategi hau mugitzeko</string>
   <string name="prefs_category_instant_uploading">Berehalako Igoerak</string>
   <string name="prefs_category_security">Segurtasuna</string>
+  <string name="prefs_instant_video_upload_path_title">Bideo Igoera Bidea</string>
+  <string name="download_folder_failed_content">%1$s karpetaren deskarga ezin izan da burutu</string>
 </resources>
index 4ba0fcf..e69853b 100644 (file)
@@ -75,6 +75,7 @@
   <string name="filedetails_sync_file">Päivitä tiedosto</string>
   <string name="filedetails_renamed_in_upload_msg">Tiedoston nimeksi muutettiin %1$s siirron yhteydessä</string>
   <string name="action_share_file">Jaa linkki</string>
+  <string name="action_unshare_file">Poista linkin jako</string>
   <string name="common_yes">Kyllä</string>
   <string name="common_no">Ei</string>
   <string name="common_ok">OK</string>
   <string name="pincode_wrong">Väärä sovelluksen PIN</string>
   <string name="pincode_removed">Sovelluksen PIN poistettu</string>
   <string name="pincode_stored">Sovelluksen PIN-koodi tallennettu</string>
+  <string name="media_notif_ticker">%1$s-musiikkisoitin</string>
   <string name="media_state_playing">%1$s (toistetaan)</string>
   <string name="media_state_loading">%1$s (ladataan)</string>
   <string name="media_err_nothing_to_play">Mediatiedostoa ei löytynyt</string>
   <string name="media_err_no_account">Tiliä ei määritetty</string>
   <string name="media_err_not_in_owncloud">Tiedosto ei ole kelvollisella tilillä</string>
+  <string name="media_err_unsupported">Mediakoodekki ei ole tuettu</string>
   <string name="media_err_io">Mediatiedoston luku ei onnistunut</string>
+  <string name="media_err_malformed">Mediatiedostoa ei ole koodattu kelvollisesti</string>
   <string name="media_err_timeout">Aikakatkaisu toistoa yrittäessä</string>
   <string name="media_err_invalid_progressive_playback">Mediatiedostoa ei voi suoratoistaa</string>
   <string name="media_err_security_ex">Turvallisuusvirhe yrittäessä toistaa kohdetta %1$s</string>
   <string name="auth_testing_connection">Testataan yhteyttä...</string>
   <string name="auth_not_configured_title">Väärin tehdyt palvelin-asetukset</string>
   <string name="auth_account_not_new">Laitteella on jo tili samalle käyttäjälle ja palvelimelle</string>
+  <string name="auth_account_not_the_same">Syötetty käyttäjä ei täsmää tämän tilin käyttäjän kanssa</string>
   <string name="auth_unknown_error_title">Tuntematon virhe</string>
   <string name="auth_unknown_host_title">Isäntää ei löydy</string>
   <string name="auth_incorrect_path_title">Palvelin-instanssia ei löydetty</string>
   <string name="auth_unsupported_auth_method">Palvelin ei tue tätä tunnistautumistapaa</string>
   <string name="auth_unsupported_multiaccount">%1$s ei tue useita tilejä</string>
   <string name="auth_can_not_auth_against_server">Tunnistautuminen palvelinta vastaan ei onnistu</string>
+  <string name="auth_account_does_not_exist">Tiliä ei ole olemassa vielä laitteella</string>
   <string name="fd_keep_in_sync">Pidä tiedosto ajan tasalla</string>
   <string name="common_rename">Nimeä uudelleen</string>
   <string name="common_remove">Poista</string>
   <string name="move_file_error">Tämän tiedoston tai kansion siirtoa yrittäessä tapahtui virhe</string>
   <string name="prefs_category_instant_uploading">Välittömät lähetykset</string>
   <string name="prefs_category_security">Tietoturva</string>
+  <string name="subject_token">%1$s jakoi kohteen \"%2$s\" kanssasi</string>
 </resources>
index a49a409..f52eec6 100644 (file)
   <string name="actionbar_see_details">Détails</string>
   <string name="actionbar_send_file">Envoyer</string>
   <string name="actionbar_sort">Trier</string>
-  <string name="actionbar_sort_title">Trier par</string>
+  <string name="actionbar_sort_title">Trier</string>
   <string-array name="actionbar_sortby">
-    <item>A-Z</item>
-    <item>Plus récent - Plus ancien</item>
+    <item>par ordre alphabétique</item>
+    <item>du plus récent au plus ancien</item>
   </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Général</string>
   <string name="prefs_category_more">Plus</string>
   <string name="prefs_accounts">Comptes</string>
-  <string name="prefs_manage_accounts">Gestion des comptes utilisateur</string>
-  <string name="prefs_pincode">Utilisation d\'un code de sécurité</string>
-  <string name="prefs_pincode_summary">Protéger l\'accès aux données manipulées par le client</string>
-  <string name="prefs_instant_upload">Téléchargements instantanés d\'images</string>
-  <string name="prefs_instant_upload_summary">Téléversement instantané des photos prises par la caméra</string>
-  <string name="prefs_instant_video_upload">Téléchargements instantanés de vidéos</string>
-  <string name="prefs_instant_video_upload_summary">Téléversement instantané des vidéos prises par la caméra</string>
+  <string name="prefs_manage_accounts">Gestion des comptes</string>
+  <string name="prefs_pincode">Code de sécurité</string>
+  <string name="prefs_pincode_summary">Protéger l\'accès à l\'application</string>
+  <string name="prefs_instant_upload">Téléversement immédiat des photos</string>
+  <string name="prefs_instant_upload_summary">Téléverser immédiatement les photos prises par la caméra</string>
+  <string name="prefs_instant_video_upload">Téléversement immédiat des vidéos</string>
+  <string name="prefs_instant_video_upload_summary">Téléverser immédiatement les vidéos prises par la caméra</string>
   <string name="prefs_log_title">Activer les logs</string>
   <string name="prefs_log_summary">Utilisé pour enregistrer les problèmes dans les logs</string>
   <string name="prefs_log_title_history">Historique des logs</string>
   <string name="prefs_feedback">Commentaires</string>
   <string name="prefs_imprint">Empreinte</string>
   <string name="prefs_remember_last_share_location">Mémoriser l\'emplacement de partage</string>
-  <string name="prefs_remember_last_upload_location_summary">Mémoriser le dernier emplacement d\'upload</string>
-  <string name="recommend_subject">Essayez %1$s sur votre smartphone&amp;nbsp;!</string>
+  <string name="prefs_remember_last_upload_location_summary">Mémoriser le dernier emplacement de téléversement</string>
+  <string name="recommend_subject">Essayez %1$s sur votre smartphone !</string>
   <string name="recommend_text">J\'aimerais vous inviter à utiliser %1$s sur votre smartphone !
 Téléchargez-le ici : %2$s</string>
   <string name="auth_check_server">Vérifier le serveur</string>
   <string name="auth_host_url">Adresse du serveur https://…</string>
   <string name="auth_username">Nom d\'utilisateur</string>
   <string name="auth_password">Mot de passe</string>
-  <string name="auth_register">Nouveau dans %1$s&amp;nbsp;?</string>
+  <string name="auth_register">Nouveau dans %1$s ?</string>
   <string name="sync_string_files">Fichiers</string>
   <string name="setup_btn_connect">Connecter</string>
   <string name="uploader_btn_upload_text">Téléverser</string>
   <string name="uploader_top_message">Sélectionner le dossier d\'envoi :</string>
   <string name="uploader_wrn_no_account_title">Aucun compte n\'a été trouvé</string>
   <string name="uploader_wrn_no_account_text">Aucun compte %1$s n\'a été trouvé. Veuillez commencer par en configurer un.</string>
-  <string name="uploader_wrn_no_account_setup_btn_text">Paramètres</string>
+  <string name="uploader_wrn_no_account_setup_btn_text">Configuration</string>
   <string name="uploader_wrn_no_account_quit_btn_text">Quitter</string>
   <string name="uploader_wrn_no_content_title">Rien à envoyer</string>
   <string name="uploader_wrn_no_content_text">Aucun contenu reçu. Rien à envoyer.</string>
   <string name="uploader_error_forbidden_content">%1$s n\'est pas autorisé à accéder au contenu partagé</string>
-  <string name="uploader_info_uploading">Téléversement</string>
+  <string name="uploader_info_uploading">Téléversement...</string>
   <string name="file_list_seconds_ago">il y a quelques secondes</string>
   <string name="file_list_empty">Il n\'y a rien ici ! Envoyez donc quelque chose :)</string>
   <string name="file_list_loading">Chargement…</string>
@@ -68,7 +68,7 @@ Téléchargez-le ici : %2$s</string>
   <string name="file_list_folders">dossiers</string>
   <string name="file_list_file">fichier</string>
   <string name="file_list_files">fichiers</string>
-  <string name="filedetails_select_file">Effleurez un fichier pour afficher les informations complémentaires</string>
+  <string name="filedetails_select_file">Effleurez un fichier pour afficher les informations complémentaires.</string>
   <string name="filedetails_size">Taille :</string>
   <string name="filedetails_type">Type :</string>
   <string name="filedetails_created">Créé le :</string>
@@ -82,7 +82,7 @@ Téléchargez-le ici : %2$s</string>
   <string name="common_no">Non</string>
   <string name="common_ok">OK</string>
   <string name="common_cancel_download">Annuler le téléchargement</string>
-  <string name="common_cancel_upload">Annuler l\'envoi</string>
+  <string name="common_cancel_upload">Annuler le téléversement</string>
   <string name="common_cancel">Annuler</string>
   <string name="common_save_exit">Sauvegarder &amp; Quitter</string>
   <string name="common_error">Erreur</string>
@@ -90,14 +90,14 @@ Téléchargez-le ici : %2$s</string>
   <string name="common_error_unknown">Erreur inconnue </string>
   <string name="about_title">À propos de</string>
   <string name="change_password">Changer de mot de passe</string>
-  <string name="delete_account">Effacer ce compte</string>
+  <string name="delete_account">Supprimer ce compte</string>
   <string name="create_account">Créer un compte</string>
   <string name="upload_chooser_title">Téléverser un fichier depuis…</string>
   <string name="uploader_info_dirname">Nom du dossier</string>
   <string name="uploader_upload_in_progress_ticker">Téléversement…</string>
   <string name="uploader_upload_in_progress_content">Envoi du fichier %2$s : %1$d%% effectués</string>
   <string name="uploader_upload_succeeded_ticker">Téléversement réussi</string>
-  <string name="uploader_upload_succeeded_content_single">Le fichier %1$s a été envoyé avec succès</string>
+  <string name="uploader_upload_succeeded_content_single">Le fichier %1$s a été téléversé avec succès</string>
   <string name="uploader_upload_failed_ticker">Échec de l\'envoi</string>
   <string name="uploader_upload_failed_content_single">L\'envoi de %1$s a échoué</string>
   <string name="uploader_upload_failed_credentials_error">Le téléversement a échoué, vous devez vous connecter à nouveau</string>
@@ -111,31 +111,31 @@ Téléchargez-le ici : %2$s</string>
   <string name="downloader_download_failed_credentials_error">Le téléchargement a échoué, vous devez vous connecter à nouveau</string>
   <string name="common_choose_account">Choisissez un compte</string>
   <string name="sync_fail_ticker">La synchronisation a échoué</string>
-  <string name="sync_fail_ticker_unauthorized">Échec de la synchronisation, vous devez vous reconnecter à nouveau</string>
-  <string name="sync_fail_content">La synchronisation de %1$s ne peut pas être complétée</string>
-  <string name="sync_fail_content_unauthorized">Mot de passe invalide pour %1$s</string>
+  <string name="sync_fail_ticker_unauthorized">Échec de la synchronisation, vous devez vous reconnecter</string>
+  <string name="sync_fail_content">La synchronisation de %1$s n\'a pu être terminée</string>
+  <string name="sync_fail_content_unauthorized">Mot de passe non valide pour %1$s</string>
   <string name="sync_conflicts_in_favourites_ticker">Des conflits ont été trouvés</string>
-  <string name="sync_conflicts_in_favourites_content">%1$d fichiers à garder synchronisés n\'ont put être synchronisé</string>
+  <string name="sync_conflicts_in_favourites_content">%1$d fichiers à garder synchronisés n\'ont pu être synchronisés</string>
   <string name="sync_fail_in_favourites_ticker">La synchronisation des fichiers a échoué</string>
   <string name="sync_fail_in_favourites_content">Le contenu de %1$d fichiers n\'a pu être synchronisé (%2$d conflits)</string>
   <string name="sync_foreign_files_forgotten_ticker">Certains fichiers locaux ont été oubliés</string>
   <string name="sync_foreign_files_forgotten_content">%1$d fichiers du dossier %2$s n\'ont pas pu être copiés dans</string>
-  <string name="sync_foreign_files_forgotten_explanation">Depuis la version 1.3.16, les fichiers envoyé depuis ce périphérique sont copiés dans le dossier local %1$s pour éviter une perte de données lorsqu\'un même fichier est synchronisé avec plusieurs comptes.
+  <string name="sync_foreign_files_forgotten_explanation">Depuis la version 1.3.16, les fichiers envoyés depuis ce périphérique sont copiés dans le dossier local %1$s pour éviter une perte de données lorsqu\'un même fichier est synchronisé avec plusieurs comptes.
 
-En raison de cette modification, tous les fichiers envoyés avec des versions antérieures de cette application ont été copiés dans le dossier %2$s. Cependant une erreur a empêché l\'achèvement de cette opération pendant la synchronisation du compte. Vous pouvez soit laisser les fichiers tels quels et supprimer le lien vers %3$s, soit déplacer les fichiers dans le dossier %1$s et garder le lien vers %4$s.
+En raison de cette modification, tous les fichiers envoyés avec des versions antérieures de cette application ont été copiés dans le dossier %2$s. Cependant, une erreur a empêché l\'achèvement de cette opération pendant la synchronisation du compte. Vous pouvez soit laisser les fichiers tels quels et supprimer le lien vers %3$s, soit déplacer les fichiers dans le dossier %1$s et garder le lien vers %4$s.
 
 Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxquels ils étaient liés.</string>
   <string name="sync_current_folder_was_removed">Le dossier %1$s n\'existe plus</string>
   <string name="foreign_files_move">Tout déplacer</string>
   <string name="foreign_files_success">Tous les fichiers ont été déplacés</string>
   <string name="foreign_files_fail">Certains fichiers n\'ont pu être déplacés</string>
-  <string name="foreign_files_local_text">Local&amp;nbsp;: %1$s</string>
+  <string name="foreign_files_local_text">Local : %1$s</string>
   <string name="foreign_files_remote_text">Distant : %1$s</string>
-  <string name="upload_query_move_foreign_files">Il n\'y a pas assez de place disponible pour copier les fichiers sélectionnés dans le dossier %1$s. Voulez-vous quand même les déplacer ?</string>
+  <string name="upload_query_move_foreign_files">Il n\'y a pas assez de place disponible pour copier les fichiers sélectionnés dans le dossier %1$s. Voulez-vous les déplacer à la place ?</string>
   <string name="pincode_enter_pin_code">Veuillez saisir votre code de sécurité</string>
   <string name="pincode_configure_your_pin">Veuillez saisir votre code de sécurité </string>
-  <string name="pincode_configure_your_pin_explanation">Le code PIN vous sera demandé à chaque lancement de l\'application</string>
-  <string name="pincode_reenter_your_pincode">Veuillez saisir à nouveau votre code de sécurité</string>
+  <string name="pincode_configure_your_pin_explanation">Le code de sécurité vous sera demandé à chaque lancement de l\'application</string>
+  <string name="pincode_reenter_your_pincode">Veuillez saisir de nouveau votre code de sécurité</string>
   <string name="pincode_remove_your_pincode">Retirer le code de sécurité</string>
   <string name="pincode_mismatch">Les deux codes saisis ne concordent pas</string>
   <string name="pincode_wrong">Code de sécurité incorrect</string>
@@ -151,7 +151,7 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="media_err_unsupported">Le codec de ce média n\'est pas pris en charge </string>
   <string name="media_err_io">Le fichier média ne peut pas être lu</string>
   <string name="media_err_malformed">Le fichier média n\'est pas correctement encodé</string>
-  <string name="media_err_timeout">Délai dépassé pour la lecture du morceau.</string>
+  <string name="media_err_timeout">Délai dépassé pour la lecture du morceau</string>
   <string name="media_err_invalid_progressive_playback">Le fichier média ne peut pas être diffusé</string>
   <string name="media_err_unknown">Le fichier média ne peut être joué avec le lecteur standard</string>
   <string name="media_err_security_ex">Erreur de sécurité à la lecture de %1$s</string>
@@ -167,13 +167,13 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="auth_connection_established">Connexion établie</string>
   <string name="auth_testing_connection">Test de la connexion…</string>
   <string name="auth_not_configured_title">Configuration du serveur erronée</string>
-  <string name="auth_account_not_new">Un compte pour le même utilisateur et serveur existe déjà sur ce périphérique</string>
+  <string name="auth_account_not_new">Un compte pour le même utilisateur et serveur existe déjà sur cet appareil</string>
   <string name="auth_account_not_the_same">L\'utilisateur entré ne correspond pas à l\'utilisateur de ce compte</string>
-  <string name="auth_unknown_error_title">Une erreur inconnue s\'est produite</string>
+  <string name="auth_unknown_error_title">Une erreur inconnue s\'est produite.</string>
   <string name="auth_unknown_host_title">Impossible de trouver l\'hôte</string>
   <string name="auth_incorrect_path_title">Aucune instance du serveur n\'a été trouvée</string>
-  <string name="auth_timeout_title">Le serveur met trop longtemps à répondre</string>
-  <string name="auth_incorrect_address_title">Adresse invalide</string>
+  <string name="auth_timeout_title">Le serveur a pris trop de temps à répondre</string>
+  <string name="auth_incorrect_address_title">Adresse non valide</string>
   <string name="auth_ssl_general_error_title">Échec de l\'initialisation SSL</string>
   <string name="auth_ssl_unverified_server_title">Impossible de vérifier l\'identité du serveur SSL</string>
   <string name="auth_bad_oc_version_title">La version du serveur n\'est pas reconnue</string>
@@ -192,29 +192,30 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="auth_fail_get_user_name">Votre serveur a retourné un identifiant d\'utilisateur incorrect. Veuillez prendre contact avec votre administrateur
 </string>
   <string name="auth_can_not_auth_against_server">Impossible de s\'authentifier sur ce serveur</string>
+  <string name="auth_account_does_not_exist">Le compte n\'existe pas encore sur ce périphérique</string>
   <string name="fd_keep_in_sync">Maintenir le fichier à jour</string>
   <string name="common_rename">Renommer</string>
   <string name="common_remove">Supprimer</string>
-  <string name="confirmation_remove_alert">Voulez-vous vraiment supprimer %1$s&amp;nbsp;?</string>
-  <string name="confirmation_remove_folder_alert">Voulez-vous vraiment supprimer %1$s et son contenu&amp;nbsp;?</string>
+  <string name="confirmation_remove_alert">Voulez-vous vraiment supprimer %1$s ?</string>
+  <string name="confirmation_remove_folder_alert">Voulez-vous vraiment supprimer %1$s et son contenu ?</string>
   <string name="confirmation_remove_local">Local seulement</string>
-  <string name="confirmation_remove_folder_local">Le contenu local uniquement</string>
+  <string name="confirmation_remove_folder_local">Contenu local uniquement</string>
   <string name="confirmation_remove_remote">Effacer du serveur</string>
-  <string name="confirmation_remove_remote_and_local">Les deux distant et local</string>
+  <string name="confirmation_remove_remote_and_local">Distant et local</string>
   <string name="remove_success_msg">Suppression effectuée avec succès</string>
   <string name="remove_fail_msg">Suppression impossible</string>
   <string name="rename_dialog_title">Entrez un nouveau nom</string>
   <string name="rename_local_fail_msg">La version locale ne peut être renommée, veuillez réessayer avec un nom différent</string>
   <string name="rename_server_fail_msg">Renommage impossible</string>
   <string name="sync_file_fail_msg">Le fichier distant n\'a pu être vérifié</string>
-  <string name="sync_file_nothing_to_do_msg">Le contenu des fichiers est déjà synchronisé</string>
+  <string name="sync_file_nothing_to_do_msg">Le contenu du fichier est déjà synchronisé</string>
   <string name="create_dir_fail_msg">Le dossier n\'a pas pu être créé</string>
-  <string name="filename_forbidden_characters">Caractères interdits&amp;nbsp;: / \\ &amp;lt; &amp;gt; : " | ? *</string>
+  <string name="filename_forbidden_characters">Caractères interdits : / \\ &lt; &gt; : \" | ? *</string>
   <string name="filename_empty">Le nom du fichier ne peut pas être vide</string>
   <string name="wait_a_moment">Veuillez patienter</string>
   <string name="filedisplay_unexpected_bad_get_content">Problème inattendu. Veuillez essayer une autre application pour la sélection du fichier</string>
   <string name="filedisplay_no_file_selected">Aucun fichier sélectionné</string>
-  <string name="activity_chooser_title">Envoyer un lien à…</string>
+  <string name="activity_chooser_title">Envoyer le lien vers…</string>
   <string name="oauth_check_onoff">Connexion avec oAuth2</string>
   <string name="oauth_login_connection">Connexion au serveur oAuth2…</string>
   <string name="ssl_validator_header">L\'identité du site ne peut être vérifiée</string>
@@ -222,23 +223,23 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="ssl_validator_reason_cert_expired">- Le certificat du serveur a expiré</string>
   <string name="ssl_validator_reason_cert_not_yet_valid">- Le certificat du serveur n\'est pas encore valide</string>
   <string name="ssl_validator_reason_hostname_not_verified">- L\'URL ne correspond pas au nom d\'hôte du certificat</string>
-  <string name="ssl_validator_question">Voulez-vous tout de même faire confiance à ce certificat&amp;nbsp;?</string>
+  <string name="ssl_validator_question">Voulez-vous tout de même faire confiance à ce certificat ?</string>
   <string name="ssl_validator_not_saved">Impossible de sauvegarder le certificat</string>
   <string name="ssl_validator_btn_details_see">Détails</string>
   <string name="ssl_validator_btn_details_hide">Masquer</string>
-  <string name="ssl_validator_label_subject">Délivré à&amp;nbsp;:</string>
-  <string name="ssl_validator_label_issuer">Délivré par&amp;nbsp;:</string>
+  <string name="ssl_validator_label_subject">Délivré à :</string>
+  <string name="ssl_validator_label_issuer">Délivré par :</string>
   <string name="ssl_validator_label_CN">Nom d\'usage :</string>
-  <string name="ssl_validator_label_O">Organisation&amp;nbsp;:</string>
-  <string name="ssl_validator_label_OU">Unité organisationnelle&amp;nbsp;:</string>
-  <string name="ssl_validator_label_C">Pays&amp;nbsp;:</string>
-  <string name="ssl_validator_label_ST">Région&amp;nbsp;:</string>
-  <string name="ssl_validator_label_L">Localisation&amp;nbsp;:</string>
-  <string name="ssl_validator_label_validity">Validité&amp;nbsp;:</string>
-  <string name="ssl_validator_label_validity_from">De&amp;nbsp;:</string>
-  <string name="ssl_validator_label_validity_to">À&amp;nbsp;:</string>
-  <string name="ssl_validator_label_signature">Signature&amp;nbsp;:</string>
-  <string name="ssl_validator_label_signature_algorithm">Algorithme&amp;nbsp;:</string>
+  <string name="ssl_validator_label_O">Organisation :</string>
+  <string name="ssl_validator_label_OU">Unité organisationnelle :</string>
+  <string name="ssl_validator_label_C">Pays :</string>
+  <string name="ssl_validator_label_ST">Région :</string>
+  <string name="ssl_validator_label_L">Localisation :</string>
+  <string name="ssl_validator_label_validity">Validité :</string>
+  <string name="ssl_validator_label_validity_from">D:</string>
+  <string name="ssl_validator_label_validity_to">Au :</string>
+  <string name="ssl_validator_label_signature">Signature :</string>
+  <string name="ssl_validator_label_signature_algorithm">Algorithme :</string>
   <string name="ssl_validator_null_cert">Impossible d\'afficher le certificat.</string>
   <string name="ssl_validator_no_info_about_error">- Aucune information sur l\'erreur</string>
   <string name="placeholder_sentence">Ceci est un espace réservé</string>
@@ -249,16 +250,16 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="placeholder_media_time">12:23:45</string>
   <string name="instant_upload_on_wifi">Téléverser les images via une connexion WiFi uniquement</string>
   <string name="instant_video_upload_on_wifi">Téléverser les vidéos via une connexion WiFi uniquement</string>
-  <string name="instant_upload_path">/TéléversementInstantané</string>
+  <string name="instant_upload_path">/InstantUpload</string>
   <string name="conflict_title">Conflit de mise à jour</string>
-  <string name="conflict_message">Le fichier distant %s n\'est pas synchronisé avec le fichier local. En choisissant de continuer, vous remplacerez le contenu de fichier sur le serveur.</string>
+  <string name="conflict_message">Le fichier distant %s n\'est pas synchronisé avec le fichier local. En choisissant de continuer, vous remplacerez le contenu du fichier sur le serveur.</string>
   <string name="conflict_keep_both">Garder les deux versions</string>
   <string name="conflict_overwrite">Écraser</string>
   <string name="conflict_dont_upload">Ne pas téléverser</string>
   <string name="preview_image_description">Prévisualisation de l\'image</string>
   <string name="preview_image_error_unknown_format">Cette image ne peut pas être affichée</string>
   <string name="error__upload__local_file_not_copied">%1$s n\'a pas pu être copié dans le dossier local %2$s</string>
-  <string name="prefs_instant_upload_path_title">Chemin d\'accès pour le téléversement</string>
+  <string name="prefs_instant_upload_path_title">Répertoire de téléversement</string>
   <string name="share_link_no_support_share_api">Désolé, le partage n\'est pas disponible sur votre serveur. Veuillez contacter votre administrateur.</string>
   <string name="share_link_file_no_exist">Impossible de partager. Vérifiez que le fichier est bien présent</string>
   <string name="share_link_file_error">Une erreur est survenue lors de la tentative de partage de ce fichier ou répertoire</string>
@@ -267,11 +268,11 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="activity_chooser_send_file_title">Envoyer</string>
   <string name="copy_link">Copier le lien</string>
   <string name="clipboard_text_copied">Copié dans le presse-papiers</string>
-  <string name="error_cant_bind_to_operations_service">Erreur critique&amp;nbsp;: impossible de réaliser des opérations</string>
-  <string name="network_error_socket_exception">Une erreur s\'est produite pendant la connection au serveur</string>
-  <string name="network_error_socket_timeout_exception">Une erreur est survenue pendant l\'attente du serveur. L\'opération n\'a pas pu être effectuée.</string>
-  <string name="network_error_connect_timeout_exception">Une erreur est survenue pendant l\'attente du serveur. L\'opération n\'a pas pu être effectuée.</string>
-  <string name="network_host_not_available">L\'opération n\'a pas pu être terminée, le serveur n\'est pas disponible.</string>
+  <string name="error_cant_bind_to_operations_service">Erreur critique : impossible de réaliser des opérations</string>
+  <string name="network_error_socket_exception">Une erreur est survenue pendant la connexion au serveur.</string>
+  <string name="network_error_socket_timeout_exception">Une erreur est survenue pendant l\'attente du serveur. L\'opération n\'a pas pu être effectuée</string>
+  <string name="network_error_connect_timeout_exception">Une erreur est survenue pendant l\'attente du serveur. L\'opération n\'a pas pu être effectuée</string>
+  <string name="network_host_not_available">L\'opération n\'a pas pu être terminée, le serveur n\'est pas disponible</string>
   <string name="empty"></string>
   <string name="forbidden_permissions">Vous ne possédez pas les droits suffisants %s</string>
   <string name="forbidden_permissions_rename">afin de renommer ce fichier</string>
@@ -283,10 +284,12 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="downloader_download_file_not_found">Ce fichier n’est plus disponible sur le serveur</string>
   <string name="prefs_category_accounts">Comptes</string>
   <string name="prefs_add_account">Ajouter un compte</string>
-  <string name="auth_redirect_non_secure_connection_title">La connexion sécurisée est redirigée via une route non-sécurisée.</string>
+  <string name="auth_redirect_non_secure_connection_title">Le connexion sécurisée est redirigée vers une route non-sécurisée.</string>
   <string name="actionbar_logger">Journaux</string>
   <string name="log_send_history_button">Envoyer l\'historique</string>
-  <string name="log_progress_dialog_text">Chargement des données...</string>
+  <string name="log_send_no_mail_app">Aucune application trouvée pour l\'envoi de journaux. Installer une application de courriel !</string>
+  <string name="log_send_mail_subject">Journaux de l\'application Android %1$s</string>
+  <string name="log_progress_dialog_text">Chargement des données…</string>
   <string name="saml_authentication_required_text">Authentification requise</string>
   <string name="saml_authentication_wrong_pass">Mot de passe incorrect</string>
   <string name="actionbar_move">Déplacer</string>
@@ -297,7 +300,9 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="move_file_invalid_overwrite">Le fichier existe déjà dans le dossier de destination</string>
   <string name="move_file_error">Une erreur est survenue lors de la tentative de déplacement de ce fichier ou dossier</string>
   <string name="forbidden_permissions_move">de déplacer ce fichier</string>
-  <string name="prefs_category_instant_uploading">Téléchargements instantanés</string>
+  <string name="prefs_category_instant_uploading">Envois immédiats</string>
   <string name="prefs_category_security">Sécurité</string>
-  <string name="prefs_instant_video_upload_path_title">Chemin d\'accès pour le téléversement</string>
+  <string name="prefs_instant_video_upload_path_title">Répertoire de téléversement des vidéos</string>
+  <string name="download_folder_failed_content">Le téléchargement du dossier %1$s n\'a pas pu être achevé</string>
+  <string name="subject_token">%1$s a partagé \"%2$s\" avec vous</string>
 </resources>
index 68d5d8c..882f17c 100644 (file)
@@ -8,7 +8,7 @@
   <string name="actionbar_upload_files">Ficheiros</string>
   <string name="actionbar_open_with">Abrir con</string>
   <string name="actionbar_mkdir">Novo cartafol</string>
-  <string name="actionbar_settings">Preferencias</string>
+  <string name="actionbar_settings">Axustes</string>
   <string name="actionbar_see_details">Detalles</string>
   <string name="actionbar_send_file">Enviar</string>
   <string name="actionbar_sort">Ordenar</string>
@@ -188,6 +188,7 @@ Descárgueo de aquí: %2$s</string>
   <string name="auth_fail_get_user_name">O seu servidor non devolveu un ID de usuario correcto, contacte cun administrador
        </string>
   <string name="auth_can_not_auth_against_server">Non pode autenticarse neste servidor</string>
+  <string name="auth_account_does_not_exist">Aínda non existe a conta no dispositivo</string>
   <string name="fd_keep_in_sync">Manter actualizado o ficheiro</string>
   <string name="common_rename">Renomear</string>
   <string name="common_remove">Retirar</string>
@@ -283,6 +284,9 @@ Descárgueo de aquí: %2$s</string>
   <string name="auth_redirect_non_secure_connection_title">A conexión segura está a ser redirixida a unha ruta non segura.</string>
   <string name="actionbar_logger">Rexistros</string>
   <string name="log_send_history_button">Enviar o historial</string>
+  <string name="log_send_no_mail_app">Non se atopou unha aplicación para enviar os rexistros. Instale unha aplicación de correo!</string>
+  <string name="log_send_mail_subject">Rexistros da aplicación %1$s Android</string>
+  <string name="log_progress_dialog_text">Cargando os datos...</string>
   <string name="saml_authentication_required_text">Requírese autenticación</string>
   <string name="saml_authentication_wrong_pass">Contrasinal incorrecto</string>
   <string name="actionbar_move">Mover</string>
@@ -296,4 +300,6 @@ Descárgueo de aquí: %2$s</string>
   <string name="prefs_category_instant_uploading">Envío instantáneo</string>
   <string name="prefs_category_security">Seguranza</string>
   <string name="prefs_instant_video_upload_path_title">Enviar a ruta do vídeo</string>
+  <string name="download_folder_failed_content">Non foi posíbel completar a descarga do cartafol %1$s</string>
+  <string name="subject_token">%1$s compartiu «%2$s» con vostede</string>
 </resources>
index 173239c..eb8bf88 100644 (file)
@@ -1,15 +1,34 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="about_android">%1$s Android aplikacija</string>
+  <string name="about_version">verzija %1$s</string>
+  <string name="actionbar_sync">Osvježi račun</string>
   <string name="actionbar_upload">Učitaj</string>
+  <string name="actionbar_upload_from_apps">Sadržaj iz drugih aplikacija</string>
   <string name="actionbar_upload_files">Datoteke</string>
+  <string name="actionbar_open_with">Otvori sa</string>
   <string name="actionbar_mkdir">Nova mapa</string>
   <string name="actionbar_settings">Postavke</string>
+  <string name="actionbar_see_details">Detalji</string>
   <string name="actionbar_send_file">Pošaljite</string>
+  <string name="actionbar_sort">Sortiraj</string>
+  <string name="actionbar_sort_title">Sortiraj po</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Najnoviji- Stariji</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Općenito</string>
   <string name="prefs_category_more">više</string>
   <string name="prefs_accounts">Korisnićki računi</string>
+  <string name="prefs_manage_accounts">Upravljaj računima</string>
+  <string name="prefs_pincode">PIN aplikacije</string>
+  <string name="prefs_pincode_summary">Zaštit svog klijenta</string>
+  <string name="prefs_instant_upload">Trenutni upload slika</string>
+  <string name="prefs_instant_upload_summary">Trenutni upload slika snimljenih kamerom</string>
+  <string name="prefs_instant_video_upload">Trenutni upload videa</string>
+  <string name="prefs_instant_video_upload_summary">Trenutni upload videa snimljen kamerom</string>
   <string name="prefs_help">Pomoć</string>
   <string name="auth_username">Korisničko ime</string>
   <string name="auth_password">Lozinka</string>
@@ -37,6 +56,7 @@
   <string name="auth_trying_to_login">Trying to login…</string>
   <string name="common_rename">Promjeni ime</string>
   <string name="common_remove">Makni</string>
+  <string name="ssl_validator_btn_details_see">Detalji</string>
   <string name="activity_chooser_send_file_title">Pošaljite</string>
   <string name="empty"></string>
   <string name="prefs_category_accounts">Korisnićki računi</string>
index 94fc138..c4f396f 100644 (file)
   <string name="auth_fail_get_user_name">Il tuo server non ha restituito un id utente corretto, contatta un amministratore
        </string>
   <string name="auth_can_not_auth_against_server">Impossibile eseguire l\'autenticazione su questo server</string>
+  <string name="auth_account_does_not_exist">L\'account non esiste ancora sul dispositivo</string>
   <string name="fd_keep_in_sync">Tieni aggiornato il file</string>
   <string name="common_rename">Rinomina</string>
   <string name="common_remove">Rimuovi</string>
   <string name="prefs_category_instant_uploading">Caricamenti istantanei</string>
   <string name="prefs_category_security">Protezione</string>
   <string name="prefs_instant_video_upload_path_title">Percorso di caricamento video</string>
+  <string name="download_folder_failed_content">Lo scaricamento della cartella %1$s non può essere completato</string>
+  <string name="subject_token">%1$s ha condiviso \"%2$s\" con te</string>
 </resources>
index cbc84bb..e1e1e34 100644 (file)
@@ -64,8 +64,8 @@
   <string name="file_list_empty">ここには何もありません。何かアップロードしてください。</string>
   <string name="file_list_loading">読込中 ...</string>
   <string name="local_file_list_empty">このフォルダーにはファイルがありません。</string>
-  <string name="file_list_folder">フォルダ</string>
-  <string name="file_list_folders">フォルダ</string>
+  <string name="file_list_folder">フォルダ</string>
+  <string name="file_list_folders">フォルダ</string>
   <string name="file_list_file">ファイル</string>
   <string name="file_list_files">ファイル</string>
   <string name="filedetails_select_file">ファイルをタップすると追加情報が表示されます。</string>
   <string name="auth_connecting_auth_server">認証サーバーに接続中 ...</string>
   <string name="auth_unsupported_auth_method">サーバーはこの認証方式をサポートしていません</string>
   <string name="auth_unsupported_multiaccount">%1$s は複数アカウントをサポートしていません</string>
-  <string name="auth_fail_get_user_name">サーバーが正しいユーザーIDを返しませんでした。管理者にご連絡ください。
+  <string name="auth_fail_get_user_name">サーバーが正しいユーザーIDを返しませんでした。管理者に連絡してください。
        </string>
   <string name="auth_can_not_auth_against_server">このサーバーに対して認証できません</string>
+  <string name="auth_account_does_not_exist">デバイス上にまだアカウントが存在しません</string>
   <string name="fd_keep_in_sync">ファイルを最新に保つ</string>
   <string name="common_rename">名前を変更</string>
   <string name="common_remove">削除</string>
   <string name="placeholder_filesize">389 KB</string>
   <string name="placeholder_timestamp">2012/05/18 12:23 PM</string>
   <string name="placeholder_media_time">12:23:45</string>
-  <string name="instant_upload_on_wifi">WiFi経由でのみ写真をアップロード</string>
+  <string name="instant_upload_on_wifi">WiFi経由でのみ画像をアップロード</string>
   <string name="instant_video_upload_on_wifi">WiFi経由でのみ動画をアップロード</string>
   <string name="instant_upload_path">/InstantUpload</string>
   <string name="conflict_title">更新が競合</string>
   <string name="preview_image_error_unknown_format">この画像は表示できません</string>
   <string name="error__upload__local_file_not_copied">%1$s は、ローカルフォルダー %2$s  にコピーできませんでした。</string>
   <string name="prefs_instant_upload_path_title">アップロードパス</string>
-  <string name="share_link_no_support_share_api">申し訳ございません。共有がサーバー上で有効になっていません。 管理者に
-               ご連絡ください。</string>
+  <string name="share_link_no_support_share_api">すみませんが、サーバーで共有が有効になっていません。
+               管理者に連絡してください。</string>
   <string name="share_link_file_no_exist">共有できません。ファイルがあるか確認してください。</string>
   <string name="share_link_file_error">このファイルまたはフォルダーを共有する際にエラーが発生しました</string>
   <string name="unshare_link_file_no_exist">共有を解除できません。ファイルがあるか確認してください。</string>
   <string name="auth_redirect_non_secure_connection_title">暗号化接続は非暗号化接続にリダイレクトされました。</string>
   <string name="actionbar_logger">ログ</string>
   <string name="log_send_history_button">ログを送信</string>
+  <string name="log_send_no_mail_app">ログを送信するアプリが見つかりませんでした。メールアプリをインストールしてください。</string>
+  <string name="log_send_mail_subject">%1$s アンドロイドアプリログ</string>
+  <string name="log_progress_dialog_text">読込中 ...</string>
   <string name="saml_authentication_required_text">認証を必要とする</string>
   <string name="saml_authentication_wrong_pass">無効なパスワード</string>
   <string name="actionbar_move">移動</string>
-  <string name="file_list_empty_moving">ファイルが有りません。フォルダを追加してください。</string>
+  <string name="file_list_empty_moving">何もありません。フォルダーを追加してください。</string>
   <string name="folder_picker_choose_button_text">選択</string>
   <string name="move_file_not_found">移動できません。ファイルがあるか確認してください。</string>
-  <string name="move_file_invalid_into_descendent">ã\83\95ã\82©ã\83«ã\83\80ã\82\92å­\90ã\83\95ã\82©ã\83«ã\83\80へ移動することはできません。</string>
-  <string name="move_file_invalid_overwrite">そのファイルは、宛先フォルダに既に存在しています。</string>
+  <string name="move_file_invalid_into_descendent">ã\83\95ã\82©ã\83«ã\83\80ã\83¼ã\82\92å­\90ã\83\95ã\82©ã\83«ã\83\80ã\83¼へ移動することはできません。</string>
+  <string name="move_file_invalid_overwrite">そのファイルは宛先フォルダーにすでに存在します。</string>
   <string name="move_file_error">このファイルまたはフォルダーを移動する際にエラーが発生しました</string>
   <string name="forbidden_permissions_move">このファイルを移動</string>
   <string name="prefs_category_instant_uploading">自動アップロード</string>
   <string name="prefs_category_security">セキュリティ</string>
   <string name="prefs_instant_video_upload_path_title">動画のアップロードパス</string>
+  <string name="download_folder_failed_content">%1$s のフォルダのダウンロードが完了しませんでした。</string>
+  <string name="subject_token">%1$sがあなたと\"%2$s\"を共有しました</string>
 </resources>
index 36bbbcf..cc48be1 100644 (file)
@@ -1,18 +1,37 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="about_android">%1$s កម្មវិធីអានដ្រយ</string>
+  <string name="about_version">ជំនាន់ %1$s</string>
+  <string name="actionbar_sync">គណនីឱ្យថ្មីឡើងវិញ</string>
   <string name="actionbar_upload">ផ្ទុក​ឡើង</string>
+  <string name="actionbar_upload_from_apps">មាតិការ​ពីកម្មវិធីផ្សេងទៀត</string>
   <string name="actionbar_upload_files">ឯកសារ</string>
+  <string name="actionbar_open_with">បើកជាមួយ</string>
   <string name="actionbar_mkdir">ថត​ថ្មី</string>
   <string name="actionbar_settings">ការកំណត់</string>
   <string name="actionbar_see_details">ព័ត៌មាន​លម្អិត</string>
   <string name="actionbar_send_file">ផ្ញើ</string>
+  <string name="actionbar_sort">តម្រៀប</string>
+  <string name="actionbar_sort_title">តម្រៀបដោយ</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>ថ្មីបំផុត-ចាស់បំផុត</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">ទូទៅ</string>
   <string name="prefs_category_more">ច្រើន​ទៀត</string>
   <string name="prefs_accounts">គណនី</string>
   <string name="prefs_manage_accounts">គ្រប់គ្រង​គណនី</string>
+  <string name="prefs_pincode">ភីន​កូដ កម្មវិធី</string>
+  <string name="prefs_log_title">ដំណើរការការចូលទៅកាន់</string>
+  <string name="prefs_log_summary">នេះជាបញ្ហា​សម្រាប់​អ្នក​ដែល​បាន​ចូលទៅកាន់</string>
+  <string name="prefs_log_title_history">ប្រវត្តិនៃការចូលទៅកាន់</string>
+  <string name="prefs_log_summary_history">នៅទីនេះ​គឺបង្ហាញការដែលបាន​ចូលទៅកាន់</string>
+  <string name="prefs_log_delete_history_button">លុប​ប្រវត្តិ</string>
   <string name="prefs_help">ជំនួយ</string>
+  <string name="prefs_recommend">ផ្ដល់អនុសាសន៍ទៅកាន់មិត្តភក្ដិ</string>
+  <string name="prefs_feedback">មតិត្រឡប់</string>
   <string name="auth_username">ឈ្មោះ​អ្នកប្រើ</string>
   <string name="auth_password">ពាក្យសម្ងាត់</string>
   <string name="sync_string_files">ឯកសារ</string>
@@ -41,6 +60,7 @@
   <string name="common_error">កំហុស</string>
   <string name="common_loading">កំពុងដំណើរការ</string>
   <string name="common_error_unknown">មិន​ស្គាល់​កំហុស</string>
+  <string name="about_title">អំពី</string>
   <string name="change_password">ប្តូរ​ពាក្យសម្ងាត់</string>
   <string name="delete_account">លប់គណនី</string>
   <string name="create_account">បង្កើតគណនី</string>
@@ -69,6 +89,9 @@
   <string name="fd_keep_in_sync">រក្សាឯកសាររហូតដល់កាលបរិច្ឆេទ</string>
   <string name="common_rename">ប្ដូរ​ឈ្មោះ</string>
   <string name="common_remove">ដកចេញ</string>
+  <string name="confirmation_remove_local">ទីកន្លែងតែមួយ</string>
+  <string name="confirmation_remove_remote">ដកចេញពី​សឺវឺ</string>
+  <string name="confirmation_remove_remote_and_local">បញ្ជារ និងទីតាំង</string>
   <string name="remove_success_msg">ការដកយកចេញបានជោគជ័យ</string>
   <string name="remove_fail_msg">ការដកយកចេញបានបរាជ័យ</string>
   <string name="rename_dialog_title">បញ្ចូលឈ្មោះថ្មី</string>
index 69623e1..f55428e 100644 (file)
@@ -1,6 +1,35 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="actionbar_upload">ಪೇರಿಸು</string>
+  <string name="actionbar_upload_files">ಕಡತಗಳು</string>
+  <string name="actionbar_mkdir">ಹೊಸ ಕಡತಕೋಶ</string>
+  <string name="actionbar_settings">ಆಯ್ಕೆ</string>
+  <string name="actionbar_send_file">ಕಳುಹಿಸಿ</string>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
+  <string name="prefs_category_more">ಇನ್ನಷ್ಟು</string>
+  <string name="prefs_help">ಸಹಾಯ</string>
+  <string name="prefs_imprint">ಮುದ್ರೆ</string>
+  <string name="auth_username">ಬಳಕೆಯ ಹೆಸರು</string>
+  <string name="auth_password">ಗುಪ್ತ ಪದ</string>
+  <string name="sync_string_files">ಕಡತಗಳು</string>
+  <string name="uploader_btn_upload_text">ಪೇರಿಸು</string>
+  <string name="filedetails_download">ಪ್ರತಿಯನ್ನು ಸ್ಥಳೀಯವಾಗಿ ಉಳಿಸಿಕೊಳ್ಳಿ</string>
+  <string name="action_share_file">ಸಂಪರ್ಕ ಕೊಂಡಿಯನ್ನು  ಹಂಚಿಕೊಳ್ಳಬಹುದು</string>
+  <string name="common_yes">ಹೌದು</string>
+  <string name="common_no">ಇಲ್ಲ</string>
+  <string name="common_ok">ಸರಿ</string>
+  <string name="common_cancel_upload">ವರ್ಗಾವಣೆ ರದ್ದು ಮಾಡಿ</string>
+  <string name="common_cancel">ರದ್ದು</string>
+  <string name="common_error">ತಪ್ಪಾಗಿದೆ</string>
+  <string name="common_error_unknown">ಗೊತ್ತಿಲ್ಲದ ದೋಷ</string>
+  <string name="change_password">ಗುಪ್ತ ಪದವನ್ನು ಬದಲಾಯಿಸಿ</string>
+  <string name="common_rename">ಮರುಹೆಸರಿಸು</string>
+  <string name="common_remove">ತೆಗೆದುಹಾಕಿ</string>
+  <string name="activity_chooser_send_file_title">ಕಳುಹಿಸಿ</string>
   <string name="empty"></string>
+  <string name="saml_authentication_required_text">ದೃಢೀಕರಣ ಅಗತ್ಯವಿದೆ</string>
+  <string name="saml_authentication_wrong_pass">ದುರ್ಬಲ ಗುಪ್ತಪದ</string>
+  <string name="folder_picker_choose_button_text">ಆಯ್ಕೆ</string>
+  <string name="prefs_category_security">ಭದ್ರತೆ</string>
 </resources>
index 3bb9a60..b58f798 100644 (file)
@@ -6,29 +6,42 @@
   <string name="actionbar_upload">업로드</string>
   <string name="actionbar_upload_from_apps">다른 앱의 콘텐츠</string>
   <string name="actionbar_upload_files">파일</string>
-  <string name="actionbar_open_with">로 열기</string>
+  <string name="actionbar_open_with">ë\8b¤ì\9d\8cì\9c¼ë¡\9c ì\97´ê¸°</string>
   <string name="actionbar_mkdir">새 폴더</string>
   <string name="actionbar_settings">설정</string>
-  <string name="actionbar_see_details">ì\84¸ë¶\80ë\82´ì\9a©</string>
+  <string name="actionbar_see_details">ì\9e\90ì\84¸í\95\9c ì \95ë³´</string>
   <string name="actionbar_send_file">보내기</string>
+  <string name="actionbar_sort">정렬</string>
+  <string name="actionbar_sort_title">정렬 순서</string>
+  <string-array name="actionbar_sortby">
+    <item>가나다</item>
+    <item>최신 - 이전</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">일반</string>
-  <string name="prefs_category_more">더 중요함</string>
+  <string name="prefs_category_more">더 보기</string>
   <string name="prefs_accounts">계정</string>
   <string name="prefs_manage_accounts">계정 관리</string>
   <string name="prefs_pincode">앱 암호</string>
   <string name="prefs_pincode_summary">내 클라이언트 보호</string>
-  <string name="prefs_log_title">로깅 허용</string>
-  <string name="prefs_log_summary">이건 로그 문제에 사용됩니다</string>
+  <string name="prefs_instant_upload">사진 즉시 업로드</string>
+  <string name="prefs_instant_upload_summary">카메라로 찍은 사진 즉시 업로드</string>
+  <string name="prefs_instant_video_upload">동영상 즉시 업로드</string>
+  <string name="prefs_instant_video_upload_summary">카메라로 찍은 동영상 즉시 업로드</string>
+  <string name="prefs_log_title">로그 기록 사용</string>
+  <string name="prefs_log_summary">문제점을 기록하는 데 사용됩니다</string>
   <string name="prefs_log_title_history">로그 기록</string>
   <string name="prefs_log_summary_history">여기서 기록된 로그를 보여줍니다</string>
-  <string name="prefs_log_delete_history_button">역사 삭제하기</string>
+  <string name="prefs_log_delete_history_button">과거 기록 삭제</string>
   <string name="prefs_help">도움말</string>
-  <string name="prefs_recommend">친구들에게 권하기</string>
+  <string name="prefs_recommend">친구에게 추천하기</string>
   <string name="prefs_feedback">피드백</string>
-  <string name="prefs_imprint">임프린트</string>
-  <string name="recommend_subject">%1$s 을 스마트폰에서 사용해보세요!</string>
+  <string name="prefs_imprint">법적 고지</string>
+  <string name="prefs_remember_last_share_location">공유 위치 기억하기</string>
+  <string name="prefs_remember_last_upload_location_summary">마지막 공유 업로드 위치 기억하기</string>
+  <string name="recommend_subject">%1$s을(를) 스마트폰에서 사용해 보세요!</string>
+  <string name="recommend_text">%1$s을(를) 스마트폰에서 사용해 보는 것을 추천합니다!\n다운로드 링크: %2$s</string>
   <string name="auth_check_server">서버 확인</string>
   <string name="auth_host_url">서버 주소 https://…</string>
   <string name="auth_username">사용자 이름</string>
@@ -37,6 +50,7 @@
   <string name="sync_string_files">파일</string>
   <string name="setup_btn_connect">접속</string>
   <string name="uploader_btn_upload_text">업로드</string>
+  <string name="uploader_top_message">업로드 폴더 선택:</string>
   <string name="uploader_wrn_no_account_title">계정 없음</string>
   <string name="uploader_wrn_no_account_text">이 장치에 %1$s 계정이 없습니다. 먼저 계정을 설정하십시오.</string>
   <string name="uploader_wrn_no_account_setup_btn_text">설정</string>
   <string name="uploader_wrn_no_content_text">받은 콘텐츠가 없습니다. 업로드할 항목이 없습니다.</string>
   <string name="uploader_error_forbidden_content">%1$s에서 공유된 콘텐츠에 접근할 수 없습니다</string>
   <string name="uploader_info_uploading">업로드 중</string>
-  <string name="file_list_seconds_ago">ì´\88 ì \84</string>
+  <string name="file_list_seconds_ago">ì´\88 ì§\80ë\82¨</string>
   <string name="file_list_empty">내용이 없습니다. 업로드할 수 있습니다!</string>
+  <string name="file_list_loading">불러오는 중...</string>
+  <string name="local_file_list_empty">이 폴더에 파일이 없습니다.</string>
   <string name="file_list_folder">폴더</string>
   <string name="file_list_folders">폴더</string>
   <string name="file_list_file">파일</string>
   <string name="filedetails_created">만든 날짜:</string>
   <string name="filedetails_modified">수정한 날짜:</string>
   <string name="filedetails_download">다운로드</string>
-  <string name="filedetails_sync_file">파일 새로고침</string>
+  <string name="filedetails_sync_file">파일 새로 고침</string>
   <string name="filedetails_renamed_in_upload_msg">업로드 중 파일 이름을 %1$s(으)로 변경하였습니다</string>
   <string name="action_share_file">링크 공유</string>
+  <string name="action_unshare_file">링크 공유 해제</string>
   <string name="common_yes">예</string>
   <string name="common_no">아니요</string>
   <string name="common_ok">확인</string>
@@ -69,7 +86,7 @@
   <string name="common_save_exit">저장하고 끝내기</string>
   <string name="common_error">오류</string>
   <string name="common_loading">불러오는 중...</string>
-  <string name="common_error_unknown">알없는 오류</string>
+  <string name="common_error_unknown">알 수 없는 오류</string>
   <string name="about_title">정보</string>
   <string name="change_password">암호 변경</string>
   <string name="delete_account">계정 삭제</string>
   <string name="uploader_upload_succeeded_ticker">업로드 성공</string>
   <string name="uploader_upload_succeeded_content_single">%1$s을(를) 업로드하였습니다</string>
   <string name="uploader_upload_failed_ticker">업로드 실패</string>
-  <string name="uploader_upload_failed_content_single">%1$s을(를) 업로드할 수 없었습니다</string>
+  <string name="uploader_upload_failed_content_single">%1$s을(를) 업로드할 수 없습니다</string>
+  <string name="uploader_upload_failed_credentials_error">업로드가 실패하였습니다. 다시 로그인하십시오</string>
   <string name="downloader_download_in_progress_ticker">다운로드 중...</string>
   <string name="downloader_download_in_progress_content">%1$d%% %2$s 다운로드 중</string>
   <string name="downloader_download_succeeded_ticker">다운로드 성공</string>
   <string name="downloader_download_succeeded_content">%1$s을(를) 다운로드하였습니다</string>
   <string name="downloader_download_failed_ticker">다운로드 실패</string>
-  <string name="downloader_download_failed_content">%1$sì\9d\84(를) ë\8b¤ì\9a´ë¡\9cë\93\9cí\95  ì\88\98 ì\97\86ì\97\88ì\8aµë\8b\88ë\8b¤</string>
+  <string name="downloader_download_failed_content">%1$s을(를) 다운로드할 수 없습니다</string>
   <string name="downloader_not_downloaded_yet">아직 다운로드 되지 않았습니다</string>
+  <string name="downloader_download_failed_credentials_error">다운로드가 실패하였습니다. 다시 로그인하십시오</string>
   <string name="common_choose_account">계정 선택</string>
   <string name="sync_fail_ticker">동기화 실패</string>
+  <string name="sync_fail_ticker_unauthorized">동기화가 실패하였습니다. 다시 로그인하십시오</string>
   <string name="sync_fail_content">%1$s와(과) 동기화할 수 없었습니다</string>
-  <string name="sync_fail_content_unauthorized">%1$sì\97\90 ë\8c\80í\95\9c ë¹\84ë°\80ë²\88í\98¸ê°\80 í\8b\80립니다</string>
+  <string name="sync_fail_content_unauthorized">%1$sì\9d\98 ì\95\94í\98¸ê°\80 ì\98¬ë°\94르ì§\80 ì\95\8aì\8aµ니다</string>
   <string name="sync_conflicts_in_favourites_ticker">충돌하는 항목 발견됨</string>
-  <string name="sync_conflicts_in_favourites_content">ë\8f\99기í\99\94ë\90\9c í\8c\8cì\9d¼ ì¤\91 %1$dê°\9c를 ë\8f\99기í\99\94í\95  ì\88\98 ì\97\86ì\97\88ì\8aµë\8b\88ë\8b¤</string>
+  <string name="sync_conflicts_in_favourites_content">동기화된 파일 중 %1$d개를 동기화할 수 없습니다</string>
   <string name="sync_fail_in_favourites_ticker">파일을 동기화할 수 없었습니다</string>
-  <string name="sync_fail_in_favourites_content">파일 %1$d개의 내용을 동기화할 수 없었습니다 (충돌 %2$d개)</string>
-  <string name="sync_foreign_files_forgotten_ticker">몇몇 로컬 파일이 사라졌습니다.</string>
-  <string name="sync_current_folder_was_removed">%1$s 폴더가 존재하지 않습니다.</string>
-  <string name="foreign_files_move">모두 옮김</string>
-  <string name="foreign_files_success">모든 파일 옮김</string>
-  <string name="foreign_files_fail">몇몇 파일을 옮기지 못했습니다.</string>
+  <string name="sync_fail_in_favourites_content">파일 %1$d개의 내용을 동기화할 수 없습니다 (충돌 %2$d개)</string>
+  <string name="sync_foreign_files_forgotten_ticker">일부 로컬 파일이 사라졌습니다.</string>
+  <string name="sync_foreign_files_forgotten_content">폴더 %2$s의 파일 중 %1$d개를 복사할 수 없습니다</string>
+  <string name="sync_foreign_files_forgotten_explanation">버전 1.3.16부터는 하나의 파일이 여러 계정과 동기화될 때 데이터 손실을 막기 위해서 이 장치에서 업로드된 파일은 로컬 폴더 %1$s(으)로 복사됩니다.\n\n이 변경 사항 때문에 이 앱의 이전 버전에서 업로드된 모든 파일은 폴더 %2$s(으)로 복사되었습니다. 계정 동기화 중 오류가 발생하여 이 작업이 중단되었습니다. 파일을 그대로 둔 다음 %3$s(으)로 향한 링크를 삭제하거나, 파일을 직접 폴더 %1$s(으)로 이동한 다음 %4$s(으)로 향한 링크를 그대로 두십시오.\n\n아래 목록은 로컬 파일과 링크가 걸려 있는 %5$s에 있는 원격 파일입니다.</string>
+  <string name="sync_current_folder_was_removed">폴더 %1$s이(가) 더 이상 존재하지 않습니다.</string>
+  <string name="foreign_files_move">모두 이동</string>
+  <string name="foreign_files_success">모든 파일 이동됨</string>
+  <string name="foreign_files_fail">몇몇 파일을 이동할 수 없음</string>
   <string name="foreign_files_local_text">로컬: %1$s</string>
   <string name="foreign_files_remote_text">원격: %1$s</string>
+  <string name="upload_query_move_foreign_files">선택한 파일을 폴더 %1$s(으)로 복사할 공간이 부족합니다. 파일을 이동하시겠습니까?</string>
   <string name="pincode_enter_pin_code">앱 암호를 입력하십시오</string>
   <string name="pincode_configure_your_pin">앱 암호를 입력하십시오</string>
   <string name="pincode_configure_your_pin_explanation">앱을 시작할 때마다 암호를 물어봅니다</string>
   <string name="pincode_removed">앱 암호가 삭제되었습니다</string>
   <string name="pincode_stored">앱 암호가 저장되었습니다</string>
   <string name="media_notif_ticker">%1$s 음악 재생기</string>
-  <string name="media_state_playing">%1$s (재생중)</string>
+  <string name="media_state_playing">%1$s (재생 중)</string>
   <string name="media_state_loading">%1$s (불러오는 중)</string>
   <string name="media_event_done">%1$s 재생 완료됨</string>
-  <string name="media_err_nothing_to_play">미디어 파일을 찾을수 없습니다</string>
+  <string name="media_err_nothing_to_play">미디어 파일을 찾을 수 음</string>
   <string name="media_err_no_account">준비된 계정이 없습니다</string>
   <string name="media_err_not_in_owncloud">유효한 계정의 파일이 아닙니다</string>
   <string name="media_err_unsupported">지원하지 않는 미디어 코덱</string>
-  <string name="media_err_io">미디어 파일을 읽을수 </string>
+  <string name="media_err_io">미디어 파일을 읽을 수 없음</string>
   <string name="media_err_malformed">미디어 파일이 제대로 인코드 되지 않았습니다</string>
   <string name="media_err_timeout">재생 시도 중 시간이 초과됨</string>
-  <string name="media_err_invalid_progressive_playback">미디어 파일을 스트리밍 할수 없습니다</string>
-  <string name="media_err_unknown">내장된 미디어 플레이어에서는 이 미디어 파일을 재생할수 없습니다</string>
-  <string name="media_err_security_ex">%1$s 를 재생하는 중에 보안오류가 발생함</string>
-  <string name="media_err_io_ex">%1$s 를 재생하는 중에 입력 에러가 발생함</string>
-  <string name="media_err_unexpected">%1$s 를 재생하던 중에 알수 없는 오류가 발생함</string>
-  <string name="media_rewind_description">되감기 버튼</string>
-  <string name="media_play_pause_description">재생 혹은 일시정지 버튼</string>
-  <string name="media_forward_description">빨리감기 버튼</string>
-  <string name="auth_trying_to_login">로그인 중...</string>
+  <string name="media_err_invalid_progressive_playback">미디어 파일을 스트리밍 할 수 없습니다</string>
+  <string name="media_err_unknown">내장된 미디어 플레이어에서 이 미디어 파일을 재생할 수 없습니다</string>
+  <string name="media_err_security_ex">%1$s을(를) 재생하는 중 보안 오류가 발생함</string>
+  <string name="media_err_io_ex">%1$s을(를) 재생하는 중 입력 오류가 발생함</string>
+  <string name="media_err_unexpected">%1$s을(를) 재생하는 중 알 수 없는 오류가 발생함</string>
+  <string name="media_rewind_description">되감기 단추</string>
+  <string name="media_play_pause_description">재생 혹은 일시 정지 단추</string>
+  <string name="media_forward_description">빨리감기 단추</string>
+  <string name="auth_getting_authorization">인증 정보 가져오는 중...</string>
+  <string name="auth_trying_to_login">로그인 시도 중...</string>
   <string name="auth_no_net_conn_title">네트워크에 연결할 수 없습니다</string>
   <string name="auth_nossl_plain_ok_title">암호화된 연결을 사용할 수 없습니다.</string>
   <string name="auth_connection_established">연결됨</string>
   <string name="auth_testing_connection">연결 테스트 중...</string>
   <string name="auth_not_configured_title">서버 설정이 잘못됨</string>
   <string name="auth_account_not_new">같은 사용자와 서버에 대한 계정이 이미 존재합니다</string>
-  <string name="auth_account_not_the_same">ì\9e\85ë ¥ë\90\9c ì\82¬ì\9a©ì\9e\90ê°\80 ì\9d´ ê³\84ì \95ì\9d\98 ì\82¬ì\9a©ì\9e\90ì\99\80 ì\9d¼ì¹\98í\95\98ì§\80 ì\95\8aì\9d\8c</string>
+  <string name="auth_account_not_the_same">ì\9e\85ë ¥ë\90\9c ì\82¬ì\9a©ì\9e\90ê°\80 ì\9d´ ê³\84ì \95ì\9d\98 ì\82¬ì\9a©ì\9e\90ì\99\80 ì\9d¼ì¹\98í\95\98ì§\80 ì\95\8aì\8aµë\8b\88ë\8b¤</string>
   <string name="auth_unknown_error_title">알 수 없는 오류가 발생하였습니다!</string>
   <string name="auth_unknown_host_title">호스트를 찾을 수 없음</string>
   <string name="auth_incorrect_path_title">서버 인스턴스를 찾을 수 없음</string>
-  <string name="auth_timeout_title">ì\84\9cë²\84 ì\9d\91ë\8bµ ì\8b\9cê°\84ì\9d´ ì´\88ê³¼ë\90\98ì\97\88ì\8aµë\8b\88ë\8b¤</string>
+  <string name="auth_timeout_title">ì\84\9cë²\84 ì\9d\91ë\8bµ ì\8b\9cê°\84ì\9d´ ì´\88ê³¼ë\90¨</string>
   <string name="auth_incorrect_address_title">잘못된 URL</string>
   <string name="auth_ssl_general_error_title">SSL 초기화 오류</string>
   <string name="auth_ssl_unverified_server_title">SSL 서버의 신원을 확인할수 없습니다</string>
   <string name="auth_bad_oc_version_title">확인할 수 없는 서버 버전</string>
   <string name="auth_wrong_connection_title">연결을 수립할 수 없음</string>
   <string name="auth_secure_connection">암호화된 연결 사용 중</string>
-  <string name="auth_unauthorized">잘못된 로그인/암호</string>
-  <string name="auth_oauth_error">권한부여가 성공적으로 이뤄지지 않았습니다</string>
-  <string name="auth_oauth_error_access_denied">권한 서버로 부터 접근이 거부되었습니다</string>
-  <string name="auth_wtf_reenter_URL">뜻밖의 상태; 다시 서버 주소를 입력해주십시오</string>
-  <string name="auth_expired_oauth_token_toast">인증이 만료되었습니다. 다시 인증해주세요</string>
-  <string name="auth_expired_basic_auth_toast">현재 암호를 </string>
-  <string name="auth_expired_saml_sso_token_toast">세션이 만료되었습니다. 다시 접속해주세요</string>
-  <string name="auth_connecting_auth_server">ì\9d¸ì¦\9d ì\84\9cë²\84ì\97\90 ì \91ì\86\8d하는 중...</string>
+  <string name="auth_unauthorized">잘못된 사용자 이름 및 암호</string>
+  <string name="auth_oauth_error">인증 실패</string>
+  <string name="auth_oauth_error_access_denied">인증 서버 접근 거부됨</string>
+  <string name="auth_wtf_reenter_URL">예상하지 못한 상태입니다. 서버 URL을 다시 입력해 주십시오</string>
+  <string name="auth_expired_oauth_token_toast">인증이 만료되었습니다. 다시 인증해 주십시오</string>
+  <string name="auth_expired_basic_auth_toast">현재 암호를 입력해 주십시오</string>
+  <string name="auth_expired_saml_sso_token_toast">세션이 만료되었습니다. 다시 접속해 주십시오</string>
+  <string name="auth_connecting_auth_server">ì\9d¸ì¦\9d ì\84\9cë²\84ì\97\90 ì\97°ê²°하는 중...</string>
   <string name="auth_unsupported_auth_method">서버에서 이 인증 방법을 지원하지 않습니다.</string>
-  <string name="auth_unsupported_multiaccount">%1$s 에서는 다중 계정을 지원하지 않습니다</string>
+  <string name="auth_unsupported_multiaccount">%1$s에서 다중 계정을 지원하지 않습니다</string>
+  <string name="auth_fail_get_user_name">서버에서 올바른 사용자 ID를 반환하지 않았습니다. 관리자에게 연락하십시오
+       </string>
+  <string name="auth_can_not_auth_against_server">이 서버에 인증할 수 없음</string>
+  <string name="auth_account_does_not_exist">장치에 아직 계정이 존재하지 않습니다.</string>
   <string name="fd_keep_in_sync">파일을 최신 정보로 유지</string>
   <string name="common_rename">이름 바꾸기</string>
   <string name="common_remove">삭제</string>
+  <string name="confirmation_remove_alert">%1$s을(를) 삭제하시겠습니까?</string>
+  <string name="confirmation_remove_folder_alert">%1$s 및 포함된 내용을 삭제하시겠습니까?</string>
   <string name="confirmation_remove_local">로컬만</string>
   <string name="confirmation_remove_folder_local">로컬 콘텐츠만</string>
   <string name="confirmation_remove_remote">서버에서 삭제</string>
   <string name="confirmation_remove_remote_and_local">서버와 로컬 모두</string>
-  <string name="remove_success_msg">ì\84±ê³µì \81ì\9c¼ë¡\9c ì\82­ì \9cí\95\98ì\98\80ì\8aµë\8b\88ë\8b¤</string>
-  <string name="remove_fail_msg">ì\82­ì \9cí\95  ì\88\98 ì\97\86ì\97\88ì\8aµë\8b\88ë\8b¤</string>
+  <string name="remove_success_msg">ì\84±ê³µì \81ì\9c¼ë¡\9c ì\82­ì \9cí\95¨</string>
+  <string name="remove_fail_msg">ì\82­ì \9cí\95  ì\88\98 ì\97\86ì\9d\8c</string>
   <string name="rename_dialog_title">새 이름 입력</string>
   <string name="rename_local_fail_msg">로컬 파일의 이름을 변경할 수 없습니다. 다른 이름을 입력하십시오</string>
-  <string name="rename_server_fail_msg">이름을 변경할 수 없었습니다</string>
-  <string name="sync_file_fail_msg">원격 파일을 확인할 수 없었습니다</string>
-  <string name="sync_file_nothing_to_do_msg">파일 내용이 이미 동기화되었습니다</string>
-  <string name="filename_forbidden_characters">사용할수 없는 문자들: / \\ &lt; &gt; : \" | ? *</string>
+  <string name="rename_server_fail_msg">이름을 변경할 수 없음</string>
+  <string name="sync_file_fail_msg">원격 파일을 확인할 수 없음</string>
+  <string name="sync_file_nothing_to_do_msg">파일 내용이 이미 동기화됨</string>
+  <string name="create_dir_fail_msg">폴더를 만들 수 없음</string>
+  <string name="filename_forbidden_characters">사용할 수 없는 문자: / \\ &lt; &gt; : \" | ? *</string>
+  <string name="filename_empty">파일 이름이 비어 있을 수 없음</string>
   <string name="wait_a_moment">잠시 기다려 주십시오</string>
   <string name="filedisplay_unexpected_bad_get_content">예상하지 못한 오류입니다. 다른 앱에서 파일을 선택하십시오</string>
   <string name="filedisplay_no_file_selected">선택한 파일 없음</string>
+  <string name="activity_chooser_title">다음으로 링크 보내기...</string>
   <string name="oauth_check_onoff">oAuth2로 로그인하기</string>
-  <string name="oauth_login_connection">oAuth2 서버에 연결중...</string>
-  <string name="ssl_validator_header">ì\82¬ì\9d´í\8a¸ ì\9d¸ì¦\9dì\84\9c를 í\99\95ì\9d¸í\95  ì\88\98 ì\97\86ì\97\88ì\8aµë\8b\88ë\8b¤</string>
+  <string name="oauth_login_connection">oAuth2 서버에 연결 중...</string>
+  <string name="ssl_validator_header">사이트 인증서를 확인할 수 없습니다</string>
   <string name="ssl_validator_reason_cert_not_trusted">- 서버 인증서를 신뢰할 수 없습니다</string>
   <string name="ssl_validator_reason_cert_expired">- 서버 인증서가 만료되었습니다</string>
   <string name="ssl_validator_reason_cert_not_yet_valid">- 서버 인증서의 유효 기간이 시작되지 않았습니다</string>
   <string name="ssl_validator_reason_hostname_not_verified">- 인증서의 URL과 입력한 URL이 일치하지 않습니다</string>
   <string name="ssl_validator_question">이 인증서를 신뢰하시겠습니까?</string>
-  <string name="ssl_validator_not_saved">ì\9d¸ì¦\9dì\84\9c를 ì \80ì\9e¥í\95  ì\88\98 ì\97\86ì\97\88ì\8aµë\8b\88ë\8b¤</string>
+  <string name="ssl_validator_not_saved">인증서를 저장할 수 없습니다</string>
   <string name="ssl_validator_btn_details_see">자세히</string>
   <string name="ssl_validator_btn_details_hide">숨기기</string>
   <string name="ssl_validator_label_subject">발급 대상:</string>
   <string name="ssl_validator_label_validity_to">끝:</string>
   <string name="ssl_validator_label_signature">서명:</string>
   <string name="ssl_validator_label_signature_algorithm">알고리즘:</string>
-  <string name="placeholder_sentence">이것은 플레이스홀더입니다</string>
+  <string name="ssl_validator_null_cert">인증서를 표시할 수 없습니다.</string>
+  <string name="ssl_validator_no_info_about_error">- 오류에 대한 정보가 없습니다</string>
+  <string name="placeholder_sentence">이것은 자리 비움자입니다</string>
   <string name="placeholder_filename">placeholder.txt</string>
   <string name="placeholder_filetype">PNG 그림</string>
   <string name="placeholder_filesize">389 KB</string>
   <string name="placeholder_timestamp">2012/05/18 12:23 PM</string>
   <string name="placeholder_media_time">12:23:45</string>
-  <string name="instant_upload_on_wifi">WiFi 사용 중일때만 사진 업로드</string>
+  <string name="instant_upload_on_wifi">Wi-Fi 사용 중일때만 사진 업로드</string>
+  <string name="instant_video_upload_on_wifi">Wi-Fi 사용 중일때만 동영상 업로드</string>
   <string name="instant_upload_path">/InstantUpload</string>
   <string name="conflict_title">업데이트 충돌</string>
   <string name="conflict_message">원격 파일 %s이(가) 로컬 파일과 동기화되지 않았습니다. 계속 진행하면 서버에 있는 파일을 덮어씁니다.</string>
   <string name="conflict_keep_both">모두 저장</string>
   <string name="conflict_overwrite">덮어쓰기</string>
   <string name="conflict_dont_upload">업로드하지 않음</string>
-  <string name="preview_image_description">그림 미리보기</string>
+  <string name="preview_image_description">사진 미리 보기</string>
+  <string name="preview_image_error_unknown_format">이 사진을 미리 볼 수 없습니다</string>
+  <string name="error__upload__local_file_not_copied">%1$s을(를) 로컬 폴더 %2$s(으)로 복사할 수 없습니다</string>
+  <string name="prefs_instant_upload_path_title">업로드 경로</string>
+  <string name="share_link_no_support_share_api">서버에서 공유가 비활성화되어 있습니다. 관리자에게 연락하십시오.</string>
+  <string name="share_link_file_no_exist">공유할 수 없습니다. 파일이 있는지 확인하십시오</string>
+  <string name="share_link_file_error">이 파일이나 폴더를 공유하는 중 오류 발생</string>
+  <string name="unshare_link_file_no_exist">공유를 해제할 수 없습니다. 파일이 있는지 확인하십시오</string>
+  <string name="unshare_link_file_error">이 파일이나 폴더의 공유를 해제하는 중 오류 발생</string>
   <string name="activity_chooser_send_file_title">보내기</string>
-  <string name="copy_link">링크 복사</string>
+  <string name="copy_link">링크 주소 복사</string>
   <string name="clipboard_text_copied">클립보드로 복사됨</string>
+  <string name="error_cant_bind_to_operations_service">치명적 오류: 작업을 진행할 수 없음</string>
+  <string name="network_error_socket_exception">서버에 연결하는 중 오류가 발생하였습니다.</string>
+  <string name="network_error_socket_timeout_exception">서버를 기다리는 중 오류가 발생하였습니다. 작업이 진행되지 않았을 수도 있습니다</string>
+  <string name="network_error_connect_timeout_exception">서버를 기다리는 중 오류가 발생하였습니다. 작업이 진행되지 않았을 수도 있습니다</string>
+  <string name="network_host_not_available">서버를 사용할 수 없어서 작업을 진행할 수 없습니다</string>
   <string name="empty"></string>
+  <string name="forbidden_permissions">%s 권한이 없습니다</string>
+  <string name="forbidden_permissions_rename">이 파일의 이름을 바꿀</string>
+  <string name="forbidden_permissions_delete">이 파일을 삭제할</string>
+  <string name="share_link_forbidden_permissions">이 파일을 공유할</string>
+  <string name="unshare_link_forbidden_permissions">이 파일의 공유를 해제할</string>
+  <string name="forbidden_permissions_create">파일을 생성할</string>
+  <string name="uploader_upload_forbidden_permissions">이 폴더에 업로드할</string>
+  <string name="downloader_download_file_not_found">이 파일을 서버에서 더 이상 사용할 수 없습니다</string>
   <string name="prefs_category_accounts">계정</string>
+  <string name="prefs_add_account">계정 추가</string>
+  <string name="auth_redirect_non_secure_connection_title">보안 연결이 안전하지 않은 경로로 넘어갑니다.</string>
+  <string name="actionbar_logger">로그</string>
+  <string name="log_send_history_button">과거 기록 보내기</string>
+  <string name="log_send_no_mail_app">로그를 보낼 앱이 없습니다. 메일 앱을 설치하십시오!</string>
+  <string name="log_send_mail_subject">%1$s Android 앱 로그</string>
+  <string name="log_progress_dialog_text">데이터 불러오는 중...</string>
   <string name="saml_authentication_required_text">인증 필요함</string>
   <string name="saml_authentication_wrong_pass">잘못된 암호</string>
+  <string name="actionbar_move">이동</string>
+  <string name="file_list_empty_moving">항목이 없습니다. 폴더를 추가할 수 있습니다!</string>
   <string name="folder_picker_choose_button_text">선택</string>
+  <string name="move_file_not_found">이동할 수 없습니다. 파일이 존재하는 지 확인하십시오</string>
+  <string name="move_file_invalid_into_descendent">폴더를 하위 폴더 아래로 이동할 수 없습니다</string>
+  <string name="move_file_invalid_overwrite">파일이 이미 대상 폴더에 존재합니다</string>
+  <string name="move_file_error">이 파일이나 폴더를 이동하는 중 오류가 발생하였습니다</string>
+  <string name="forbidden_permissions_move">이 파일을 이동할</string>
+  <string name="prefs_category_instant_uploading">즉시 업로드</string>
   <string name="prefs_category_security">보안</string>
+  <string name="prefs_instant_video_upload_path_title">동영상 업로드 경로</string>
+  <string name="download_folder_failed_content">%1$s 폴더를 다운로드할 수 없습니다</string>
+  <string name="subject_token">%1$s에서 \"%2$s\"를 당신과 공유하였습니다.</string>
 </resources>
index 9feccd8..09b11cc 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
diff --git a/res/values-lo/strings.xml b/res/values-lo/strings.xml
new file mode 100644 (file)
index 0000000..69623e1
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<resources>
+  <!--TODO re-enable when server-side folder size calculation is available   
+       <item>Biggest - Smallest</item>-->
+  <string name="empty"></string>
+</resources>
index 30cca38..76e0e52 100644 (file)
   <string name="actionbar_settings">Nustatymai</string>
   <string name="actionbar_see_details">Informacija</string>
   <string name="actionbar_send_file">Siųsti</string>
+  <string name="actionbar_sort">Rikiuoti</string>
+  <string name="actionbar_sort_title">Rikiuoti pagal</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Naujausi - Seniausi</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Bendras</string>
@@ -32,6 +38,8 @@
   <string name="prefs_recommend">Rekomenduoti draugui</string>
   <string name="prefs_feedback">Atsiliepimai</string>
   <string name="prefs_imprint">Imprint</string>
+  <string name="prefs_remember_last_share_location">Prisiminti bendrinimo vietą</string>
+  <string name="prefs_remember_last_upload_location_summary">Prisiminti paskutinio bendrinimo įkėlimo vietą</string>
   <string name="recommend_subject">Išbandykite %1$s savo išmaniajame telefone!</string>
   <string name="auth_check_server">Patikrinti Serverį</string>
   <string name="auth_host_url">Serverio adresas </string>
index c185f73..0895ca9 100644 (file)
   <string name="activity_chooser_send_file_title">Sūtīt</string>
   <string name="empty"></string>
   <string name="prefs_category_accounts">Konti</string>
+  <string name="saml_authentication_wrong_pass">Nepareiza parole</string>
   <string name="folder_picker_choose_button_text">Izvēlieties</string>
   <string name="prefs_category_security">Drošība</string>
 </resources>
index 69623e1..b4185fd 100644 (file)
@@ -1,6 +1,17 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="actionbar_upload">Байршуулах</string>
+  <string name="actionbar_upload_files">Файлууд</string>
+  <string name="actionbar_settings">Тохиргоо</string>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
+  <string name="prefs_category_general">Ерөнхий</string>
+  <string name="auth_username">Хэрэглэгчийн нэр</string>
+  <string name="auth_password">Нууц үг</string>
+  <string name="sync_string_files">Файлууд</string>
+  <string name="uploader_btn_upload_text">Байршуулах</string>
+  <string name="create_account">Аккаунт үүсгэх</string>
+  <string name="common_remove">Устгах</string>
   <string name="empty"></string>
+  <string name="prefs_category_security">Аюулгүй байдал</string>
 </resources>
diff --git a/res/values-mr/strings.xml b/res/values-mr/strings.xml
new file mode 100644 (file)
index 0000000..69623e1
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<resources>
+  <!--TODO re-enable when server-side folder size calculation is available   
+       <item>Biggest - Smallest</item>-->
+  <string name="empty"></string>
+</resources>
index 98f4ff6..3336ec1 100644 (file)
   <string name="actionbar_settings">Innstillinger</string>
   <string name="actionbar_see_details">Detaljer</string>
   <string name="actionbar_send_file">Send</string>
+  <string name="actionbar_sort">Sorter</string>
+  <string name="actionbar_sort_title">Sorter etter</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Nyeste - Eldste</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Generelt</string>
@@ -32,6 +38,8 @@
   <string name="prefs_recommend">Anbefal til en venn</string>
   <string name="prefs_feedback">Tilbakemelding</string>
   <string name="prefs_imprint">Avtrykk</string>
+  <string name="prefs_remember_last_share_location">Husk delt plassering</string>
+  <string name="prefs_remember_last_upload_location_summary">Husk sist delt plassering for opplasting</string>
   <string name="recommend_subject">Prøv %1$s på smarttelefonen din!</string>
   <string name="recommend_text">Jeg ønsker å invitere deg til å bruke %1$s på smarttelefonen din!\nLast ned her: %2$s</string>
   <string name="auth_check_server">Sjekk server</string>
   <string name="preview_image_description">Bildeforhåndsvisning</string>
   <string name="preview_image_error_unknown_format">Dette bildet kan ikke vises</string>
   <string name="error__upload__local_file_not_copied">%1$s kunne ikke kopieres til lokal mappe %2$s</string>
+  <string name="prefs_instant_upload_path_title">Sti til opplasting</string>
   <string name="share_link_no_support_share_api">Beklager, deling er ikke skrudd på for din tjener. Ta kontakt med
                administratoren.</string>
   <string name="share_link_file_no_exist">Kan ikke dele. Sjekk om filen eksisterer.</string>
   <string name="downloader_download_file_not_found">Filen finnes ikke på serveren lenger</string>
   <string name="prefs_category_accounts">Kontoer</string>
   <string name="prefs_add_account">Legg til en konto</string>
+  <string name="auth_redirect_non_secure_connection_title">Sikker forbindelse er omdirigert til en usikker rute.</string>
   <string name="actionbar_logger">Logger</string>
   <string name="log_send_history_button">Send historikk</string>
+  <string name="log_send_no_mail_app">Ingen app for sending av logger funnet. Installer epost-app!</string>
+  <string name="log_send_mail_subject">%1$s Android app logger</string>
+  <string name="log_progress_dialog_text">Laster data...</string>
   <string name="saml_authentication_required_text">Autentisering kreves</string>
   <string name="saml_authentication_wrong_pass">Feil passord</string>
   <string name="actionbar_move">Flytt</string>
   <string name="move_file_invalid_overwrite">Filen finnes allerede i målmappen</string>
   <string name="move_file_error">En feil oppstod ved flytting av denne filen eller mappen</string>
   <string name="forbidden_permissions_move">å flytte denne filen</string>
+  <string name="prefs_category_instant_uploading">Umiddelbare opplastinger</string>
   <string name="prefs_category_security">Sikkerhet</string>
+  <string name="prefs_instant_video_upload_path_title">Sti til video-opplasting</string>
+  <string name="download_folder_failed_content">Nedlasting av %1$s mappen kunne ikke fullføres</string>
 </resources>
index a6fc894..f675c09 100644 (file)
@@ -190,6 +190,7 @@ Hieronder staan de lokale bestanden en de externe bestanden in %5$s waar ze naar
   <string name="auth_fail_get_user_name">Uw server geeft geen goede userid terug, neem contact op met uw beheerder
        </string>
   <string name="auth_can_not_auth_against_server">Kan niet authenticeren tegen deze server</string>
+  <string name="auth_account_does_not_exist">Het account bestaat nog niet in dit apparaat</string>
   <string name="fd_keep_in_sync">Houd bestand actueel</string>
   <string name="common_rename">Hernoemen</string>
   <string name="common_remove">Verwijderen</string>
@@ -301,4 +302,6 @@ Hieronder staan de lokale bestanden en de externe bestanden in %5$s waar ze naar
   <string name="prefs_category_instant_uploading">Directe uploads</string>
   <string name="prefs_category_security">Beveiliging</string>
   <string name="prefs_instant_video_upload_path_title">Upload Video Pad</string>
+  <string name="download_folder_failed_content">Download van %1$s map kon niet worden voltooid</string>
+  <string name="subject_token">%1$s deelde \"%2$s\" met u</string>
 </resources>
index 5a0b30d..3623617 100644 (file)
@@ -38,6 +38,8 @@
   <string name="prefs_recommend">Poleć znajomemu</string>
   <string name="prefs_feedback">Wsparcie</string>
   <string name="prefs_imprint">Stopka</string>
+  <string name="prefs_remember_last_share_location">Zapamiętaj położenie udostępnienia</string>
+  <string name="prefs_remember_last_upload_location_summary">Zapamiętaj ostatnią lokalizację wgrywania</string>
   <string name="recommend_subject">Wypróbuj %1$s na swoim smartphonie!</string>
   <string name="recommend_text">Chciałbym zaprosić Cię do używania %1$s na swoim smartfonie!\nŚciągnij tutaj: %2$s</string>
   <string name="auth_check_server">Sprawdź serwer</string>
   <string name="auth_redirect_non_secure_connection_title">Bezpieczne połączenie jest przekierowywane przez niezabezpieczone trasy.</string>
   <string name="actionbar_logger">Logi</string>
   <string name="log_send_history_button">Wyślij historię</string>
+  <string name="log_send_no_mail_app">Brak aplikacji do wysyłania logów. Zainstaluj klienta poczty!</string>
+  <string name="log_send_mail_subject">%1$s Logi aplikacji Android</string>
+  <string name="log_progress_dialog_text">Ładuję dane...</string>
   <string name="saml_authentication_required_text">Wymagana autoryzacja</string>
   <string name="saml_authentication_wrong_pass">Złe hasło</string>
   <string name="actionbar_move">Przenieś</string>
   <string name="forbidden_permissions_move">aby przenieść ten plik</string>
   <string name="prefs_category_instant_uploading">Automatyczne wysyłanie</string>
   <string name="prefs_category_security">Bezpieczeństwo</string>
+  <string name="prefs_instant_video_upload_path_title">Katalog wysyłania dla wideo</string>
+  <string name="download_folder_failed_content">Pobieranie %1$s katalogu nie może zostać ukończone</string>
 </resources>
index 45909b4..baf155f 100644 (file)
   <string name="auth_fail_get_user_name">Seu servidor não está retornando um ID de usuário correto, por favor, entre em contato com um administrador
 ⇥</string>
   <string name="auth_can_not_auth_against_server">Não foi possível autenticar neste servidor</string>
+  <string name="auth_account_does_not_exist">Conta ainda não existe no dispositivo</string>
   <string name="fd_keep_in_sync">Manter arquivo atualizado</string>
   <string name="common_rename">Renomear</string>
   <string name="common_remove">Remover</string>
   <string name="prefs_category_instant_uploading">Envios Instantâneos</string>
   <string name="prefs_category_security">Segurança</string>
   <string name="prefs_instant_video_upload_path_title">Enviar o Caminho do Vídeo</string>
+  <string name="download_folder_failed_content">Baixar %1$s da pasta não pode ser completado</string>
+  <string name="subject_token">%1$s compartilhou \"%2$s\" com você</string>
 </resources>
index 60d9377..6a686c2 100644 (file)
@@ -41,7 +41,7 @@
   <string name="prefs_remember_last_share_location">Lembrar localização de partilha</string>
   <string name="prefs_remember_last_upload_location_summary">Lembrar da última localização de envio de partilha</string>
   <string name="recommend_subject">Test %1$s no seu smartphone!</string>
-  <string name="recommend_text">Quero convidar-te a usares %1$s no teu smartphone!\nFaz download aqui: %2$s</string>
+  <string name="recommend_text">Eu quero convidar-te para usares %1$s no teu smartphone!\nTransfere  aqui: %2$s</string>
   <string name="auth_check_server">Verificar Servidor</string>
   <string name="auth_host_url">Endereço do servidor https://..</string>
   <string name="auth_username">Nome de Utilizador</string>
@@ -52,7 +52,7 @@
   <string name="uploader_btn_upload_text">Enviar</string>
   <string name="uploader_top_message">Escolha a pasta de envio:</string>
   <string name="uploader_wrn_no_account_title">A conta não foi encontrada</string>
-  <string name="uploader_wrn_no_account_text">Não tem nenhuma conta  %1$s no seu dispositivo. Por favor, configure primeiro uma conta.</string>
+  <string name="uploader_wrn_no_account_text">Não existe nenhuma conta %1$s no seu dispositivo. Por favor, configure primeiro uma conta.</string>
   <string name="uploader_wrn_no_account_setup_btn_text">Configurar</string>
   <string name="uploader_wrn_no_account_quit_btn_text">Sair</string>
   <string name="uploader_wrn_no_content_title">Sem conteúdo para enviar</string>
@@ -76,7 +76,7 @@
   <string name="filedetails_sync_file">Atualizar ficheiro</string>
   <string name="filedetails_renamed_in_upload_msg">O ficheiro foi renomeado para %1$s durante o envio.</string>
   <string name="action_share_file">Partilhar a hiperligação</string>
-  <string name="action_unshare_file">Deixar de partilhar a ligação</string>
+  <string name="action_unshare_file">Deixar de partilhar a hiperligação</string>
   <string name="common_yes">Sim</string>
   <string name="common_no">Não</string>
   <string name="common_ok">ACEITAR</string>
   <string name="uploader_upload_succeeded_ticker">Envio bem sucedido</string>
   <string name="uploader_upload_succeeded_content_single">%1$s foi enviado com sucesso</string>
   <string name="uploader_upload_failed_ticker">Não foi possível enviar</string>
-  <string name="uploader_upload_failed_content_single">O envio do ficheiro %1$s não foi concluído.</string>
+  <string name="uploader_upload_failed_content_single">Não foi possível concluir o envio de %1$s.</string>
   <string name="uploader_upload_failed_credentials_error">Falha no carregamento, é necessário fazer novo login</string>
-  <string name="downloader_download_in_progress_ticker">A transferir ...</string>
+  <string name="downloader_download_in_progress_ticker">A transferir...</string>
   <string name="downloader_download_in_progress_content">%1$d%% A transferir %2$s</string>
   <string name="downloader_download_succeeded_ticker">Transferência bem sucedida</string>
-  <string name="downloader_download_succeeded_content">%1$s foi descarregado com sucesso</string>
-  <string name="downloader_download_failed_ticker">Descarga falhou</string>
-  <string name="downloader_download_failed_content">O descarregamento %1$s não foi possível descarregar</string>
+  <string name="downloader_download_succeeded_content">%1$s foi transferido com sucesso</string>
+  <string name="downloader_download_failed_ticker">Transferência falhada</string>
+  <string name="downloader_download_failed_content">Não foi possível concluir a transferência de %1$s</string>
   <string name="downloader_not_downloaded_yet">Ainda não foi transferido</string>
   <string name="downloader_download_failed_credentials_error">Não foi possível transferir, tem de iniciar a sessão novamente</string>
   <string name="common_choose_account">Escolha a conta</string>
   <string name="pincode_configure_your_pin_explanation">O PIN será pedido sempre que a app seja iniciada.</string>
   <string name="pincode_reenter_your_pincode">Por favor, reinsira o PIN da App</string>
   <string name="pincode_remove_your_pincode">Remover o seu PIN da App</string>
-  <string name="pincode_mismatch">Os códigos PIN introduzidos não são iguais.</string>
-  <string name="pincode_wrong">Código PIN Incorrecto.</string>
-  <string name="pincode_removed">PIN da aplicação removido</string>
-  <string name="pincode_stored">PIN da aplicação guardado</string>
+  <string name="pincode_mismatch">Os CÓDIGOS da APP não são iguais</string>
+  <string name="pincode_wrong">CÃ\93DIGO da App Incorreto</string>
+  <string name="pincode_removed">CÓDIGOS da App removido</string>
+  <string name="pincode_stored">CÓDIGO da App guardado</string>
   <string name="media_notif_ticker">%1$s leitor de música</string>
   <string name="media_state_playing">%1$s (a reproduzir)</string>
   <string name="media_state_loading">%1$s (a carregar)</string>
   <string name="media_err_nothing_to_play">Não foi encontrado nenhum ficheiro de média</string>
   <string name="media_err_no_account">Não foi fornecida conta</string>
   <string name="media_err_not_in_owncloud">O ficheiro não está numa conta válida</string>
-  <string name="media_err_unsupported">Codec de média não suportado</string>
-  <string name="media_err_io">Não foi possível reproduzir o ficheiro</string>
+  <string name="media_err_unsupported">Codec de multimédia não suportado</string>
+  <string name="media_err_io">Não foi possível ler o ficheiro de multimédia</string>
   <string name="media_err_malformed">Ficheiro erradamente codificado (codec)</string>
   <string name="media_err_timeout">O tempo de espera para jogar expirou</string>
   <string name="media_err_invalid_progressive_playback">O ficheiro não pode ser reproduzido (streaming)</string>
   <string name="media_err_security_ex">Erro de segurança a tentar reproduzir o ficheiro %1$s</string>
   <string name="media_err_io_ex">Erro de input a tentar reproduzir %1$s</string>
   <string name="media_err_unexpected">Erro inesperado a tentar reproduzir %1$s</string>
-  <string name="media_rewind_description">Botão de rebobinar</string>
-  <string name="media_play_pause_description">Botão Tocar/Pausa</string>
+  <string name="media_rewind_description">Botão de Retroceder</string>
+  <string name="media_play_pause_description">Botão de Reproduzir/Pausar</string>
   <string name="media_forward_description">Botão de avanço rápido</string>
   <string name="auth_getting_authorization">A obter autorização...</string>
-  <string name="auth_trying_to_login">A tentar entrar...</string>
+  <string name="auth_trying_to_login">A tentar iniciar a sessão...</string>
   <string name="auth_no_net_conn_title">Sem ligação à rede</string>
-  <string name="auth_nossl_plain_ok_title">Ligação segura indisponível</string>
+  <string name="auth_nossl_plain_ok_title">Ligação segura indisponível.</string>
   <string name="auth_connection_established">Ligação estabelecida</string>
   <string name="auth_testing_connection">A testar a ligação...</string>
   <string name="auth_not_configured_title">Configuração do servidor incorrecta.</string>
   <string name="auth_account_not_new">Uma conta para este utilizador e servidor já existe no dispositivo</string>
   <string name="auth_account_not_the_same">O utilizador que escreveu não coincide com o nome de utilizador desta conta</string>
   <string name="auth_unknown_error_title">Ocorreu um erro desconhecido!</string>
-  <string name="auth_unknown_host_title">Não é possível encontrar o servidor</string>
-  <string name="auth_incorrect_path_title">Instância servidor não encontrada</string>
-  <string name="auth_timeout_title">O servidor levou demasiado tempo a responder</string>
+  <string name="auth_unknown_host_title">Não foi possível encontrar o anfitrião</string>
+  <string name="auth_incorrect_path_title">Instância do servidor não encontrada</string>
+  <string name="auth_timeout_title">O servidor demorou muito tempo a responder</string>
   <string name="auth_incorrect_address_title">URL errado</string>
   <string name="auth_ssl_general_error_title">Inicialização de SSL falhou</string>
-  <string name="auth_ssl_unverified_server_title">Não foi possível verificar a identidade SSL do servidor</string>
+  <string name="auth_ssl_unverified_server_title">Não foi possível verificar a identidade do servidor SSL</string>
   <string name="auth_bad_oc_version_title">Versão do servidor não reconhecida</string>
   <string name="auth_wrong_connection_title">Não consegue estabelecer ligação</string>
   <string name="auth_secure_connection">Ligação segura estabelecida</string>
   <string name="auth_oauth_error_access_denied">Acesso negado pelo servidor</string>
   <string name="auth_wtf_reenter_URL">Estado inesperado, por favor, digite a URL do servidor novamente</string>
   <string name="auth_expired_oauth_token_toast">O prazo da sua autorização expirou. Por favor renove-a</string>
-  <string name="auth_expired_basic_auth_toast">Por favor, introduza a password actual</string>
+  <string name="auth_expired_basic_auth_toast">Por favor, insira a palavra-passe atual</string>
   <string name="auth_expired_saml_sso_token_toast">A sua sessão expirou. Por favor autentique-se de novo</string>
   <string name="auth_connecting_auth_server">A verificar a sua autenticação no servidor...</string>
   <string name="auth_unsupported_auth_method">O servidor não suporta este método de autenticação</string>
   <string name="auth_unsupported_multiaccount">%1$s não suporta contas múltiplas</string>
   <string name="auth_fail_get_user_name">O seu servidor não transmite o ID correcto. Por favor contacte o administrador.</string>
   <string name="auth_can_not_auth_against_server">Não foi possível autenticar no servidor</string>
+  <string name="auth_account_does_not_exist">Conta ainda não existe no dispositivo</string>
   <string name="fd_keep_in_sync">manter ficheiro actualizado</string>
   <string name="common_rename">Renomear</string>
   <string name="common_remove">Remover</string>
   <string name="prefs_category_instant_uploading">Envios Instantâneos</string>
   <string name="prefs_category_security">Segurança</string>
   <string name="prefs_instant_video_upload_path_title">Envio do Caminho do Vídeo</string>
+  <string name="download_folder_failed_content">Não foi possível completar o download da pasta %1$s</string>
+  <string name="subject_token">%1$s partilhou \"%2$s\" consigo</string>
 </resources>
index bb03b02..d87cea3 100644 (file)
   <string name="prefs_manage_accounts">Administrare conturi</string>
   <string name="prefs_pincode">PIN-ul aplicaţiei</string>
   <string name="prefs_pincode_summary">Protejaţi-vă clientul</string>
-  <string name="prefs_instant_upload">Încărcare instanta de imagine</string>
-  <string name="prefs_instant_upload_summary">Încărca instantaneu imagini luate de camera</string>
+  <string name="prefs_instant_upload">Încărcare instantă de imagini</string>
+  <string name="prefs_instant_upload_summary">Încarcă instantant imagini luate cu camera</string>
   <string name="prefs_instant_video_upload">Încărcare instantă de videoclipuri.</string>
-  <string name="prefs_instant_video_upload_summary">Încarcă videoclipuri instant, filmate cu camera.</string>
+  <string name="prefs_instant_video_upload_summary">Încarcă instant videoclipuri înregistrate cu camera</string>
   <string name="prefs_log_title">Permite logarea</string>
   <string name="prefs_log_summary">Acesta este folosit pentru a înregistra problemele</string>
   <string name="prefs_log_title_history">Istoria logarilor</string>
   <string name="prefs_recommend">Recomandati unui prieten</string>
   <string name="prefs_feedback">Feedback</string>
   <string name="prefs_imprint">Imprint</string>
+  <string name="prefs_remember_last_share_location">Reține contribuie locația</string>
+  <string name="prefs_remember_last_upload_location_summary">Reține locația fișierului încărcat precedent</string>
   <string name="recommend_subject">Încearcă %1$s pe smartphone-ul tău!</string>
+  <string name="recommend_text">Te invit sa folosești %1$s pe smartfonul tău!\nDescarcă aici: %2$s</string>
   <string name="auth_check_server">Verificaţi Serverul</string>
   <string name="auth_host_url">Adresa serverului https://...</string>
   <string name="auth_username">Nume utilizator</string>
   <string name="sync_fail_in_favourites_content">Conținutul a%1$d fișiere nu a putut fi sincronizat (conflicte %2$d)</string>
   <string name="sync_foreign_files_forgotten_ticker">Unele fisiere locale au fost uitate</string>
   <string name="sync_foreign_files_forgotten_content">%1$d fisiere din  dosarul  %2$s nu a putut fi copiat in</string>
+  <string name="sync_foreign_files_forgotten_explanation">Conform ediției 1.3.16, fișierele încărcate de pe această platformă sunt copiate în dosarul local %1$s pentru a preveni pierderi de date atunci cînd un singur fișier este sincronizat cu mai multe conturi.\n\nDin cauza acestei schimbări, toate fișierele încărcate în edițiile precedente ale acestui app au fost încărcate in dosarul %2$s. Însă acest proces nu fost completat in timpul sincronizării contului din cauza unei erori. Ai opțiunea de a lăsa fișierul intact (fișierele intacte) și de a transfera sursa în dosarul %3$s sau de a schimba locația fișierului(-elor) în dosarul %1$s și de a păstra sursa în %4$s.\n\nMai jos găsești enumerate fișierul local(fișierele locale) și fișierul separat(fișierele separate) în %5$s cu sursa respectivă.</string>
   <string name="sync_current_folder_was_removed">Folderul %1$s nu mai există</string>
   <string name="foreign_files_move">Muta tot/toate</string>
   <string name="foreign_files_success">Toate fişierele au fost mutate</string>
   <string name="placeholder_media_time">12:23:45</string>
   <string name="instant_upload_on_wifi">Incarca poze doar via WiFi</string>
   <string name="instant_video_upload_on_wifi">Încarcă videoclipuri doar via WiFi</string>
-  <string name="instant_upload_path">/Încărcare instanta</string>
+  <string name="instant_upload_path">/Încărcare instantă</string>
   <string name="conflict_title">Actualizați conflictul</string>
   <string name="conflict_message">Fișierul de la distanță %s nu este sincronizat cu fișierul local. Continuand, se va înlocui conținutul fișierului de pe server.</string>
   <string name="conflict_keep_both">Pastreaza amandoua</string>
   <string name="preview_image_description">Previzualizare imagine</string>
   <string name="preview_image_error_unknown_format">Aceasta imagine nu poate fi arătată</string>
   <string name="error__upload__local_file_not_copied">%1$s nu a putut fi copiat in dosarul local %2$s </string>
+  <string name="prefs_instant_upload_path_title">Calea de încărcare</string>
   <string name="share_link_no_support_share_api">Ne pare rău, partajarea nu este activată pe server. Vă rugăm să contactați administratorul dvs.</string>
   <string name="share_link_file_error">A apărut o eroare în timp ce încerca să partajeze acest fișier sau folder</string>
   <string name="unshare_link_file_error">A apărut o eroare în timp ce încerca să departajeze sau unshare acest fișier sau folder</string>
   <string name="downloader_download_file_not_found">Fișierul nu mai este disponibil pe server</string>
   <string name="prefs_category_accounts">Conturi</string>
   <string name="prefs_add_account">Adaugă cont</string>
+  <string name="auth_redirect_non_secure_connection_title">Conexiunea securizată este redirecționată către un traseu neasigurat.</string>
+  <string name="actionbar_logger">Înregistrări</string>
+  <string name="log_send_history_button">Trimite Istoria</string>
+  <string name="log_send_no_mail_app">App-ul de trimitere a inregistrărilor nu a fost găsit. Instalează mail app-ul!</string>
+  <string name="log_send_mail_subject">%1$s înregistrările app-ului Android</string>
+  <string name="log_progress_dialog_text">Datele se încarcă...</string>
   <string name="saml_authentication_required_text">Autentificare necesară</string>
   <string name="saml_authentication_wrong_pass">Parolă greșită</string>
   <string name="actionbar_move">Mutare</string>
   <string name="file_list_empty_moving">Nu este nimic aici. Poți adăuga un director!</string>
   <string name="folder_picker_choose_button_text">Alege</string>
+  <string name="move_file_not_found">Incapabil de trasfer. Verifică existența fișierului</string>
+  <string name="move_file_invalid_overwrite">Fișierul există deja în dosarul de destinație</string>
+  <string name="move_file_error">O eroare apare la transferarea acestui fișier sau dosar</string>
   <string name="forbidden_permissions_move">pentru a muta acest fișier</string>
+  <string name="prefs_category_instant_uploading">Încărcări instante</string>
   <string name="prefs_category_security">Securitate</string>
+  <string name="prefs_instant_video_upload_path_title">Calea de încărcare Video</string>
+  <string name="download_folder_failed_content">Descărcarea fișierului %1$s nu s-a finisat</string>
 </resources>
index 2041588..cc73941 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
-  <string name="about_android">%1$s Ð\9fÑ\80иложение Ð´Ð»Ñ\8f Ð\90ндÑ\80оида</string>
-  <string name="about_version">Ð\92ерсия %1$s</string>
+  <string name="about_android">%1$s Ð´Ð»Ñ\8f Android</string>
+  <string name="about_version">версия %1$s</string>
   <string name="actionbar_sync">Обновить учетную запись</string>
   <string name="actionbar_upload">Загрузить</string>
   <string name="actionbar_upload_from_apps">Содержимое из других приложений</string>
   <string name="actionbar_upload_files">Файлы</string>
   <string name="actionbar_open_with">Открыть с помощью</string>
-  <string name="actionbar_mkdir">Новая папка</string>
+  <string name="actionbar_mkdir">Новый каталог</string>
   <string name="actionbar_settings">Настройки</string>
   <string name="actionbar_see_details">Подробно</string>
   <string name="actionbar_send_file">Отправить</string>
@@ -15,7 +15,7 @@
   <string name="actionbar_sort_title">Упорядочить по</string>
   <string-array name="actionbar_sortby">
     <item>А-Я</item>
-    <item>Новые - Старые</item>
+    <item>Новое - Старое</item>
   </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_more">Больше</string>
   <string name="prefs_accounts">Учётные записи</string>
   <string name="prefs_manage_accounts">Управление учётными записями</string>
-  <string name="prefs_pincode">App PIN</string>
+  <string name="prefs_pincode">PIN приложения</string>
   <string name="prefs_pincode_summary">Защитить ваш клиент</string>
-  <string name="prefs_instant_upload">Ð\91Ñ\8bÑ\81Ñ\82Ñ\80ая загрузка фотографий</string>
+  <string name="prefs_instant_upload">Ð\9cгновенная загрузка фотографий</string>
   <string name="prefs_instant_upload_summary">Немедленно загружать фотографии сделанные камерой</string>
-  <string name="prefs_instant_video_upload">Ð\91Ñ\8bÑ\81Ñ\82Ñ\80ая загрузка видео</string>
-  <string name="prefs_instant_video_upload_summary">Ð\91Ñ\8bÑ\81Ñ\82Ñ\80аÑ\8f Ð·Ð°Ð³Ñ\80Ñ\83зка Ð²Ð¸Ð´ÐµÐ¾ Ñ\81 ÐºÐ°Ð¼ÐµÑ\80Ñ\8b</string>
+  <string name="prefs_instant_video_upload">Ð\9cгновенная загрузка видео</string>
+  <string name="prefs_instant_video_upload_summary">Ð\9dемедленно Ð·Ð°Ð³Ñ\80Ñ\83жаÑ\82Ñ\8c Ð²Ð¸Ð´ÐµÐ¾, Ñ\81деланнÑ\8bе ÐºÐ°Ð¼ÐµÑ\80ой</string>
   <string name="prefs_log_title">Включить журналирование</string>
   <string name="prefs_log_summary">Используется для регистрации ошибок</string>
   <string name="prefs_log_title_history">Журнал</string>
@@ -38,7 +38,7 @@
   <string name="prefs_recommend">Рекомендовать другу</string>
   <string name="prefs_feedback">Обратная связь</string>
   <string name="prefs_imprint">Штамп</string>
-  <string name="prefs_remember_last_share_location">Ð\97апомниÑ\82Ñ\8c Ñ\80аÑ\81положение Ð¿Ñ\83бликаÑ\86ии</string>
+  <string name="prefs_remember_last_share_location">Ð\97апомниÑ\82Ñ\8c Ñ\80аÑ\81положение Ð¾Ð±Ñ\89его Ñ\80еÑ\81Ñ\83Ñ\80Ñ\81а</string>
   <string name="prefs_remember_last_upload_location_summary">Запомнить расположение загрузки последней публикации</string>
   <string name="recommend_subject">Попробуйте %1$s на вашем смартфоне!</string>
   <string name="recommend_text">Хочу предложить вам использовать %1$s на смартфоне!\nЗагрузить можно здесь: %2$s
   <string name="sync_string_files">Файлы</string>
   <string name="setup_btn_connect">Подключиться</string>
   <string name="uploader_btn_upload_text">Загрузить</string>
-  <string name="uploader_top_message">Ð\92Ñ\8bбеÑ\80еÑ\82е Ð¿Ð°Ð¿ÐºÑ\83 для загрузки</string>
+  <string name="uploader_top_message">Ð\92Ñ\8bбеÑ\80иÑ\82е ÐºÐ°Ñ\82алог для загрузки</string>
   <string name="uploader_wrn_no_account_title">Учётная запись не найдена</string>
-  <string name="uploader_wrn_no_account_text">Ð\9dа Ð²Ð°Ñ\88ем Ñ\83Ñ\81Ñ\82Ñ\80ойÑ\81Ñ\82ве Ð½ÐµÑ\82 Ñ\83Ñ\87Ñ\91Ñ\82нÑ\8bÑ\85 Ð·Ð°Ð¿Ð¸Ñ\81ей %1$s. Ð¡Ð½Ð°Ñ\87ала Ð½Ñ\83жно Ð½Ð°Ñ\81Ñ\82Ñ\80оиÑ\82Ñ\8c учётную запись.</string>
-  <string name="uploader_wrn_no_account_setup_btn_text">УÑ\81Ñ\82ановка</string>
+  <string name="uploader_wrn_no_account_text">Ð\9dа Ð²Ð°Ñ\88ем Ñ\83Ñ\81Ñ\82Ñ\80ойÑ\81Ñ\82ве Ð½ÐµÑ\82 Ñ\83Ñ\87Ñ\91Ñ\82нÑ\8bÑ\85 Ð·Ð°Ð¿Ð¸Ñ\81ей %1$s. Ð\9fожалÑ\83йÑ\81Ñ\82а, Ð½Ð°Ñ\81Ñ\82Ñ\80ойÑ\82е учётную запись.</string>
+  <string name="uploader_wrn_no_account_setup_btn_text">Ð\9dаÑ\81Ñ\82Ñ\80ойка</string>
   <string name="uploader_wrn_no_account_quit_btn_text">Выход</string>
   <string name="uploader_wrn_no_content_title">Нет содержимого для загрузки</string>
   <string name="uploader_wrn_no_content_text">Содержимое не получено. Нечего загружать.</string>
-  <string name="uploader_error_forbidden_content">%1$s не имеет доступа к опубликованным данным</string>
+  <string name="uploader_error_forbidden_content">Доступ к общему ресурсу для %1$s запрещен</string>
   <string name="uploader_info_uploading">Загрузка</string>
-  <string name="file_list_seconds_ago">только что</string>
+  <string name="file_list_seconds_ago">пару секунд назад</string>
   <string name="file_list_empty">Здесь ничего нет. Загрузите что-нибудь!</string>
   <string name="file_list_loading">Загрузка...</string>
-  <string name="local_file_list_empty">В данной папке нет файлов.</string>
-  <string name="file_list_folder">папка</string>
-  <string name="file_list_folders">папки</string>
+  <string name="local_file_list_empty">В этом каталоге нет файлов.</string>
+  <string name="file_list_folder">каÑ\82алог</string>
+  <string name="file_list_folders">каÑ\82алоги</string>
   <string name="file_list_file">файл</string>
   <string name="file_list_files">файлы</string>
   <string name="filedetails_select_file">Нажмите на файл для отображения дополнительной информации.</string>
@@ -77,7 +77,7 @@
   <string name="filedetails_sync_file">Обновить файл</string>
   <string name="filedetails_renamed_in_upload_msg">Файл был переименован в %1$s во время загрузки</string>
   <string name="action_share_file">Поделиться ссылкой</string>
-  <string name="action_unshare_file">Удалить ссылку</string>
+  <string name="action_unshare_file">УбÑ\80ать ссылку</string>
   <string name="common_yes">Да</string>
   <string name="common_no">Нет</string>
   <string name="common_ok">ОК</string>
   <string name="common_cancel">Отмена</string>
   <string name="common_save_exit">Сохранить и выйти</string>
   <string name="common_error">Ошибка</string>
-  <string name="common_loading">Ð\98дÑ\91Ñ\82 Ð·Ð°Ð³Ñ\80Ñ\83зка...</string>
+  <string name="common_loading">Ð\97агÑ\80Ñ\83зка ...</string>
   <string name="common_error_unknown">Неизвестная ошибка</string>
   <string name="about_title">О программе</string>
   <string name="change_password">Сменить пароль</string>
   <string name="delete_account">Удалить учётную запись</string>
   <string name="create_account">Создать учётную запись</string>
-  <string name="upload_chooser_title">Загрузить из...</string>
-  <string name="uploader_info_dirname">Ð\98мÑ\8f Ð¿Ð°Ð¿ÐºÐ¸</string>
-  <string name="uploader_upload_in_progress_ticker">Загрузка...</string>
-  <string name="uploader_upload_in_progress_content">%1$d%% Ð·Ð°Ð³Ñ\80Ñ\83зки %2$s</string>
+  <string name="upload_chooser_title">Загрузить из ...</string>
+  <string name="uploader_info_dirname">Ð\98мÑ\8f ÐºÐ°Ñ\82алога</string>
+  <string name="uploader_upload_in_progress_ticker">Загрузка ...</string>
+  <string name="uploader_upload_in_progress_content">%1$d%% Ð\97агÑ\80Ñ\83жаеÑ\82Ñ\81Ñ\8f %2$s</string>
   <string name="uploader_upload_succeeded_ticker">Загрузка завершена</string>
   <string name="uploader_upload_succeeded_content_single">%1$s был успешно загружен</string>
   <string name="uploader_upload_failed_ticker">Ошибка загрузки</string>
   <string name="uploader_upload_failed_content_single">Загрузка %1$s не может быть завершена</string>
-  <string name="uploader_upload_failed_credentials_error">Ð\97агÑ\80Ñ\83зка Ð½Ðµ Ñ\83далаÑ\81Ñ\8c, Ð\92ам Ð½ÐµÐ¾Ð±Ñ\85одимо Ð¿ÐµÑ\80еподклÑ\8eÑ\87иÑ\82Ñ\8cÑ\81Ñ\8f</string>
-  <string name="downloader_download_in_progress_ticker">Скачивание...</string>
-  <string name="downloader_download_in_progress_content">%1$d%% скачивания %2$s</string>
+  <string name="uploader_upload_failed_credentials_error">Ð\97агÑ\80Ñ\83зка Ð½Ðµ Ñ\83далаÑ\81Ñ\8c, Ð½Ñ\83жно Ð·Ð°Ð½Ð¾Ð²Ð¾ Ð²Ð¾Ð¹Ñ\82и Ð² Ñ\81воÑ\8e Ñ\83Ñ\87еÑ\82нÑ\83Ñ\8e Ð·Ð°Ð¿Ð¸Ñ\81Ñ\8c</string>
+  <string name="downloader_download_in_progress_ticker">Скачивание ...</string>
+  <string name="downloader_download_in_progress_content">%1$d%% Скачивается %2$s</string>
   <string name="downloader_download_succeeded_ticker">Скачивание завершено</string>
   <string name="downloader_download_succeeded_content">%1$s успешно скачан</string>
   <string name="downloader_download_failed_ticker">Скачивание не удалось</string>
   <string name="downloader_download_failed_content">Скачивание %1$s не может быть завершено</string>
   <string name="downloader_not_downloaded_yet">Ещё не скачано</string>
-  <string name="downloader_download_failed_credentials_error">СкаÑ\87ивание Ð½Ðµ Ñ\83далоÑ\81Ñ\8c, Ð\92ам Ð½ÐµÐ¾Ð±Ñ\85одимо Ð¿ÐµÑ\80еподклÑ\8eÑ\87иÑ\82Ñ\8cÑ\81Ñ\8f</string>
+  <string name="downloader_download_failed_credentials_error">СкаÑ\87ивание Ð½Ðµ Ñ\83далоÑ\81Ñ\8c, Ð½Ñ\83жно Ð·Ð°Ð½Ð¾Ð²Ð¾ Ð²Ð¾Ð¹Ñ\82и Ð² Ñ\81воÑ\8e Ñ\83Ñ\87еÑ\82нÑ\83Ñ\8e Ð·Ð°Ð¿Ð¸Ñ\81Ñ\8c</string>
   <string name="common_choose_account">Выберите учётную запись</string>
   <string name="sync_fail_ticker">Синхронизация прошла неудачно</string>
-  <string name="sync_fail_ticker_unauthorized">СинÑ\85Ñ\80онизаÑ\86иÑ\8f Ð½Ðµ Ñ\83далаÑ\81Ñ\8c, Ð\92ам Ð½ÐµÐ¾Ð±Ñ\85одимо Ð¿ÐµÑ\80еподклÑ\8eÑ\87иÑ\82Ñ\8cÑ\81Ñ\8f</string>
+  <string name="sync_fail_ticker_unauthorized">СинÑ\85Ñ\80онизаÑ\86иÑ\8f Ð½Ðµ Ñ\83далаÑ\81Ñ\8c, Ð½Ñ\83жно Ð·Ð°Ð½Ð¾Ð²Ð¾ Ð²Ð¾Ð¹Ñ\82и Ð² Ñ\81воÑ\8e Ñ\83Ñ\87еÑ\82нÑ\83Ñ\8e Ð·Ð°Ð¿Ð¸Ñ\81Ñ\8c</string>
   <string name="sync_fail_content">Синхронизация %1$s не может быть завершена</string>
   <string name="sync_fail_content_unauthorized">Неверный пароль для %1$s</string>
   <string name="sync_conflicts_in_favourites_ticker">Обнаружены конфликты</string>
-  <string name="sync_conflicts_in_favourites_content">%1$d файлы не могут быть синхронизированы</string>
+  <string name="sync_conflicts_in_favourites_content">%1$d файлов не может быть синхронизировано</string>
   <string name="sync_fail_in_favourites_ticker">Не удалось синхронизировать файлы</string>
   <string name="sync_fail_in_favourites_content">Содержимое %1$d файлов не может быть синхронизировано (конфликтов: %2$d)</string>
-  <string name="sync_foreign_files_forgotten_ticker">Несколько локальных файлов были забыты</string>
-  <string name="sync_foreign_files_forgotten_content"> Не возможно скопировать %1$d файлы из %2$s папки</string>
-  <string name="sync_foreign_files_forgotten_explanation">Ð\9dаÑ\87инаÑ\8f Ñ\81 Ð²ÐµÑ\80Ñ\81ии 1.3.16, Ñ\84айлÑ\8b, Ð·Ð°Ð³Ñ\80Ñ\83жаемÑ\8bе Ñ\81 Ñ\8dÑ\82ого Ñ\83Ñ\81Ñ\82Ñ\80ойÑ\81Ñ\82ва, ÐºÐ¾Ð¿Ð¸Ñ\80Ñ\83Ñ\8eÑ\82Ñ\81Ñ\8f Ð² Ð»Ð¾ÐºÐ°Ð»Ñ\8cнÑ\83Ñ\8e Ð´Ð¸Ñ\80екÑ\82оÑ\80иÑ\8e %1$s, Ñ\87Ñ\82обÑ\8b Ð¿Ñ\80едоÑ\82вÑ\80аÑ\82иÑ\82Ñ\8c Ð¿Ð¾Ñ\82еÑ\80Ñ\8e Ð´Ð°Ð½Ð½Ñ\8bÑ\85 Ð¿Ñ\80и Ñ\81инÑ\85Ñ\80онизаÑ\86ии Ñ\84айла Ñ\81 Ð½ÐµÑ\81колÑ\8cкими Ñ\83Ñ\87Ñ\91Ñ\82нÑ\8bми Ð·Ð°Ð¿Ð¸Ñ\81Ñ\8fми.\n\nÐ\9fоÑ\8dÑ\82омÑ\83 Ð²Ñ\81е Ñ\84айлÑ\8b, Ð·Ð°Ð³Ñ\80Ñ\83женнÑ\8bе Ð¿Ñ\80едÑ\8bдÑ\83Ñ\89ими Ð²ÐµÑ\80Ñ\81иÑ\8fми Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ Ð¿Ñ\80иложениÑ\8f, Ð±Ñ\8bли Ñ\81копиÑ\80ованÑ\8b Ð² Ð´Ð¸Ñ\80екÑ\82оÑ\80иÑ\8e %2$s. Ð\9eднако, Ð²Ð¾ Ð²Ñ\80емÑ\8f Ñ\81инÑ\85Ñ\80онизаÑ\86ии Ñ\87Ñ\82о-Ñ\82о Ð¿Ð¾Ð¼ÐµÑ\88ало Ð·Ð°Ð²ÐµÑ\80Ñ\88иÑ\82Ñ\8c Ñ\8dÑ\82Ñ\83 Ð¾Ð¿ÐµÑ\80аÑ\86иÑ\8e. Ð¢ÐµÐ¿ÐµÑ\80Ñ\8c Ð¼Ð¾Ð¶Ð½Ð¾ Ð»Ð¸Ð±Ð¾ оставить файлы как есть и удалить ссылку на %3$s, либо переместить их в %1$s и сохранить ссылку на %4$s.\n\nНиже перечислены локальные файлы, и соответствующие им удалённые файлы в %5$s, к которым они привязаны.</string>
+  <string name="sync_foreign_files_forgotten_ticker">Некоторые загруженные файлы не были перенесены в локальную папку </string>
+  <string name="sync_foreign_files_forgotten_content"> Невозможно скопировать %1$d файлов из папки %2$s</string>
+  <string name="sync_foreign_files_forgotten_explanation">Ð\9dаÑ\87инаÑ\8f Ñ\81 Ð²ÐµÑ\80Ñ\81ии 1.3.16, Ñ\84айлÑ\8b, Ð·Ð°Ð³Ñ\80Ñ\83жаемÑ\8bе Ñ\81 Ñ\8dÑ\82ого Ñ\83Ñ\81Ñ\82Ñ\80ойÑ\81Ñ\82ва, ÐºÐ¾Ð¿Ð¸Ñ\80Ñ\83Ñ\8eÑ\82Ñ\81Ñ\8f Ð² Ð»Ð¾ÐºÐ°Ð»Ñ\8cнÑ\8bй ÐºÐ°Ñ\82алог %1$s, Ñ\87Ñ\82обÑ\8b Ð¿Ñ\80едоÑ\82вÑ\80аÑ\82иÑ\82Ñ\8c Ð¿Ð¾Ñ\82еÑ\80Ñ\8e Ð´Ð°Ð½Ð½Ñ\8bÑ\85 Ð¿Ñ\80и Ñ\81инÑ\85Ñ\80онизаÑ\86ии Ñ\84айла Ñ\81 Ð½ÐµÑ\81колÑ\8cкими Ñ\83Ñ\87Ñ\91Ñ\82нÑ\8bми Ð·Ð°Ð¿Ð¸Ñ\81Ñ\8fми.\n\nÐ\9fоÑ\8dÑ\82омÑ\83 Ð²Ñ\81е Ñ\84айлÑ\8b, Ð·Ð°Ð³Ñ\80Ñ\83женнÑ\8bе Ð¿Ñ\80едÑ\8bдÑ\83Ñ\89ими Ð²ÐµÑ\80Ñ\81иÑ\8fми Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ Ð¿Ñ\80иложениÑ\8f, Ð±Ñ\8bли Ñ\81копиÑ\80ованÑ\8b Ð² ÐºÐ°Ñ\82алог %2$s. Ð\9eднако, Ð²Ð¾ Ð²Ñ\80емÑ\8f Ñ\81инÑ\85Ñ\80онизаÑ\86ии Ñ\87Ñ\82о-Ñ\82о Ð¿Ð¾Ð¼ÐµÑ\88ало Ð·Ð°Ð²ÐµÑ\80Ñ\88иÑ\82Ñ\8c Ñ\8dÑ\82Ñ\83 Ð¾Ð¿ÐµÑ\80аÑ\86иÑ\8e. Ð\9cожеÑ\82е оставить файлы как есть и удалить ссылку на %3$s, либо переместить их в %1$s и сохранить ссылку на %4$s.\n\nНиже перечислены локальные файлы, и соответствующие им удалённые файлы в %5$s, к которым они привязаны.</string>
   <string name="sync_current_folder_was_removed">Каталог %1$s больше не существует</string>
   <string name="foreign_files_move">Переместить всё</string>
   <string name="foreign_files_success">Все файлы были перемещены</string>
   <string name="foreign_files_fail">Некоторые файлы не могут быть перемещены</string>
-  <string name="foreign_files_local_text">Локально: %1$s</string>
-  <string name="foreign_files_remote_text">Удаленно: %1$s</string>
-  <string name="upload_query_move_foreign_files">Ð\94лÑ\8f ÐºÐ¾Ð¿Ð¸Ñ\80ованиÑ\8f Ð²Ñ\8bбÑ\80аннÑ\8bÑ\85 Ñ\84айлов Ð² Ð¿Ð°Ð¿ÐºÑ\83 %1$s недостаточно свободного места. Скопировать в другое место?</string>
-  <string name="pincode_enter_pin_code">Ð\92Ñ\81Ñ\82авÑ\8cÑ\82е  App PIN</string>
-  <string name="pincode_configure_your_pin">Введите App PIN</string>
-  <string name="pincode_configure_your_pin_explanation">PIN-код будет запрашиваться при каждом запуске приложения.</string>
-  <string name="pincode_reenter_your_pincode">Повторите ввод App PIN</string>
-  <string name="pincode_remove_your_pincode">Удалить App PIN</string>
-  <string name="pincode_mismatch">Введённые App PIN не совпадают</string>
-  <string name="pincode_wrong">Неверный App PIN</string>
-  <string name="pincode_removed">App PIN удалён</string>
-  <string name="pincode_stored">App PIN сохранён</string>
+  <string name="foreign_files_local_text">Локальные: %1$s</string>
+  <string name="foreign_files_remote_text">Удаленные: %1$s</string>
+  <string name="upload_query_move_foreign_files">Ð\94лÑ\8f ÐºÐ¾Ð¿Ð¸Ñ\80ованиÑ\8f Ð²Ñ\8bбÑ\80аннÑ\8bÑ\85 Ñ\84айлов Ð² ÐºÐ°Ñ\82алог %1$s недостаточно свободного места. Скопировать в другое место?</string>
+  <string name="pincode_enter_pin_code">УкажиÑ\82е PIN Ð¿Ñ\80иложениÑ\8f</string>
+  <string name="pincode_configure_your_pin">Введите PIN приложения</string>
+  <string name="pincode_configure_your_pin_explanation">PIN будет запрашиваться при каждом запуске приложения.</string>
+  <string name="pincode_reenter_your_pincode">Повторите ввод PIN приложения</string>
+  <string name="pincode_remove_your_pincode">Удалить PIN приложения</string>
+  <string name="pincode_mismatch">Введённые PIN не совпадают</string>
+  <string name="pincode_wrong">Неверный PIN приложения</string>
+  <string name="pincode_removed">PIN приложения удалён</string>
+  <string name="pincode_stored">PIN приложения сохранён</string>
   <string name="media_notif_ticker">%1$s аудиоплеер</string>
   <string name="media_state_playing">%1$s (проигрывается)</string>
   <string name="media_state_loading">%1$s (загружается)</string>
   <string name="media_event_done">%1$s воспроизведение завершено</string>
-  <string name="media_err_nothing_to_play">Медиафайлов не найдено</string>
-  <string name="media_err_no_account">Учётная запись не настроена</string>
+  <string name="media_err_nothing_to_play">Медиафайлы не найдены</string>
+  <string name="media_err_no_account">Учётная запись не указана</string>
   <string name="media_err_not_in_owncloud">Файл в неверной учётной записи</string>
   <string name="media_err_unsupported">Неподдерживаемый кодек</string>
   <string name="media_err_io">Медиафайл не может быть прочитан</string>
   <string name="media_err_malformed">Медиафайл некорректно закодирован</string>
-  <string name="media_err_timeout">Ð\92Ñ\80емÑ\8f Ð¿Ð¾Ð¿Ñ\8bÑ\82ок Ð²Ð¾Ñ\81пÑ\80оизведениÑ\8f Ð²Ñ\8bÑ\88ло</string>
+  <string name="media_err_timeout">Ð\98Ñ\81Ñ\82екло Ð²Ñ\80емÑ\8f Ð¿Ð¾Ð¿Ñ\8bÑ\82ки Ð²Ð¾Ñ\81пÑ\80оизведениÑ\8f</string>
   <string name="media_err_invalid_progressive_playback">Невозможно организовать потоковую передачу медиафайла</string>
   <string name="media_err_unknown">Медиафайл не может быть проигран стандартным плеером</string>
   <string name="media_err_security_ex">Ошибка безопасности при воспроизведении %1$s</string>
   <string name="media_rewind_description">Перемотка назад</string>
   <string name="media_play_pause_description">Воспроизведение или пауза</string>
   <string name="media_forward_description">Перемотка вперед</string>
-  <string name="auth_getting_authorization">Ð\9fÑ\80оиÑ\81Ñ\85одиÑ\82 Ð°Ð²Ñ\82оÑ\80изаÑ\86иÑ\8f.....</string>
+  <string name="auth_getting_authorization">Ð\92Ñ\8bполнÑ\8fеÑ\82Ñ\81Ñ\8f Ð°Ð²Ñ\82оÑ\80изаÑ\86иÑ\8f...</string>
   <string name="auth_trying_to_login">Попытка входа...</string>
   <string name="auth_no_net_conn_title">Нет подключения к сети</string>
   <string name="auth_nossl_plain_ok_title">Защищённое соединение недоступно.</string>
   <string name="auth_timeout_title">Сервер слишком долго не отвечает</string>
   <string name="auth_incorrect_address_title">Неверный URL</string>
   <string name="auth_ssl_general_error_title">Ошибка инициализации SSL</string>
-  <string name="auth_ssl_unverified_server_title">Невозможно проверить SSL-сертификат сервера</string>
+  <string name="auth_ssl_unverified_server_title">Невозможно проверить SSL подлинность сервера</string>
   <string name="auth_bad_oc_version_title">Неизвестная версия сервера</string>
-  <string name="auth_wrong_connection_title">Невозможно установить соединение</string>
+  <string name="auth_wrong_connection_title">Не удается установить соединение</string>
   <string name="auth_secure_connection">Защищённое соединение установлено</string>
   <string name="auth_unauthorized">Неверное имя пользователя или пароль</string>
   <string name="auth_oauth_error">Ошибка авторизации</string>
   <string name="auth_oauth_error_access_denied">Сервер авторизации отказал в доступе</string>
   <string name="auth_wtf_reenter_URL">Неожиданный ответ; введите адрес сервера ещё раз</string>
   <string name="auth_expired_oauth_token_toast">Время авторизации истекло. Пожалуйста, авторизуйтесь снова</string>
-  <string name="auth_expired_basic_auth_toast">Пожалуйста, введите пароль</string>
+  <string name="auth_expired_basic_auth_toast">Пожалуйста, укажите текущий пароль</string>
   <string name="auth_expired_saml_sso_token_toast">Время сессии истекло. Пожалуйста, подключитесь снова</string>
   <string name="auth_connecting_auth_server">Подключение к серверу аутентификации...</string>
   <string name="auth_unsupported_auth_method">Сервер не поддерживает выбранный метод аутентификации</string>
-  <string name="auth_unsupported_multiaccount">%1$s не поддерживает сразу несколько учётных записей</string>
-  <string name="auth_fail_get_user_name">Ð\92аÑ\88 Ñ\81еÑ\80веÑ\80 Ð½Ðµ Ð²Ð¾Ð·Ð²Ñ\80аÑ\89аеÑ\82 ÐºÐ¾Ñ\80Ñ\80екÑ\82нÑ\8bй Ð¿Ð¾Ð»Ñ\8cзоваÑ\82елÑ\8cÑ\81кий Ð¸Ð´ÐµÐ½Ñ\82иÑ\84икаÑ\82оÑ\80, Ð¿Ð¾Ð¶Ð°Ð»Ñ\83йÑ\81Ñ\82а Ñ\81вÑ\8fжиÑ\82еÑ\81Ñ\8c Ñ\81 администратором
+  <string name="auth_unsupported_multiaccount">%1$s не поддерживает несколько учётных записей</string>
+  <string name="auth_fail_get_user_name">СеÑ\80веÑ\80 Ð²ÐµÑ\80нÑ\83л Ð½ÐµÐºÐ¾Ñ\80Ñ\80екÑ\82нÑ\8bй Ð¿Ð¾Ð»Ñ\8cзоваÑ\82елÑ\8cÑ\81кий Ð¸Ð´ÐµÐ½Ñ\82иÑ\84икаÑ\82оÑ\80. Ð\9fожалÑ\83йÑ\81Ñ\82а, Ñ\81вÑ\8fжиÑ\82еÑ\81Ñ\8c Ñ\81 Ð²Ð°Ñ\88им администратором
 ⇥</string>
-  <string name="auth_can_not_auth_against_server">Невозможно аутентифицироваться на этом сервере</string>
+  <string name="auth_can_not_auth_against_server">Невозможно авторизоваться на этом сервере</string>
+  <string name="auth_account_does_not_exist">Аккаунт не существует на устройстве ещё</string>
   <string name="fd_keep_in_sync">Обновлять файл</string>
   <string name="common_rename">Переименовать</string>
   <string name="common_remove">Удалить</string>
   <string name="rename_server_fail_msg">Переименование не может быть завершено</string>
   <string name="sync_file_fail_msg">Удаленный файл не может быть проверен</string>
   <string name="sync_file_nothing_to_do_msg">Содержимое файла уже синхронизировано</string>
-  <string name="create_dir_fail_msg">Не возможно создать папку</string>
+  <string name="create_dir_fail_msg">Невозможно создать каталог</string>
   <string name="filename_forbidden_characters">Недопустимые символы: / \\ &lt; &gt; : \" | ? *</string>
   <string name="filename_empty">Имя файла не может быть пустым</string>
   <string name="wait_a_moment">Подождите немного</string>
   <string name="filedisplay_unexpected_bad_get_content">Неизвестная ошибка; выберите этот файл из другого приложения</string>
   <string name="filedisplay_no_file_selected">Файлы не выбраны</string>
-  <string name="activity_chooser_title">Отправить ссылку...</string>
+  <string name="activity_chooser_title">Отправить ссылку ...</string>
   <string name="oauth_check_onoff">Войти через oAuth2</string>
   <string name="oauth_login_connection">Подключение к серверу oAuth2...</string>
   <string name="ssl_validator_header">Подлинность сайта не может быть проверена</string>
   <string name="ssl_validator_reason_cert_expired">- Срок действия сертификата сервера истёк</string>
   <string name="ssl_validator_reason_cert_not_yet_valid">- Срок действия сертификата сервера ещё не начался</string>
   <string name="ssl_validator_reason_hostname_not_verified">- URL не совпадает с именем сервера в сертификате</string>
-  <string name="ssl_validator_question">Ð\92Ñ\8b Ñ\85оÑ\82иÑ\82е Ð´Ð¾Ð²ÐµÑ\80Ñ\8fÑ\82Ñ\8c Ð´Ð°Ð½Ð½ому сертификату в любом случае?</string>
+  <string name="ssl_validator_question">Ð\94овеÑ\80Ñ\8fÑ\82Ñ\8c Ñ\8dÑ\82ому сертификату в любом случае?</string>
   <string name="ssl_validator_not_saved">Сертификат не может быть сохранён</string>
   <string name="ssl_validator_btn_details_see">Подробно</string>
   <string name="ssl_validator_btn_details_hide">Скрыть</string>
-  <string name="ssl_validator_label_subject">Кому выдано:</string>
-  <string name="ssl_validator_label_issuer">Кем выдано:</string>
+  <string name="ssl_validator_label_subject">Кому выдан:</string>
+  <string name="ssl_validator_label_issuer">Кем выдан:</string>
   <string name="ssl_validator_label_CN">Имя:</string>
   <string name="ssl_validator_label_O">Организация:</string>
-  <string name="ssl_validator_label_OU">Ð\9eÑ\80ганизаÑ\86ионное Ð¿одразделение:</string>
+  <string name="ssl_validator_label_OU">Ð\9fодразделение:</string>
   <string name="ssl_validator_label_C">Страна:</string>
   <string name="ssl_validator_label_ST">Штат:</string>
   <string name="ssl_validator_label_L">Местонахождение:</string>
   <string name="ssl_validator_label_validity">Срок действия:</string>
-  <string name="ssl_validator_label_validity_from">Ð\98з:</string>
-  <string name="ssl_validator_label_validity_to">Ð\92:</string>
+  <string name="ssl_validator_label_validity_from">С:</string>
+  <string name="ssl_validator_label_validity_to">Ð\9fо:</string>
   <string name="ssl_validator_label_signature">Подпись:</string>
   <string name="ssl_validator_label_signature_algorithm">Алгоритм:</string>
   <string name="ssl_validator_null_cert">Сертификат не может быть показан.</string>
-  <string name="ssl_validator_no_info_about_error">- Ð\98нÑ\84оÑ\80маÑ\86ии Ð¾Ð± Ð¾Ñ\88ибке Ð½ÐµÑ\82</string>
+  <string name="ssl_validator_no_info_about_error">- Ð\9dеÑ\82 Ð¸Ð½Ñ\84оÑ\80маÑ\86ии Ð¾Ð± Ð¾Ñ\88ибке</string>
   <string name="placeholder_sentence">Это заполнитель</string>
   <string name="placeholder_filename">placeholder.txt</string>
   <string name="placeholder_filetype">Изображение PNG</string>
   <string name="placeholder_filesize">389 КБ</string>
   <string name="placeholder_timestamp">2012/05/18 12:23 PM</string>
   <string name="placeholder_media_time">12:23:45</string>
-  <string name="instant_upload_on_wifi">Ð\97агÑ\80Ñ\83жаÑ\82Ñ\8c Ð¸Ð·Ð¾Ð±Ñ\80ажениÑ\8f только через Wi-Fi</string>
+  <string name="instant_upload_on_wifi">Ð\97агÑ\80Ñ\83зка Ð¸Ð·Ð¾Ð±Ñ\80ажений только через Wi-Fi</string>
   <string name="instant_video_upload_on_wifi">Загрузка видео только через WiFi</string>
   <string name="instant_upload_path">/InstantUpload</string>
   <string name="conflict_title">Конфликт обновления</string>
   <string name="conflict_message">Удаленный файл %s не синхронизирован с локальным. Продолжение приведет к замене содержимого файла на сервере.</string>
   <string name="conflict_keep_both">Сохранить оба</string>
-  <string name="conflict_overwrite">Ð\97аменить</string>
+  <string name="conflict_overwrite">Ð\9fеÑ\80езапиÑ\81ать</string>
   <string name="conflict_dont_upload">Не загружать</string>
   <string name="preview_image_description">Предпросмотр</string>
   <string name="preview_image_error_unknown_format">Это изображение не может быть отображено</string>
-  <string name="error__upload__local_file_not_copied">%1$s не возможно скопировать в локальною папку %2$s </string>
+  <string name="error__upload__local_file_not_copied">%1$s невозможно скопировать в локальный каталог %2$s </string>
   <string name="prefs_instant_upload_path_title">Путь для загрузки</string>
-  <string name="share_link_no_support_share_api">К сожалению, на вашем сервере отключен совместный доступ. Пожалуйста, свяжитесь с вашим администратором.</string>
-  <string name="share_link_file_no_exist">Невозможно добавить в общий доступ. Пожалуйста, проверьте, существует ли файл</string>
-  <string name="share_link_file_error">Ошибка предоставления общего доступа к этому файлу или каталогу</string>
-  <string name="unshare_link_file_no_exist">Невозможно убрать из общего доступа. Пожалуйста, проверьте, существует ли файл</string>
-  <string name="unshare_link_file_error">Ошибка удаления общего доступа к этому файлу или каталогу</string>
+  <string name="share_link_no_support_share_api">Механизм общего доступа не включен на данном сервере. Пожалуйста, свяжитесь с вашим
+⇥⇥администратором.</string>
+  <string name="share_link_file_no_exist">Невозможно поделиться. Убедитесь, что файл существует</string>
+  <string name="share_link_file_error">При попытке поделиться этим файлом или каталогом произошла ошибка</string>
+  <string name="unshare_link_file_no_exist">Невозможно закрыть доступ. Убедитесь что файл существует</string>
+  <string name="unshare_link_file_error">При попытке закрыть доступ к этому файлу или каталогу произошла ошибка</string>
   <string name="activity_chooser_send_file_title">Отправить</string>
   <string name="copy_link">Копировать ссылку</string>
   <string name="clipboard_text_copied">Скопировано в буфер обмена</string>
-  <string name="error_cant_bind_to_operations_service">Ð\9aÑ\80иÑ\82иÑ\87еÑ\81каÑ\8f Ð¾Ñ\88ибка: Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ Ð²Ñ\8bполниÑ\82Ñ\8c Ð¾Ð¿ÐµÑ\80аÑ\86ии</string>
+  <string name="error_cant_bind_to_operations_service">Ð\9aÑ\80иÑ\82иÑ\87еÑ\81каÑ\8f Ð¾Ñ\88ибка: Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ Ð²Ñ\8bполниÑ\82Ñ\8c Ð´ÐµÐ¹Ñ\81Ñ\82виÑ\8f</string>
   <string name="network_error_socket_exception">При подключении к серверу возникла ошибка</string>
-  <string name="network_error_socket_timeout_exception">Ð\92о Ð²Ñ\80емÑ\8f Ð¾Ð¶Ð¸Ð´Ð°Ð½Ð¸Ñ\8f Ñ\81еÑ\80веÑ\80а Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° Ð¾Ñ\88ибка, Ð¾Ð¿ÐµÑ\80аÑ\86иÑ\8f Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ\82 Ð±Ñ\8bÑ\82Ñ\8c Ð·Ð°Ð²ÐµÑ\80Ñ\88ена</string>
-  <string name="network_error_connect_timeout_exception">Ð\92о Ð²Ñ\80емÑ\8f Ð¾Ð¶Ð¸Ð´Ð°Ð½Ð¸Ñ\8f Ñ\81еÑ\80веÑ\80а Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° Ð¾Ñ\88ибка, Ð¾Ð¿ÐµÑ\80аÑ\86иÑ\8f Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ\82 Ð±Ñ\8bÑ\82Ñ\8c Ð·Ð°Ð²ÐµÑ\80Ñ\88ена</string>
-  <string name="network_host_not_available">Ð\9eпеÑ\80аÑ\86иÑ\8f Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ\82 Ð±Ñ\8bÑ\82Ñ\8c Ð·Ð°Ð²ÐµÑ\80Ñ\88ена, сервер недоступен</string>
+  <string name="network_error_socket_timeout_exception">Ð\92о Ð²Ñ\80емÑ\8f Ð¾Ð¶Ð¸Ð´Ð°Ð½Ð¸Ñ\8f Ñ\81еÑ\80веÑ\80а Ð¿Ñ\80оизоÑ\88ла Ð¾Ñ\88ибка, Ð´ÐµÐ¹Ñ\81Ñ\82вие Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ\82 Ð±Ñ\8bÑ\82Ñ\8c Ð²Ñ\8bполнено</string>
+  <string name="network_error_connect_timeout_exception">Ð\92о Ð²Ñ\80емÑ\8f Ð¾Ð¶Ð¸Ð´Ð°Ð½Ð¸Ñ\8f Ñ\81еÑ\80веÑ\80а Ð¿Ñ\80оизоÑ\88ла Ð¾Ñ\88ибка, Ð´ÐµÐ¹Ñ\81Ñ\82вие Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ\82 Ð±Ñ\8bÑ\82Ñ\8c Ð²Ñ\8bполнено</string>
+  <string name="network_host_not_available">Ð\94ейÑ\81Ñ\82вие Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ\82 Ð±Ñ\8bÑ\82Ñ\8c Ð²Ñ\8bполнено, сервер недоступен</string>
   <string name="empty"></string>
-  <string name="forbidden_permissions">У Ð²Ð°Ñ\81 Ð½ÐµÑ\82 Ð´Ð¾Ñ\81Ñ\82Ñ\83па %s</string>
-  <string name="forbidden_permissions_rename">пеÑ\80еименоваÑ\82Ñ\8c Ñ\8dÑ\82оÑ\82 Ñ\84айл</string>
-  <string name="forbidden_permissions_delete">удалить этот файл</string>
-  <string name="share_link_forbidden_permissions">опÑ\83бликоваÑ\82Ñ\8c Ñ\8dÑ\82оÑ\82 Ñ\84айл</string>
-  <string name="unshare_link_forbidden_permissions">оÑ\82мениÑ\82Ñ\8c Ð¿Ñ\83бликаÑ\86иÑ\8e Ñ\8dÑ\82ого Ñ\84айла</string>
-  <string name="forbidden_permissions_create">создать файл</string>
-  <string name="uploader_upload_forbidden_permissions">загÑ\80Ñ\83зиÑ\82Ñ\8c Ð² Ñ\8dÑ\82Ñ\83 Ð¿Ð°Ð¿ÐºÑ\83</string>
+  <string name="forbidden_permissions">У Ð²Ð°Ñ\81 Ð½ÐµÑ\82 Ð¿Ñ\80ав %s</string>
+  <string name="forbidden_permissions_rename">длÑ\8f Ð¿ÐµÑ\80еименованиÑ\8f Ñ\8dÑ\82ого Ñ\84айла</string>
+  <string name="forbidden_permissions_delete">для удаления этого файла</string>
+  <string name="share_link_forbidden_permissions">длÑ\8f Ð¾Ñ\82кÑ\80Ñ\8bÑ\82иÑ\8f Ð´Ð¾Ñ\81Ñ\82Ñ\83па Ðº Ñ\8dÑ\82омÑ\83 Ñ\84айлÑ\83</string>
+  <string name="unshare_link_forbidden_permissions">длÑ\8f Ð·Ð°ÐºÑ\80Ñ\8bÑ\82иÑ\8f Ð´Ð¾Ñ\81Ñ\82Ñ\83па Ðº Ñ\8dÑ\82омÑ\83 Ñ\84айлÑ\83</string>
+  <string name="forbidden_permissions_create">для создания файла</string>
+  <string name="uploader_upload_forbidden_permissions">длÑ\8f Ð·Ð°Ð³Ñ\80Ñ\83зки Ð² Ñ\8dÑ\82оÑ\82 ÐºÐ°Ñ\82алог</string>
   <string name="downloader_download_file_not_found">Этот файл больше недоступен на сервере</string>
   <string name="prefs_category_accounts">Учётные записи</string>
   <string name="prefs_add_account">Добавить учетную запись</string>
-  <string name="auth_redirect_non_secure_connection_title">Ð\97аÑ\89иÑ\89Ñ\91нное Ñ\81оединение Ð¿ÐµÑ\80енапÑ\80авлено Ð¿Ð¾ Ð½ÐµÐ·Ð°Ñ\89иÑ\89Ñ\91нному маршруту</string>
+  <string name="auth_redirect_non_secure_connection_title">Ð\97аÑ\89иÑ\89Ñ\91нное Ñ\81оединение Ð¿ÐµÑ\80енапÑ\80авлено Ð¿Ð¾ Ð½ÐµÐ±ÐµÐ·Ð¾Ð¿Ð°Ñ\81ному маршруту</string>
   <string name="actionbar_logger">Журналы</string>
   <string name="log_send_history_button">История Отправлений</string>
+  <string name="log_send_no_mail_app">Приложение для отправки журнала не найдено. Установите почтовое приложение!</string>
+  <string name="log_send_mail_subject">Журналы %1$s для Android</string>
+  <string name="log_progress_dialog_text">Загрузка данных…</string>
   <string name="saml_authentication_required_text">Требуется аутентификация </string>
   <string name="saml_authentication_wrong_pass">Неправильный пароль</string>
   <string name="actionbar_move">Переместить</string>
-  <string name="file_list_empty_moving">Ð\97деÑ\81Ñ\8c Ð½Ð¸Ñ\87его Ð½ÐµÑ\82. Ð\92Ñ\8b Ð¼Ð¾Ð¶ÐµÑ\82е Ð´Ð¾Ð±Ð°Ð²Ð¸Ñ\82Ñ\8c Ð¿Ð°Ð¿ÐºÑ\83!</string>
+  <string name="file_list_empty_moving">Ð\97деÑ\81Ñ\8c Ð½Ð¸Ñ\87его Ð½ÐµÑ\82. Ð\92Ñ\8b Ð¼Ð¾Ð¶ÐµÑ\82е Ð´Ð¾Ð±Ð°Ð²Ð¸Ñ\82Ñ\8c ÐºÐ°Ñ\82алог!</string>
   <string name="folder_picker_choose_button_text">Выбрать</string>
-  <string name="move_file_not_found">Ð\9dевозможно Ð¿ÐµÑ\80емеÑ\81Ñ\82иÑ\82Ñ\8c. Ð\9fожалÑ\83йÑ\81Ñ\82а, Ð¿Ñ\80овеÑ\80Ñ\8cÑ\82е, Ñ\81Ñ\83Ñ\89еÑ\81Ñ\82вÑ\83еÑ\82 Ð»Ð¸ Ñ\84айл</string>
-  <string name="move_file_invalid_into_descendent">Ð\9dевозможно Ð¿ÐµÑ\80емеÑ\81Ñ\82иÑ\82Ñ\8c Ð¿Ð°Ð¿ÐºÑ\83 Ð² Ð¿Ð°Ð¿ÐºÑ\83-поÑ\82омок</string>
-  <string name="move_file_invalid_overwrite">Файл Ñ\83же Ñ\81Ñ\83Ñ\89еÑ\81Ñ\82вÑ\83еÑ\82 Ð² Ð¿Ð°Ð¿Ðºе назначения</string>
-  <string name="move_file_error">Ð\9fÑ\80оизоÑ\88ла Ð¾Ñ\88ибка Ð¿Ñ\80и Ð¿Ð¾Ð¿Ñ\8bÑ\82ке Ð¿ÐµÑ\80емеÑ\89ениÑ\8f Ñ\8dÑ\82ого Ñ\84айла Ð¸Ð»Ð¸ Ð¿Ð°Ð¿ÐºÐ¸</string>
-  <string name="forbidden_permissions_move">пеÑ\80емеÑ\81Ñ\82иÑ\82Ñ\8c Ñ\8dÑ\82оÑ\82 Ñ\84айл</string>
+  <string name="move_file_not_found">Ð\9dевозможно Ð¿ÐµÑ\80емеÑ\81Ñ\82иÑ\82Ñ\8c. Ð£Ð±ÐµÐ´Ð¸Ñ\82еÑ\81Ñ\8c, Ñ\87Ñ\82о Ñ\84айл Ñ\81Ñ\83Ñ\89еÑ\81Ñ\82вÑ\83еÑ\82</string>
+  <string name="move_file_invalid_into_descendent">Ð\9dевозможно Ð¿ÐµÑ\80емеÑ\81Ñ\82иÑ\82Ñ\8c ÐºÐ°Ñ\82алог Ð² ÐµÐ³Ð¾ Ð¿Ð¾Ð´ÐºÐ°Ñ\82алог</string>
+  <string name="move_file_invalid_overwrite">Файл Ñ\83же Ñ\81Ñ\83Ñ\89еÑ\81Ñ\82вÑ\83еÑ\82 Ð² ÐºÐ°Ñ\82алоге назначения</string>
+  <string name="move_file_error">Ð\9fÑ\80оизоÑ\88ла Ð¾Ñ\88ибка Ð¿Ñ\80и Ð¿Ð¾Ð¿Ñ\8bÑ\82ке Ð¿ÐµÑ\80емеÑ\89ениÑ\8f Ñ\8dÑ\82ого Ñ\84айла Ð¸Ð»Ð¸ ÐºÐ°Ñ\82алога</string>
+  <string name="forbidden_permissions_move">длÑ\8f Ð¿ÐµÑ\80емеÑ\89ениÑ\8f Ñ\8dÑ\82ого Ñ\84айла</string>
   <string name="prefs_category_instant_uploading">Мгновенные загрузки</string>
   <string name="prefs_category_security">Безопасность</string>
   <string name="prefs_instant_video_upload_path_title">Путь для загрузки Видео</string>
+  <string name="download_folder_failed_content">Загрузка папки %1$s не может быть завершена</string>
+  <string name="subject_token">%1$s предоставил вам доступ к \"%2$s\"</string>
 </resources>
index 1566ded..9a70c22 100644 (file)
   <string name="auth_fail_get_user_name">Váš server nevracia správne používateľské id, kontaktujte prosím správcu systému
        </string>
   <string name="auth_can_not_auth_against_server">Nie je možné vykonať autentifikáciu na server</string>
+  <string name="auth_account_does_not_exist">Účet zatiaľ v zariadení neexistuje</string>
   <string name="fd_keep_in_sync">Udržiavať súbor aktuálny.</string>
   <string name="common_rename">Premenuj</string>
   <string name="common_remove">Odober</string>
   <string name="auth_redirect_non_secure_connection_title">Zabezpečené pripojenie je presmerované na nezabezpečenú trasu.</string>
   <string name="actionbar_logger">Logy</string>
   <string name="log_send_history_button">Odoslať históriu</string>
+  <string name="log_send_no_mail_app">Nebola nájdená aplikácia pre odosielanie log protokolov. Nainštalujte si mailovú aplikáciu!</string>
+  <string name="log_send_mail_subject">%1$s Android app logs</string>
+  <string name="log_progress_dialog_text">Načítavam dáta...</string>
   <string name="saml_authentication_required_text">Vyžaduje sa overenie</string>
   <string name="saml_authentication_wrong_pass">Nesprávne heslo</string>
   <string name="actionbar_move">Presunúť</string>
   <string name="forbidden_permissions_move">pre presun tohoto súboru</string>
   <string name="prefs_category_instant_uploading">Okamžité nahratie</string>
   <string name="prefs_category_security">Zabezpečenie</string>
+  <string name="prefs_instant_video_upload_path_title">Cesta pre nahrávanie videí</string>
+  <string name="download_folder_failed_content">Sťahovanie %1$s priečinka nebolo dokončené</string>
+  <string name="subject_token">%1$s vám zdieľa „%2$s“</string>
 </resources>
index 731bd67..3f99fb3 100644 (file)
   <string name="prefs_category_instant_uploading">Takojšnje pošiljanje v oblak</string>
   <string name="prefs_category_security">Varnost</string>
   <string name="prefs_instant_video_upload_path_title">Pot videa za pošiljanje</string>
+  <string name="download_folder_failed_content">Imenika %1$s  ni mogoče prejeti v celoti</string>
+  <string name="subject_token">Uporabnik %1$s je omogočil souporabo \"%2$s\".</string>
 </resources>
index b5d14f1..41e1238 100644 (file)
@@ -2,6 +2,7 @@
 <resources>
   <string name="actionbar_upload">Pošalji</string>
   <string name="actionbar_upload_files">Fajlovi</string>
+  <string name="actionbar_mkdir">Novi direktorijum</string>
   <string name="actionbar_settings">Podešavanja</string>
   <string name="actionbar_see_details">Detaljnije</string>
   <string name="actionbar_send_file">Pošalji</string>
   <string name="filedetails_size">Veličina:</string>
   <string name="filedetails_type">Tip:</string>
   <string name="filedetails_download">Preuzmi</string>
+  <string name="action_share_file">Podeli prečicu</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">Ok</string>
+  <string name="common_cancel_upload">Otkaži otpremanje</string>
   <string name="common_cancel">Otkaži</string>
   <string name="common_error">Greška</string>
+  <string name="common_error_unknown">Nepoznata greška</string>
   <string name="change_password">Izmeni lozinku</string>
   <string name="delete_account">Ukloni nalog</string>
   <string name="create_account">Novi nalog</string>
+  <string name="uploader_info_dirname">Ime fascikle</string>
   <string name="uploader_upload_in_progress_ticker">Otpremanje...</string>
   <string name="uploader_upload_succeeded_ticker">Uspešno otpremljeno</string>
   <string name="uploader_upload_failed_ticker">Otpremanje nije uspelo</string>
index b9235ad..3311ba2 100644 (file)
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="about_android">%1$s Андроид апликација</string>
+  <string name="about_version">верзија %1$s</string>
+  <string name="actionbar_sync">Освежи налог</string>
   <string name="actionbar_upload">Отпреми</string>
-  <string name="actionbar_upload_from_apps">Садржај са других апликација</string>
-  <string name="actionbar_upload_files">Датотеке</string>
+  <string name="actionbar_upload_from_apps">Садржај из других апликација</string>
+  <string name="actionbar_upload_files">Фајлови</string>
+  <string name="actionbar_open_with">Отвори помоћу</string>
+  <string name="actionbar_mkdir">Нова фасцикла</string>
   <string name="actionbar_settings">Поставке</string>
+  <string name="actionbar_see_details">Детаљи</string>
   <string name="actionbar_send_file">Пошаљи</string>
+  <string name="actionbar_sort">Разврстај</string>
+  <string name="actionbar_sort_title">Разврставање</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>новији - старији</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Опште</string>
   <string name="prefs_category_more">Више</string>
   <string name="prefs_accounts">Налози</string>
+  <string name="prefs_manage_accounts">Управљање налозима</string>
+  <string name="prefs_pincode">ПИБ апликације</string>
+  <string name="prefs_pincode_summary">Заштитите програм</string>
+  <string name="prefs_instant_upload">Тренутно отпремање фотографија</string>
+  <string name="prefs_instant_upload_summary">Тренутно отпремај фотографије сликане камером</string>
+  <string name="prefs_instant_video_upload">Тренутно отпремање видеа</string>
+  <string name="prefs_instant_video_upload_summary">Тренутно отпремај видео снимљен камером</string>
+  <string name="prefs_log_title">Укључи бележење</string>
+  <string name="prefs_log_summary">Ово се користи за бележење проблема</string>
+  <string name="prefs_log_title_history">Историјат бележења</string>
+  <string name="prefs_log_summary_history">Ово приказује сачуване записнике</string>
+  <string name="prefs_log_delete_history_button">Обриши историјат</string>
   <string name="prefs_help">Помоћ</string>
+  <string name="prefs_recommend">Препоручи пријатељу</string>
+  <string name="prefs_feedback">Ваше мишљење</string>
+  <string name="prefs_imprint">Жиг</string>
+  <string name="prefs_remember_last_share_location">Упамти локацију дељења</string>
+  <string name="prefs_remember_last_upload_location_summary">Памти последњу локацију отпремања дељења</string>
+  <string name="recommend_subject">Пробајте %1$s на вашем телефону!</string>
+  <string name="recommend_text">Предлажем вам да пробате %1$s на вашем телефону!\nПреузмите овде: %2$s</string>
+  <string name="auth_check_server">Провери сервер</string>
+  <string name="auth_host_url">Адреса сервера https://…</string>
   <string name="auth_username">Корисничко име</string>
   <string name="auth_password">Лозинка</string>
+  <string name="auth_register">Нов вам је %1$s?</string>
   <string name="sync_string_files">Фајлови</string>
-  <string name="setup_btn_connect">Повежи ме</string>
+  <string name="setup_btn_connect">Повежи се</string>
   <string name="uploader_btn_upload_text">Отпреми</string>
+  <string name="uploader_top_message">Изаберите фасциклу отпремања:</string>
   <string name="uploader_wrn_no_account_title">Нема налога</string>
+  <string name="uploader_wrn_no_account_text">Нема %1$s налога на вашем уређају. Прво подесите налог.</string>
   <string name="uploader_wrn_no_account_setup_btn_text">Подеси</string>
-  <string name="uploader_wrn_no_account_quit_btn_text">Ð\98заÑ\92и</string>
+  <string name="uploader_wrn_no_account_quit_btn_text">Ð\9dапÑ\83Ñ\81Ñ\82и</string>
   <string name="uploader_wrn_no_content_title">Нема садржаја за отпремање</string>
-  <string name="uploader_wrn_no_content_text">Садржај није примљен. Нема ништа да се отпреми.</string>
+  <string name="uploader_wrn_no_content_text">Садржај није примљен. Нема шта да се отпреми.</string>
   <string name="uploader_info_uploading">Отпремање</string>
-  <string name="file_list_seconds_ago">пÑ\80е Ð½ÐµÐºÐ¾Ð»Ð¸ÐºÐ¾ секунди</string>
+  <string name="file_list_seconds_ago">пÑ\80е Ð¿Ð°Ñ\80 секунди</string>
   <string name="file_list_empty">Овде нема ничег. Отпремите нешто!</string>
-  <string name="filedetails_select_file">Додирните датотеку ради приказа додатних информација.</string>
+  <string name="file_list_loading">Учитавам</string>
+  <string name="local_file_list_empty">Нема фајлова у овој фасцикли.</string>
+  <string name="filedetails_select_file">Тапните на фајл ради приказа додатних информација.</string>
   <string name="filedetails_size">Величина:</string>
   <string name="filedetails_type">Врста:</string>
-  <string name="filedetails_created">Направљено:</string>
-  <string name="filedetails_modified">Измењено:</string>
+  <string name="filedetails_created">Направљен:</string>
+  <string name="filedetails_modified">Измењен:</string>
   <string name="filedetails_download">Преузми</string>
-  <string name="filedetails_sync_file">Освежи датотеку</string>
+  <string name="filedetails_sync_file">Освежи фајл</string>
+  <string name="filedetails_renamed_in_upload_msg">Фајл је преименован у %1$s током отпремања</string>
+  <string name="action_share_file">Веза дељења</string>
+  <string name="action_unshare_file">Не дели везом</string>
   <string name="common_yes">Да</string>
   <string name="common_no">Не</string>
   <string name="common_ok">У реду</string>
-  <string name="common_cancel_download">Обустави преузимање</string>
-  <string name="common_cancel_upload">Ð\9fÑ\80екини Ñ\81лање</string>
+  <string name="common_cancel_download">Откажи преузимање</string>
+  <string name="common_cancel_upload">Ð\9eÑ\82кажи Ð¾Ñ\82пÑ\80емање</string>
   <string name="common_cancel">Откажи</string>
   <string name="common_save_exit">Сачувај и изађи</string>
   <string name="common_error">Грешка</string>
+  <string name="common_loading">Учитавам...</string>
+  <string name="common_error_unknown">Непозната грешка</string>
   <string name="about_title">О програму</string>
   <string name="change_password">Измени лозинку</string>
   <string name="delete_account">Обриши налог</string>
   <string name="create_account">Отвори налог</string>
   <string name="upload_chooser_title">Отпреми из…</string>
+  <string name="uploader_info_dirname">Назив фасцикле</string>
   <string name="uploader_upload_in_progress_ticker">Отпремам…</string>
   <string name="uploader_upload_in_progress_content">%1$d%% Отпремам %2$s</string>
   <string name="uploader_upload_succeeded_ticker">Отпремање је успело</string>
+  <string name="uploader_upload_succeeded_content_single">%1$s је успешно отпремљен</string>
   <string name="uploader_upload_failed_ticker">Отпремање није успело</string>
-  <string name="uploader_upload_failed_content_single">Не могу да довршим отпремање датотеке %1$s</string>
+  <string name="uploader_upload_failed_content_single">Не могу да довршим отпремање %1$s</string>
+  <string name="uploader_upload_failed_credentials_error">Отпремање неуспешно. Поново се пријавите.</string>
   <string name="downloader_download_in_progress_ticker">Преузимам…</string>
   <string name="downloader_download_in_progress_content">%1$d%% Преузимам %2$s</string>
   <string name="downloader_download_succeeded_ticker">Преузимање успешно</string>
   <string name="downloader_download_succeeded_content">%1$s је успешно преузет</string>
   <string name="downloader_download_failed_ticker">Преузимање није успело</string>
-  <string name="downloader_download_failed_content">Не могу да довршим преузимање датотеке %1$s</string>
+  <string name="downloader_download_failed_content">Не могу да довршим преузимање %1$s</string>
   <string name="downloader_not_downloaded_yet">Још увек није преузето</string>
-  <string name="common_choose_account">Изабери налог</string>
+  <string name="downloader_download_failed_credentials_error">Преузимање неуспешно. Пријавите се поново</string>
+  <string name="common_choose_account">Изаберите налог</string>
   <string name="sync_fail_ticker">Синхронизовање није успело</string>
-  <string name="sync_fail_content">Не могу да довршим синхронизацију датотеке %1$s</string>
-  <string name="foreign_files_success">Све датотеке су померене</string>
-  <string name="foreign_files_fail">Неке датотеке нису могле бити померене</string>
-  <string name="pincode_enter_pin_code">Унесите PIN апликације</string>
-  <string name="pincode_configure_your_pin_explanation">Са сваким покретањем апликације мораћете да унесете PIN</string>
+  <string name="sync_fail_ticker_unauthorized">Синхронизовање неуспешно. Пријавите се поново</string>
+  <string name="sync_fail_content">Не могу да довршим синхронизацију %1$s</string>
+  <string name="sync_fail_content_unauthorized">Неисправна лозинка за %1$s</string>
+  <string name="sync_conflicts_in_favourites_ticker">Постоје сукоби</string>
+  <string name="sync_foreign_files_forgotten_explanation">Од верзије 1.3.16, фајлови отпремљени са уређаја се копирају у локалну фасциклу %1$s да би се спречио губитак података када се исти фајл синхронизује са више налога.\n\nЗбог ове измене, сви фајлови отпремљени са претходним верзијама ове апликације се копирају у фасциклу %2$s. Међутим, грешка је онемогућила довршавање ове радње током синхронизације налога. Можете или оставити фајлове како јесу и уклонити линк до %3$s или преместити фајлове у фасциклу %1$s и задржати везу до %4$s.\n\nИспод су наведени локални фајлови и удаљени фајлови у %5$s са којима су повезани.</string>
+  <string name="sync_current_folder_was_removed">Фасцикла %1$s више не постоји</string>
+  <string name="foreign_files_move">Премести све</string>
+  <string name="foreign_files_success">Сви фајлови су премештени</string>
+  <string name="foreign_files_fail">Неки фајлови нису могли бити премештени</string>
+  <string name="foreign_files_local_text">Локално: %1$s</string>
+  <string name="foreign_files_remote_text">Удаљено: %1$s</string>
+  <string name="upload_query_move_foreign_files">Нема довољно простора да би се изабрани фајлови копирали у фасциклу %1$s. Желите ли да их преместите? </string>
+  <string name="pincode_enter_pin_code">Унесите ПИБ апликације</string>
+  <string name="pincode_configure_your_pin">Унесите ПИБ за апликацију</string>
+  <string name="pincode_configure_your_pin_explanation">Са сваким покретањем апликације мораћете да унесете ПИБ</string>
+  <string name="pincode_reenter_your_pincode">Унесите ПИБ поново</string>
+  <string name="pincode_remove_your_pincode">Уклоните ПИБ апликације</string>
+  <string name="pincode_mismatch">Бројеви се не поклапају</string>
+  <string name="pincode_wrong">Неисправан ПИБ</string>
+  <string name="pincode_removed">ПИБ је уклоњен</string>
+  <string name="pincode_stored">ПИБ је упамћен</string>
+  <string name="media_notif_ticker">%1$s музички плејер</string>
+  <string name="media_state_playing">%1$s (пуштам)</string>
+  <string name="media_state_loading">%1$s (учитавам)</string>
+  <string name="media_event_done">%1$s пуштање завршено</string>
+  <string name="media_err_nothing_to_play">Нема медијских фајлова</string>
+  <string name="media_err_no_account">Није наведен налог</string>
+  <string name="media_err_not_in_owncloud">Фајл није у исправном налогу</string>
+  <string name="media_err_unsupported">Неподржан кодек</string>
+  <string name="media_err_io">Медијски фајл се не може читати</string>
+  <string name="media_err_malformed">Медијски фајл није исправно кодиран</string>
+  <string name="media_err_timeout">Време истекло у покушавању пуштања</string>
+  <string name="media_err_invalid_progressive_playback">Медијски фајл се не може пустити</string>
+  <string name="media_err_unknown">Медијски фајл се не може пустити са фабричким плејером</string>
+  <string name="media_err_security_ex">Безбедносна грешка при покушају пуштања %1$s</string>
+  <string name="media_err_io_ex">Улазна грешка при покушају пуштања %1$s</string>
+  <string name="media_err_unexpected">Неочекивана грешка при покушају пуштања %1$s</string>
+  <string name="media_rewind_description">Уназад</string>
+  <string name="media_play_pause_description">Пуштање-пауза</string>
+  <string name="media_forward_description">Унапред</string>
+  <string name="auth_getting_authorization">Тражим ауторизацију...</string>
+  <string name="auth_trying_to_login">Покушавам пријављивање...</string>
   <string name="auth_no_net_conn_title">Нема мрежне везе</string>
   <string name="auth_nossl_plain_ok_title">Безбедна веза није доступна.</string>
   <string name="auth_connection_established">Веза је успостављена</string>
-  <string name="auth_unknown_error_title">Дошло је до непознате грешке.</string>
+  <string name="auth_testing_connection">Тестирам везу...</string>
+  <string name="auth_not_configured_title">Лоше подешавање сервера</string>
+  <string name="auth_account_not_new">Налог са истим корисником и сервером већ постоји на уређају</string>
+  <string name="auth_account_not_the_same">Унесени корисник се не поклапа са корисником овог налога</string>
+  <string name="auth_unknown_error_title">Дошло је до непознате грешке!</string>
   <string name="auth_unknown_host_title">Не могу да пронађем домаћина</string>
   <string name="auth_incorrect_path_title">Не могу да пронађем примерак сервера</string>
   <string name="auth_timeout_title">Серверу је требало предуго да се одазове</string>
   <string name="auth_incorrect_address_title">Погрешно уобличена адреса</string>
-  <string name="auth_ssl_general_error_title">Покретање SSL-а није успело</string>
+  <string name="auth_ssl_general_error_title">ССЛ иницијализација није успела</string>
+  <string name="auth_ssl_unverified_server_title">Не могу да проверим ССЛ идентитет сервера</string>
+  <string name="auth_bad_oc_version_title">Непозната верзија сервера</string>
   <string name="auth_wrong_connection_title">Не могу да успоставим везу</string>
   <string name="auth_secure_connection">Безбедна веза је успостављена</string>
-  <string name="fd_keep_in_sync">Редовно ажурирај датотеку</string>
+  <string name="auth_unauthorized">Погрешно име или лозинка</string>
+  <string name="auth_oauth_error">Неуспешна ауторизација</string>
+  <string name="auth_oauth_error_access_denied">Сервер ауторизације је одбио приступ</string>
+  <string name="auth_wtf_reenter_URL">Неочекивано стање. Унесите поново адресу сервера</string>
+  <string name="auth_expired_oauth_token_toast">Ауторизација је истекла. Урадите је поново</string>
+  <string name="auth_expired_basic_auth_toast">Унесите тренутну лозинку</string>
+  <string name="auth_expired_saml_sso_token_toast">Сесија је истекла. Повежите се поново</string>
+  <string name="auth_connecting_auth_server">Повезујем се на сервер аутентификације...</string>
+  <string name="auth_unsupported_auth_method">Сервер не подржава овај начин аутентификације</string>
+  <string name="auth_unsupported_multiaccount">%1$s не подржава вишеструке налоге</string>
+  <string name="auth_fail_get_user_name">Сервер не враћа исправан ИД корисника. Контактирајте администратора
+       </string>
+  <string name="auth_can_not_auth_against_server">Не могу да аутентификујем са овим сервером</string>
+  <string name="auth_account_does_not_exist">Не постоји налог на уређају</string>
+  <string name="fd_keep_in_sync">Редовно ажурирај фајл</string>
   <string name="common_rename">Преименуј</string>
   <string name="common_remove">Уклони</string>
+  <string name="confirmation_remove_alert">Желите да уклоните %1$s?</string>
+  <string name="confirmation_remove_folder_alert">Желите да уклоните %1$s и њен садржај?</string>
   <string name="confirmation_remove_local">Само локално</string>
+  <string name="confirmation_remove_folder_local">Само локални садржај</string>
   <string name="confirmation_remove_remote">Уклони са сервера</string>
   <string name="confirmation_remove_remote_and_local">Удаљено и локално</string>
-  <string name="rename_dialog_title">Унесите ново име</string>
+  <string name="remove_success_msg">Уклањање успешно</string>
+  <string name="remove_fail_msg">Уклањање неуспешно</string>
+  <string name="rename_dialog_title">Унесите нов назив</string>
+  <string name="rename_local_fail_msg">Локална копија се не може преименовати. Покушајте други назив</string>
   <string name="rename_server_fail_msg">Не могу да довршим преименовање</string>
-  <string name="sync_file_fail_msg">Удаљена датотека се не може проверити</string>
+  <string name="sync_file_fail_msg">Удаљени фајл се не може проверити</string>
+  <string name="sync_file_nothing_to_do_msg">Садржај је већ синхронизован</string>
+  <string name="create_dir_fail_msg">Фасцикла се не може направити</string>
+  <string name="filename_forbidden_characters">Забрањени знакови: / \\ &lt; &gt; : \" | ? *</string>
+  <string name="filename_empty">Назив фајла не може бити празан</string>
   <string name="wait_a_moment">Сачекајте тренутак</string>
-  <string name="filedisplay_no_file_selected">Нисте изабрали датотеку</string>
+  <string name="filedisplay_unexpected_bad_get_content">Неочекивани проблем. Изаберите фајл другом апликацијом</string>
+  <string name="filedisplay_no_file_selected">Нисте изабрали фајл</string>
+  <string name="activity_chooser_title">Пошаљи везу ...</string>
+  <string name="oauth_check_onoff">Пријави се помоћу „oAuth2“</string>
+  <string name="oauth_login_connection">Повезујем се на „oAuth2“ сервер...</string>
   <string name="ssl_validator_header">Не могу да проверим идентитет сајта</string>
-  <string name="ssl_validator_reason_cert_not_trusted">â\80\93 Ð¡ÐµÑ\80Ñ\82иÑ\84икаÑ\82 Ñ\81еÑ\80веÑ\80а Ð½Ð¸Ñ\98е Ð¿Ð¾Ð²ÐµÑ\80Ñ\99ив</string>
+  <string name="ssl_validator_reason_cert_not_trusted">â\80\93 Ð¡ÐµÑ\80Ñ\82иÑ\84икаÑ\82 Ñ\81еÑ\80веÑ\80а Ð½Ð¸Ñ\98е Ð¾Ð´ Ð¿Ð¾Ð²ÐµÑ\80еÑ\9aа</string>
   <string name="ssl_validator_reason_cert_expired">– Сертификат сервера је истекао</string>
+  <string name="ssl_validator_reason_cert_not_yet_valid">- Датуми важења сертификата су у будућности</string>
   <string name="ssl_validator_reason_hostname_not_verified">– Адреса се не поклапа са именом домаћина у сертификату</string>
-  <string name="ssl_validator_question">Ð\96елиÑ\82е Ð»Ð¸ Ð¸Ð¿Ð°Ðº Ð´Ð° Ð¾Ð·Ð½Ð°Ñ\87иÑ\82е Ñ\81еÑ\80Ñ\82иÑ\84икаÑ\82 ÐºÐ°Ð¾ Ð¿Ð¾Ð²ÐµÑ\80Ñ\99ив?</string>
+  <string name="ssl_validator_question">Ð\96елиÑ\82е Ð»Ð¸ Ð¸Ð¿Ð°Ðº Ð´Ð° Ð²ÐµÑ\80Ñ\83Ñ\98еÑ\82е Ñ\81еÑ\80Ñ\82иÑ\84икаÑ\82Ñ\83?</string>
   <string name="ssl_validator_not_saved">Не могу да сачувам сертификат</string>
   <string name="ssl_validator_btn_details_see">Подаци</string>
   <string name="ssl_validator_btn_details_hide">Сакриј</string>
   <string name="ssl_validator_label_subject">Издато за:</string>
-  <string name="ssl_validator_label_issuer">Ð\98здао/ла:</string>
+  <string name="ssl_validator_label_issuer">Ð\98здаваÑ\87:</string>
   <string name="ssl_validator_label_CN">Уобичајено име:</string>
   <string name="ssl_validator_label_O">Организација:</string>
   <string name="ssl_validator_label_OU">Организациона јединица:</string>
-  <string name="ssl_validator_label_C">Ð\97емÑ\99а:</string>
-  <string name="ssl_validator_label_ST">Ð\94Ñ\80жава:</string>
+  <string name="ssl_validator_label_C">Ð\94Ñ\80жава:</string>
+  <string name="ssl_validator_label_ST">Ð\9fокÑ\80аÑ\98ина:</string>
   <string name="ssl_validator_label_L">Локација:</string>
   <string name="ssl_validator_label_validity">Ваљаност:</string>
   <string name="ssl_validator_label_validity_from">Од:</string>
   <string name="ssl_validator_label_validity_to">За:</string>
   <string name="ssl_validator_label_signature">Потпис:</string>
   <string name="ssl_validator_label_signature_algorithm">Алгоритам:</string>
+  <string name="ssl_validator_null_cert">Сертификат се не може приказати.</string>
+  <string name="ssl_validator_no_info_about_error">- Нема података о грешци</string>
+  <string name="placeholder_sentence">Ово је местодржач</string>
+  <string name="placeholder_filename">чувамместо.txt</string>
+  <string name="placeholder_filetype">ПНГ слика</string>
+  <string name="placeholder_filesize">389 KB</string>
+  <string name="placeholder_timestamp">2012/05/18 12:23 ПоП</string>
+  <string name="placeholder_media_time">12:23:45</string>
   <string name="instant_upload_on_wifi">Отпремај слике само путем бежичне мреже</string>
+  <string name="instant_video_upload_on_wifi">Отпремај видео само путем бежичне мреже</string>
   <string name="conflict_title">Ажурирај сукоб</string>
+  <string name="conflict_message">Удаљени фајл %s није синхронизован са локалним. Ако наставите, заменићете фајл на серверу.</string>
+  <string name="conflict_keep_both">Задржи оба</string>
+  <string name="conflict_overwrite">Пребриши</string>
+  <string name="conflict_dont_upload">Не отпремај</string>
+  <string name="preview_image_description">Преглед слике</string>
+  <string name="preview_image_error_unknown_format">Слика се не може приказати</string>
+  <string name="error__upload__local_file_not_copied">%1$s се не може копирати у локалну фасциклу %2$s</string>
+  <string name="prefs_instant_upload_path_title">Путања отпремања</string>
+  <string name="share_link_no_support_share_api">Дељење није укључено на вашем серверу. Контактирајте
+               администратора.</string>
+  <string name="share_link_file_no_exist">Не могу да делим. Проверите да ли фајл постоји</string>
+  <string name="share_link_file_error">Дошло је до грешке приликом покушаја дељења овог фајла или фасцикле</string>
+  <string name="unshare_link_file_no_exist">Не могу да прекинем дељење. Проверите да ли фајл постоји</string>
+  <string name="unshare_link_file_error">Дошло је до грешке приликом покушаја укидања дељења овог фајла или фасцикле</string>
   <string name="activity_chooser_send_file_title">Пошаљи</string>
+  <string name="copy_link">Копирај везу</string>
+  <string name="clipboard_text_copied">Копирано у клипборд</string>
+  <string name="error_cant_bind_to_operations_service">Критична грешка: не могу да радим</string>
+  <string name="network_error_socket_exception">Дошло је до грешке при повезивању са сервером.</string>
+  <string name="network_error_socket_timeout_exception">Дошло је до грешке при чекању на сервер. Радња није могла бити урађена</string>
+  <string name="network_error_connect_timeout_exception">Дошло је до грешке при чекању на сервер. Радња није могла бити урађена</string>
+  <string name="network_host_not_available">Радња није могла бити довршена. Сервер је недоступан</string>
   <string name="empty"></string>
+  <string name="forbidden_permissions">Немате дозволу %s</string>
+  <string name="forbidden_permissions_rename">да преименујете овај фајл</string>
+  <string name="forbidden_permissions_delete">да обришете овај фајл</string>
+  <string name="share_link_forbidden_permissions">да делите овај фајл</string>
+  <string name="unshare_link_forbidden_permissions">да укинете дељење овог фајла</string>
+  <string name="forbidden_permissions_create">да направите фајл</string>
+  <string name="uploader_upload_forbidden_permissions">да отпремате у ову фасциклу</string>
+  <string name="downloader_download_file_not_found">Фајл није више доступан на серверу</string>
   <string name="prefs_category_accounts">Налози</string>
+  <string name="prefs_add_account">Додај налог</string>
+  <string name="auth_redirect_non_secure_connection_title">Безбедна веза је преусмерена на небезбедну руту</string>
+  <string name="actionbar_logger">Записници</string>
+  <string name="log_send_history_button">Историјат слања</string>
+  <string name="log_send_no_mail_app">Нема начина за слање записника. Инсталирајте апликацију е-поште!</string>
+  <string name="log_send_mail_subject">Записници %1$s Андроид апликације</string>
+  <string name="log_progress_dialog_text">Учитавам податке...</string>
+  <string name="saml_authentication_required_text">Неопходна провера идентитета</string>
+  <string name="saml_authentication_wrong_pass">Погрешна лозинка</string>
+  <string name="actionbar_move">Премести</string>
+  <string name="file_list_empty_moving">Овде нема ничега. Можете додати фасциклу!</string>
   <string name="folder_picker_choose_button_text">Одабери</string>
+  <string name="move_file_not_found">Не могу да преместим. Проверите да ли фајл постоји</string>
+  <string name="move_file_invalid_into_descendent">Није могуће преместити фасциклу у њену потфасциклу</string>
+  <string name="move_file_invalid_overwrite">Фајл већ постоји у одредишној фасцикли</string>
+  <string name="move_file_error">Дошло је до грешке при премештању фајла или фасцикле</string>
+  <string name="forbidden_permissions_move">да преместите овај фајл</string>
+  <string name="prefs_category_instant_uploading">Тренутна отпремања</string>
   <string name="prefs_category_security">Безбедност</string>
+  <string name="prefs_instant_video_upload_path_title">Путања отпремања видеа</string>
+  <string name="download_folder_failed_content">Преузимање фасцикле %1$s не може бити довршено</string>
+  <string name="subject_token">%1$s подели „%2$s“ са вама</string>
 </resources>
index f87edff..f44afac 100644 (file)
   <string name="actionbar_settings">Inställningar</string>
   <string name="actionbar_see_details">Detaljer</string>
   <string name="actionbar_send_file">Skicka</string>
+  <string name="actionbar_sort">Sortera</string>
+  <string name="actionbar_sort_title">Sortera efter</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Ö</item>
+    <item>Nyast - Äldst</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Allmänt</string>
@@ -32,6 +38,8 @@
   <string name="prefs_recommend">Rekommendera till en vän</string>
   <string name="prefs_feedback">Feedback</string>
   <string name="prefs_imprint">Imprint</string>
+  <string name="prefs_remember_last_share_location">Kom ihåg plats för delat</string>
+  <string name="prefs_remember_last_upload_location_summary">Kom ihåg senaste uppladdningsplats vid dela</string>
   <string name="recommend_subject">Prova %1$s på din smartphone!</string>
   <string name="recommend_text">Jag skullje vilja bjuda in dig till att prova %1$s på din smartphone!\nLadda ner appen från Google Play här: %2$s</string>
   <string name="auth_check_server">Kontrollera Server</string>
   <string name="sync_fail_in_favourites_content">Innehållet i %1$d filer kunde inte synkas (%2$d konflikter)</string>
   <string name="sync_foreign_files_forgotten_ticker">Vissa lokala filer glömdes</string>
   <string name="sync_foreign_files_forgotten_content">%1$d filer från %2$s mappar kunde inte kopieras till</string>
+  <string name="sync_foreign_files_forgotten_explanation">Från och med version 1.3.16 kommer filer uppladdade från denna enhet kopieras in till lokal %1$s mapp för att förhindra dataförlust när en enskild fil synkroniseras med flera konton.\n\nPå grund av denna ändring kommer alla filer uppladdade i tidigare versioner av denna applikation kopieras in till %2$s mapp.  Dock förhindrade ett fel slutförandet av denna operation under konto-synkronisering. Du kan antingen lämna filerna som de är och ta bort länken till %3$s, eller flytta filerna in till %1$s mapp och behålla länken till %4$s.\n\nNedan listas de lokala filerna och de fjrran filerna i %5$s som de länkades till.</string>
   <string name="sync_current_folder_was_removed">Mappen %1$s existerar inte längre</string>
   <string name="foreign_files_move">Flytta allt</string>
   <string name="foreign_files_success">Alla filer flyttades</string>
   <string name="preview_image_description">Förhandsvisa bild</string>
   <string name="preview_image_error_unknown_format">Denna bild kan inte visas</string>
   <string name="error__upload__local_file_not_copied">%1$s kunde inte kopieras till %2$s lokal mapp</string>
+  <string name="prefs_instant_upload_path_title">Uppladdnings-sökväg</string>
   <string name="share_link_no_support_share_api">Ledsen, delning är inte aktiverat på din server. Vänligen kontakta din
                administratör.</string>
+  <string name="share_link_file_no_exist">Lyckades ej dela. Vänligen kontrollera om filen eisterar</string>
   <string name="share_link_file_error">Ett fel uppstod vid försök att dela denna fil eller mapp</string>
+  <string name="unshare_link_file_no_exist">Lyckades ej sluta dela. Vänligen kontrollera om filen existerar</string>
   <string name="unshare_link_file_error">Ett fel uppstod vid försök att sluta dela denna fil eller mapp</string>
   <string name="activity_chooser_send_file_title">Skicka</string>
   <string name="copy_link">Kopiera länk</string>
   <string name="downloader_download_file_not_found">Filen är inte längre tillgänglig på servern</string>
   <string name="prefs_category_accounts">Konton</string>
   <string name="prefs_add_account">Lägg till konto</string>
+  <string name="auth_redirect_non_secure_connection_title">Säker anslutning är omdirigerad till en osäker väg.</string>
+  <string name="actionbar_logger">Loggar</string>
+  <string name="log_send_history_button">Skickat historik</string>
+  <string name="log_send_no_mail_app">Ingen app för att skicka loggar hittades. Installera mail appen!</string>
+  <string name="log_send_mail_subject">%1$s Android app logs</string>
+  <string name="log_progress_dialog_text">Laddar data...</string>
   <string name="saml_authentication_required_text">Autentisering krävs</string>
   <string name="saml_authentication_wrong_pass">Fel lösenord</string>
   <string name="actionbar_move">Flytta</string>
   <string name="file_list_empty_moving">Ingenting här. Du kan skapa en mapp!</string>
   <string name="folder_picker_choose_button_text">Välj</string>
   <string name="move_file_not_found">Gick inte att flytta. Vänligen kontrollera att filen existerar</string>
+  <string name="move_file_invalid_into_descendent">Det är inte möjligt att flytta mappen in i underliggande struktur</string>
+  <string name="move_file_invalid_overwrite">Filen existerar redan i destinationsmappen</string>
+  <string name="move_file_error">Ett fel uppstod vid försök att flytta denna fil eller mapp</string>
   <string name="forbidden_permissions_move">att flytta den här filen</string>
+  <string name="prefs_category_instant_uploading">Direktuppladning</string>
   <string name="prefs_category_security">Säkerhet</string>
+  <string name="prefs_instant_video_upload_path_title">Uppladdnings-sökväg för video</string>
 </resources>
index 680190c..8805fdc 100644 (file)
@@ -64,9 +64,9 @@
   <string name="file_list_loading">Yükleniyor...</string>
   <string name="local_file_list_empty">Bu klasörde dosya yok.</string>
   <string name="file_list_folder">klasör</string>
-  <string name="file_list_folders">klasörler</string>
+  <string name="file_list_folders">klasör</string>
   <string name="file_list_file">dosya</string>
-  <string name="file_list_files">dosyalar</string>
+  <string name="file_list_files">dosya</string>
   <string name="filedetails_select_file">Ek bilgileri görmek için dosyaya dokunun.</string>
   <string name="filedetails_size">Boyut:</string>
   <string name="filedetails_type">Tür:</string>
   <string name="auth_fail_get_user_name">Sunucunuz geçerli bir kullanıcı kimliği döndürmüyor, lütfen yöneticinizle iletişime geçin
         </string>
   <string name="auth_can_not_auth_against_server">Bu sunucuya karşı kimlik doğrulama yapılamaz</string>
+  <string name="auth_account_does_not_exist">Hesap henüz cihazda mevcut değil</string>
   <string name="fd_keep_in_sync">Dosyayı güncel tut</string>
   <string name="common_rename">Yeniden adlandır</string>
   <string name="common_remove">Kaldır</string>
   <string name="auth_redirect_non_secure_connection_title">Güvenli bağlantı, güvenli olmayan bir rotaya yönlendirildi.</string>
   <string name="actionbar_logger">Günlükler</string>
   <string name="log_send_history_button">Geçmişi Gönder</string>
-  <string name="log_send_no_mail_app">Logları göndermek için uygulama bulunamadı. Eposta uygulamasını yükleyin!</string>
+  <string name="log_send_no_mail_app">Kayıtları göndermek için uygulama bulunamadı. E-posta uygulamasını yükleyin!</string>
   <string name="log_send_mail_subject">%1$s Android uygulama kayıtları</string>
-  <string name="log_progress_dialog_text">Yükleniyor...</string>
+  <string name="log_progress_dialog_text">Veri yükleniyor...</string>
   <string name="saml_authentication_required_text">Kimlik doğrulama gerekli</string>
   <string name="saml_authentication_wrong_pass">Hatalı parola</string>
   <string name="actionbar_move">Taşı</string>
   <string name="prefs_category_instant_uploading">Anında Yüklemeler</string>
   <string name="prefs_category_security">Güvenlik</string>
   <string name="prefs_instant_video_upload_path_title">Video Yükleme Yolu</string>
+  <string name="download_folder_failed_content">%1$s klasörün indirilmesi tamamlanamadı</string>
+  <string name="subject_token">%1$s sizinle \"%2$s\" paylaşımını yaptı</string>
 </resources>
index 4c07d79..64c57d3 100644 (file)
@@ -38,6 +38,8 @@
   <string name="prefs_recommend">Порадити товаришу</string>
   <string name="prefs_feedback">Зворотній зв\'язок</string>
   <string name="prefs_imprint">Відбиток</string>
+  <string name="prefs_remember_last_share_location">Запам\'ятати позицію</string>
+  <string name="prefs_remember_last_upload_location_summary">Запам\'ятати останній опублікований шлях завантаження</string>
   <string name="recommend_subject">Спробуйте %1$s на своєму смартфоні!</string>
   <string name="recommend_text">Пропоную вам користуватися %1$s на вашому смартфоні!\nЗавантажити можна за посиланням: %2$s</string>
   <string name="auth_check_server">Перевірити сервер</string>
   <string name="uploader_upload_failed_ticker">Помилка завантаження</string>
   <string name="uploader_upload_failed_content_single">Завантаження %1$s не може завершитись</string>
   <string name="uploader_upload_failed_credentials_error">Завантажити не вдалося, необхідно повторити вхід</string>
-  <string name="downloader_download_in_progress_ticker">Ð\97качування …</string>
+  <string name="downloader_download_in_progress_ticker">Скачування …</string>
   <string name="downloader_download_in_progress_content">%1$d%% Зкачування %2$s</string>
   <string name="downloader_download_succeeded_ticker">Успішно зкачано</string>
   <string name="downloader_download_succeeded_content">%1$s успішно завантажено</string>
   <string name="auth_redirect_non_secure_connection_title">Безпечне підключення перенаправляється через незабезпечений маршрут.</string>
   <string name="actionbar_logger">Журнали</string>
   <string name="log_send_history_button">Надіслати історію</string>
+  <string name="log_send_no_mail_app">Немає додатку для відправки журналів. Встановіть поштовий додаток!</string>
+  <string name="log_send_mail_subject">%1$s Android лог додатку</string>
+  <string name="log_progress_dialog_text">Завантаження даних...</string>
   <string name="saml_authentication_required_text">Потрібна аутентифікація</string>
   <string name="saml_authentication_wrong_pass">Невірний пароль</string>
   <string name="actionbar_move">Перемістити</string>
   <string name="forbidden_permissions_move">перемістити цей файл</string>
   <string name="prefs_category_instant_uploading">Миттєво завантаження</string>
   <string name="prefs_category_security">Безпека</string>
+  <string name="prefs_instant_video_upload_path_title">Шлях завантаження відео</string>
+  <string name="download_folder_failed_content">Скачування теки %1$s не може бути завершено</string>
 </resources>
diff --git a/res/values-yo/strings.xml b/res/values-yo/strings.xml
new file mode 100644 (file)
index 0000000..69623e1
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<resources>
+  <!--TODO re-enable when server-side folder size calculation is available   
+       <item>Biggest - Smallest</item>-->
+  <string name="empty"></string>
+</resources>
index e8852f5..28123e0 100644 (file)
@@ -4,13 +4,19 @@
   <string name="about_version">版本:%1$s</string>
   <string name="actionbar_sync">刷新帐户</string>
   <string name="actionbar_upload">上传</string>
-  <string name="actionbar_upload_from_apps">来自其它app的内容</string>
+  <string name="actionbar_upload_from_apps">来自其它应用的内容</string>
   <string name="actionbar_upload_files">文件</string>
-  <string name="actionbar_open_with">打开</string>
-  <string name="actionbar_mkdir">增加文件夹</string>
+  <string name="actionbar_open_with">打开方式</string>
+  <string name="actionbar_mkdir">新建文件夹</string>
   <string name="actionbar_settings">设置</string>
   <string name="actionbar_see_details">详细信息</string>
   <string name="actionbar_send_file">发送</string>
+  <string name="actionbar_sort">排序</string>
+  <string name="actionbar_sort_title">排序方式</string>
+  <string-array name="actionbar_sortby">
+    <item>A - Z</item>
+    <item>新 - 旧</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">常规</string>
   <string name="prefs_accounts">账号</string>
   <string name="prefs_manage_accounts">管理账号</string>
   <string name="prefs_pincode">App PIN</string>
-  <string name="prefs_pincode_summary">保护您的App客户端</string>
+  <string name="prefs_pincode_summary">保护客户端</string>
   <string name="prefs_instant_upload">即时图片上传</string>
   <string name="prefs_instant_upload_summary">即时上传相机拍摄的图片</string>
-  <string name="prefs_instant_video_upload">立即上传视频</string>
+  <string name="prefs_instant_video_upload">即时上传视频</string>
   <string name="prefs_instant_video_upload_summary">即时上传由相机拍摄的视频</string>
   <string name="prefs_log_title">开启日志</string>
-  <string name="prefs_log_summary">这过去是日志问题</string>
+  <string name="prefs_log_summary">用于记录问题</string>
   <string name="prefs_log_title_history">日志历史</string>
   <string name="prefs_log_summary_history">这显示已经保存的日志</string>
   <string name="prefs_log_delete_history_button">删除历史</string>
   <string name="prefs_recommend">推荐给朋友</string>
   <string name="prefs_feedback">反馈</string>
   <string name="prefs_imprint">版本说明</string>
-  <string name="recommend_subject">在您的智能手机上试用一下 %1$s!</string>
-  <string name="recommend_text">“我邀请你使用在你的智能手机上使用 %1$s,在这下载:%2$s”
-       </string>
+  <string name="prefs_remember_last_share_location">记住共享位置</string>
+  <string name="prefs_remember_last_upload_location_summary">记住上次共享上传的位置</string>
+  <string name="recommend_subject">在您的智能手机上试用 %1$s!</string>
+  <string name="recommend_text">我邀请你在智能手机上使用 %1$s\n下载路径:%2$s</string>
   <string name="auth_check_server">检查服务器</string>
   <string name="auth_host_url">服务器地址 https://...</string>
   <string name="auth_username">用户名</string>
   <string name="auth_password">密码</string>
-  <string name="auth_register">新增到 %1$s?</string>
+  <string name="auth_register">初次使用 %1$s?</string>
   <string name="sync_string_files">文件</string>
   <string name="setup_btn_connect">连接</string>
   <string name="uploader_btn_upload_text">上传</string>
   <string name="uploader_top_message">选择上传文件夹:</string>
   <string name="uploader_wrn_no_account_title">未找到账号</string>
-  <string name="uploader_wrn_no_account_text">设备上未找到账号,请先创建账号。</string>
+  <string name="uploader_wrn_no_account_text">设备上未找到 %1$s 账号,请先设置账号。</string>
   <string name="uploader_wrn_no_account_setup_btn_text">设置</string>
   <string name="uploader_wrn_no_account_quit_btn_text">退出</string>
-  <string name="uploader_wrn_no_content_title">没有上传的内容</string>
-  <string name="uploader_wrn_no_content_text">没æ\9c\89æ\8e¥æ\94¶å\88°å\86\85容ï¼\8cæ\97 å\8f¯ä¸\8aä¼ 。</string>
+  <string name="uploader_wrn_no_content_title">没有需要上传的内容</string>
+  <string name="uploader_wrn_no_content_text">没æ\9c\89æ\8e¥æ\94¶å\88°å\86\85容ï¼\8c没æ\9c\89é\9c\80è¦\81ä¸\8aä¼ ç\9a\84å\86\85容。</string>
   <string name="uploader_error_forbidden_content">%1$s未被允许访问共享内容。</string>
   <string name="uploader_info_uploading">上传</string>
-  <string name="file_list_seconds_ago">秒前</string>
+  <string name="file_list_seconds_ago">秒前</string>
   <string name="file_list_empty">这里还什么都没有。上传些东西吧!</string>
   <string name="file_list_loading">载入中....</string>
   <string name="local_file_list_empty">在该文件夹中不存在文件。</string>
   <string name="file_list_folders">文件夹</string>
   <string name="file_list_file">文件</string>
   <string name="file_list_files">文件</string>
-  <string name="filedetails_select_file">点击一个文件æ\9d¥æ\98¾ç¤ºé¢\9då¤\96ç\9a\84ä¿¡æ\81¯ã\80\82</string>
+  <string name="filedetails_select_file">点击一个文件å\8f¯ä»¥æ\98¾ç¤ºé¢\9då¤\96ç\9a\84ä¿¡æ\81¯ã\80\82</string>
   <string name="filedetails_size">大小:</string>
   <string name="filedetails_type">类型:</string>
   <string name="filedetails_created">创建于:</string>
-  <string name="filedetails_modified">已修改:</string>
+  <string name="filedetails_modified">修改于:</string>
   <string name="filedetails_download">下载</string>
   <string name="filedetails_sync_file">刷新文件</string>
   <string name="filedetails_renamed_in_upload_msg">上传过程中文件被更名为了 %1$s</string>
   <string name="action_share_file">分享链接</string>
-  <string name="action_unshare_file">å\8f\96æ¶\88å\85±享链接</string>
+  <string name="action_unshare_file">å\8f\96æ¶\88å\88\86享链接</string>
   <string name="common_yes">是</string>
   <string name="common_no">否</string>
-  <string name="common_ok">OK</string>
+  <string name="common_ok">确定</string>
   <string name="common_cancel_download">取消下载</string>
   <string name="common_cancel_upload">取消上传</string>
   <string name="common_cancel">取消</string>
   <string name="delete_account">删除账号</string>
   <string name="create_account">创建账号</string>
   <string name="upload_chooser_title">上传自...</string>
-  <string name="uploader_info_dirname">目录名称</string>
+  <string name="uploader_info_dirname">文件夹名称</string>
   <string name="uploader_upload_in_progress_ticker">上传...</string>
   <string name="uploader_upload_in_progress_content">%1$d%% 上传 %2$s</string>
   <string name="uploader_upload_succeeded_ticker">上传成功</string>
   <string name="uploader_upload_succeeded_content_single">%1$s 成功上传</string>
   <string name="uploader_upload_failed_ticker">上传失败</string>
-  <string name="uploader_upload_failed_content_single">1$上传未能完成</string>
+  <string name="uploader_upload_failed_content_single">%1$s 未能成功上传</string>
   <string name="uploader_upload_failed_credentials_error">上传失败,您需要重新登录</string>
-  <string name="downloader_download_in_progress_ticker">下载中……</string>
+  <string name="downloader_download_in_progress_ticker">下载中...</string>
   <string name="downloader_download_in_progress_content">%1$d%% 下载中 %2$s</string>
   <string name="downloader_download_succeeded_ticker">下载成功</string>
-  <string name="downloader_download_succeeded_content">%1$s 成功下载</string>
+  <string name="downloader_download_succeeded_content">成功下载 %1$s </string>
   <string name="downloader_download_failed_ticker">下载失败</string>
-  <string name="downloader_download_failed_content">下载1$s 未能完成</string>
+  <string name="downloader_download_failed_content">%1$s 下载未能完成</string>
   <string name="downloader_not_downloaded_yet">未下载完毕</string>
   <string name="downloader_download_failed_credentials_error">下载失败,您需要重新登录</string>
   <string name="common_choose_account">选择账户</string>
   <string name="sync_fail_ticker">同步失败</string>
   <string name="sync_fail_ticker_unauthorized">同步失败,您需要重新登录</string>
   <string name="sync_fail_content"> %1$s同步未完成。</string>
-  <string name="sync_fail_content_unauthorized">密码错误%1$s</string>
+  <string name="sync_fail_content_unauthorized">%1$s 的密码错误</string>
   <string name="sync_conflicts_in_favourites_ticker">发现冲突</string>
   <string name="sync_conflicts_in_favourites_content">%1$d 文件无法同步</string>
   <string name="sync_fail_in_favourites_ticker">文件同步失败</string>
-  <string name="sync_fail_in_favourites_content">无法同步 %1$d 文件内容(与 %2$d 冲突)</string>
+  <string name="sync_fail_in_favourites_content">无法同步 %1$d 文件内容(%2$d 冲突)</string>
   <string name="sync_foreign_files_forgotten_ticker">某些本地文件已被遗忘</string>
   <string name="sync_foreign_files_forgotten_content">%2$s 目录中的 %1$d 个文件不能被复制到</string>
   <string name="sync_foreign_files_forgotten_explanation">从 1.3.16 版起,从此设备上传的文件将被复制到本地的 %1$s 文件夹,以防止某个单一文件在多个账户间同步而造成的数据损失。\n\n 由于此项变化,此应用之前的版本上传的全部文件都已被复制到了 %2$s 文件夹。然而,账户同步期间有一个错误阻止了此操作的完成。您可能想保持文件不动,并移除指向 %3$s 的链接,或将文件移动到 %1$s 文件夹中并保持其到 %4$s 的链接。下面列出的是本地文件,以及它们被链接到的 %5$s 中的远程文件。</string>
-  <string name="sync_current_folder_was_removed">文件夹%1$s 不存在</string>
+  <string name="sync_current_folder_was_removed">文件夹%1$s 已经不存在</string>
   <string name="foreign_files_move">移动所有</string>
   <string name="foreign_files_success">所有文件已被移动</string>
   <string name="foreign_files_fail">某些文件无法被移动</string>
   <string name="pincode_mismatch">两次 App PIN码不同</string>
   <string name="pincode_wrong">App PIN码不正确</string>
   <string name="pincode_removed">App PIN码已移除</string>
-  <string name="pincode_stored">App PIN码已保存</string>
+  <string name="pincode_stored">App PIN码已保存</string>
   <string name="media_notif_ticker">%1$s 音乐播放器</string>
   <string name="media_state_playing">%1$s (播放中)</string>
   <string name="media_state_loading">%1$s (载入中)</string>
   <string name="media_play_pause_description">播放暂停按钮</string>
   <string name="media_forward_description">快进按钮</string>
   <string name="auth_getting_authorization">正在认证...</string>
-  <string name="auth_trying_to_login">尝试登录</string>
+  <string name="auth_trying_to_login">尝试登录...</string>
   <string name="auth_no_net_conn_title">没有网络连接</string>
-  <string name="auth_nossl_plain_ok_title">安全链接无效。</string>
+  <string name="auth_nossl_plain_ok_title">安全连接不可用。</string>
   <string name="auth_connection_established">连接已建立。</string>
   <string name="auth_testing_connection">测试连接……</string>
-  <string name="auth_not_configured_title">服务器配置不正确</string>
+  <string name="auth_not_configured_title">服务器配置不正确</string>
   <string name="auth_account_not_new">此设备中已经存在同名同服务器的帐号</string>
   <string name="auth_account_not_the_same">输入用户与此帐户的用户不符</string>
   <string name="auth_unknown_error_title">发生未知错误!</string>
-  <string name="auth_unknown_host_title">无法找到服务器</string>
+  <string name="auth_unknown_host_title">无法找到主机</string>
   <string name="auth_incorrect_path_title">未发现服务器实例</string>
   <string name="auth_timeout_title">看起来服务器不太给力</string>
   <string name="auth_incorrect_address_title">网址不正确</string>
   <string name="auth_ssl_unverified_server_title">无法验证 SSL 服务器的身份</string>
   <string name="auth_bad_oc_version_title">不可辨识的服务器服务器版本</string>
   <string name="auth_wrong_connection_title">无法建立连接</string>
-  <string name="auth_secure_connection">å\8a å¯\86连接已建立</string>
-  <string name="auth_unauthorized">用户名或密码错误</string>
+  <string name="auth_secure_connection">å®\89å\85¨连接已建立</string>
+  <string name="auth_unauthorized">用户名或密码错误</string>
   <string name="auth_oauth_error">认证不成功</string>
   <string name="auth_oauth_error_access_denied">访问被认证服务器拒绝</string>
   <string name="auth_wtf_reenter_URL">意外状态;请再次输入服务器的地址</string>
   <string name="auth_expired_oauth_token_toast">你的授权已经过期。请重新授权。</string>
-  <string name="auth_expired_basic_auth_toast">请输入当前密码</string>
+  <string name="auth_expired_basic_auth_toast">请输入当前密码</string>
   <string name="auth_expired_saml_sso_token_toast">您的会话超时了,请重新连接</string>
   <string name="auth_connecting_auth_server">正在连接到认证服务器....</string>
   <string name="auth_unsupported_auth_method">服务器不支持这种验证方式</string>
   <string name="filename_empty">文件名不能为空</string>
   <string name="wait_a_moment">请稍候</string>
   <string name="filedisplay_unexpected_bad_get_content">未知问题;请试试用其他程序选择此文件</string>
-  <string name="filedisplay_no_file_selected">未选择文件</string>
+  <string name="filedisplay_no_file_selected">未选择文件</string>
   <string name="activity_chooser_title">发送链接给 …</string>
   <string name="oauth_check_onoff">使用oAuth2登陆</string>
   <string name="oauth_login_connection">连接oAuth2 服务器...</string>
   <string name="ssl_validator_header">站点身份无法验证</string>
-  <string name="ssl_validator_reason_cert_not_trusted">不受信任的服务器证书</string>
-  <string name="ssl_validator_reason_cert_expired">服务器证书过期</string>
-  <string name="ssl_validator_reason_cert_not_yet_valid">服务器证书过新</string>
-  <string name="ssl_validator_reason_hostname_not_verified">主机名与证书中的记录不匹配</string>
+  <string name="ssl_validator_reason_cert_not_trusted">不受信任的服务器证书</string>
+  <string name="ssl_validator_reason_cert_expired">服务器证书过期</string>
+  <string name="ssl_validator_reason_cert_not_yet_valid">- 服务器证书时间比当前时间还晚</string>
+  <string name="ssl_validator_reason_hostname_not_verified">主机名与证书中的记录不匹配</string>
   <string name="ssl_validator_question">是否信任此证书?</string>
   <string name="ssl_validator_not_saved">证书无法保存</string>
   <string name="ssl_validator_btn_details_see">详细信息</string>
   <string name="placeholder_filesize">389字节</string>
   <string name="placeholder_timestamp">2012/05/18 下午12:23 </string>
   <string name="placeholder_media_time">12:23:45</string>
-  <string name="instant_upload_on_wifi">仅通过WIFI上传图片。</string>
-  <string name="instant_video_upload_on_wifi">仅在 WIFI 下上传视频</string>
+  <string name="instant_upload_on_wifi">仅通过 WIFI 上传图片。</string>
+  <string name="instant_video_upload_on_wifi">仅通过 WIFI 上传视频</string>
   <string name="instant_upload_path">/InstantUpload</string>
   <string name="conflict_title">上传冲突</string>
   <string name="conflict_message">远程文件 %s 未与本地文件同步。继续将替换服务器上的文件内容。</string>
   <string name="conflict_overwrite">覆盖</string>
   <string name="conflict_dont_upload">不上传</string>
   <string name="preview_image_description">图片预览</string>
-  <string name="preview_image_error_unknown_format">不能显示图片</string>
+  <string name="preview_image_error_unknown_format">无法显示图片</string>
   <string name="error__upload__local_file_not_copied">无法复制 %1$s 到本地目录 %2$s</string>
+  <string name="prefs_instant_upload_path_title">上传路径</string>
   <string name="share_link_no_support_share_api">抱歉,共享功能未启用。请联系管理员。</string>
   <string name="share_link_file_no_exist">无法共享。请检查文件是否存在</string>
   <string name="share_link_file_error">共享文件或目录出错</string>
   <string name="network_error_connect_timeout_exception">等待服务器响应时发生了一个错误,此操作无法完成</string>
   <string name="network_host_not_available">服务器不可用,此操作无法完成</string>
   <string name="empty"></string>
-  <string name="forbidden_permissions">你没有许可%s</string>
+  <string name="forbidden_permissions">你没有权限%s</string>
   <string name="forbidden_permissions_rename">重命名该文件</string>
   <string name="forbidden_permissions_delete">删除该文件</string>
-  <string name="share_link_forbidden_permissions">å\88\86享该文件</string>
+  <string name="share_link_forbidden_permissions">å\85±享该文件</string>
   <string name="unshare_link_forbidden_permissions">取消共享该文件</string>
   <string name="forbidden_permissions_create">创建文件</string>
-  <string name="uploader_upload_forbidden_permissions">上传此文件夹</string>
+  <string name="uploader_upload_forbidden_permissions">在此文件夹上传</string>
   <string name="downloader_download_file_not_found">该文件在服务器上不可用</string>
   <string name="prefs_category_accounts">账号</string>
   <string name="prefs_add_account">添加账号</string>
+  <string name="auth_redirect_non_secure_connection_title">安全连接被重定向到非安全路径.</string>
   <string name="actionbar_logger">日志</string>
   <string name="log_send_history_button">发送历史</string>
+  <string name="log_send_no_mail_app">未找到可以发送日志的程序。请安装 mail!</string>
+  <string name="log_send_mail_subject">%1$s Android 程序日志</string>
+  <string name="log_progress_dialog_text">载入数据...</string>
   <string name="saml_authentication_required_text">需要认证</string>
   <string name="saml_authentication_wrong_pass">错误密码</string>
   <string name="actionbar_move">移动</string>
   <string name="file_list_empty_moving">这里还什么都没有。上传些东西吧!</string>
-  <string name="folder_picker_choose_button_text">选择(&amp;C)...</string>
+  <string name="folder_picker_choose_button_text">选择</string>
   <string name="move_file_not_found">无法移动。请检查文件是否存在</string>
-  <string name="move_file_invalid_into_descendent">b不能够把一个目录移动到它的下级</string>
+  <string name="move_file_invalid_into_descendent">无法把一个目录移动到它的下级</string>
   <string name="move_file_invalid_overwrite">该文件已经存在在目标文件夹</string>
   <string name="move_file_error">尝试移动该文件或文件夹时发生错误</string>
   <string name="forbidden_permissions_move">移动该文件</string>
+  <string name="prefs_category_instant_uploading">即时上传</string>
   <string name="prefs_category_security">安全</string>
+  <string name="prefs_instant_video_upload_path_title">视频上传路径</string>
+  <string name="download_folder_failed_content">%1$s 文件夹的下载无法完成</string>
 </resources>
index b273179..892944e 100644 (file)
@@ -71,4 +71,5 @@
   <string name="empty"></string>
   <string name="prefs_category_accounts">帳號</string>
   <string name="saml_authentication_wrong_pass">密碼錯誤</string>
+  <string name="prefs_category_security">安全</string>
 </resources>
index 45ccd3f..4659d43 100644 (file)
   <string name="prefs_category_instant_uploading">即時上傳</string>
   <string name="prefs_category_security">安全性</string>
   <string name="prefs_instant_video_upload_path_title">影片上傳路徑</string>
+  <string name="download_folder_failed_content">%1$s 目錄的下載未完成</string>
 </resources>
index 1c8d68c..c2ca673 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ownCloud Android client application
 
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 2b1fec9..6aeb6ac 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
@@ -22,5 +22,7 @@
     <color name="filelist_icon_backgorund">#DDDDDD</color>
     <color name="owncloud_blue_bright">#00ddff</color>
     <color name="list_item_lastmod_and_filesize_text">#989898</color>
+    <color name="textColor">#303030</color>
+    <color name="list_divider_background">#fff0f0f0</color>
     
 </resources>
\ No newline at end of file
index d433cba..955f87e 100644 (file)
@@ -18,4 +18,5 @@
 -->
 <resources>
        <dimen name="file_icon_size">32dp</dimen>
+    <dimen name="file_icon_size_grid">128dp</dimen>
 </resources>
index 1fc4d8e..8f2898c 100644 (file)
        <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">Cannot authenticate against this server</string>
+    <string name="auth_account_does_not_exist">Account does not exist in the device yet</string>
     
     <string name="fd_keep_in_sync">Keep file up to date</string>
     <string name="common_rename">Rename</string>
        <string name="prefs_category_security">Security</string>
 
        <string name="prefs_instant_video_upload_path_title">Upload Video Path</string>
+    <string name="download_folder_failed_content">Download of %1$s folder could not be completed</string>
+
+       <string name="subject_token">%1$s shared \"%2$s\" with you</string>
 
     <string name="auth_refresh_button">Refresh connection</string>
     <string name="auth_host_address">Server address</string>
index c65cbad..5996281 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index eb25005..d0e8244 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index 1673e21..ac36984 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
                         android:summary="@string/prefs_pincode_summary"/>
        </PreferenceCategory>
 
-    <PreferenceCategory android:title="@string/prefs_category_instant_uploading">
-        <com.owncloud.android.ui.PreferenceWithLongSummary
-                                                       android:title="@string/prefs_instant_upload_path_title"
-                                                       android:key="instant_upload_path" />
-           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
+    <PreferenceCategory android:title="@string/prefs_category_instant_uploading" android:key="instant_uploading_category">
+         <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
                                android:title="@string/prefs_instant_upload"
                                android:summary="@string/prefs_instant_upload_summary"/>
-           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_uploading"
-                                               android:disableDependentsState="true"
+         <com.owncloud.android.ui.PreferenceWithLongSummary
+                                                       android:title="@string/prefs_instant_upload_path_title"
+                                                       android:key="instant_upload_path" />
+           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
                                                android:title="@string/instant_upload_on_wifi"
                                                android:key="instant_upload_on_wifi"/>
+           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_video_uploading"
+                               android:title="@string/prefs_instant_video_upload"
+                               android:summary="@string/prefs_instant_video_upload_summary" />
            <com.owncloud.android.ui.PreferenceWithLongSummary
                                                        android:title="@string/prefs_instant_video_upload_path_title"
                                                        android:key="instant_video_upload_path" />
-           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_video_uploading"
-                               android:title="@string/prefs_instant_video_upload"
-                               android:summary="@string/prefs_instant_video_upload_summary"/>
-           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_video_uploading"
-                                               android:disableDependentsState="true"
+           <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
                                                android:title="@string/instant_video_upload_on_wifi"
                                                android:key="instant_video_upload_on_wifi"/>
            <!-- DISABLED FOR RELEASE UNTIL FIXED
index 8c8d8b3..805b53e 100644 (file)
@@ -3,7 +3,7 @@
   ownCloud Android client application
 
   Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  Copyright (C) 2015 ownCloud Inc.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
index c2a4c68..2d819f4 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -28,9 +32,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
  * 
  * Contains methods to build the "static" strings. These strings were before constants in different
  * classes
- * 
- * @author masensio
- * @author David A. Velasco
  */
 public class MainApp extends Application {
     
index 1d52fd0..a40b7dd 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -38,9 +41,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
  *  Controller class accessed from the system AccountManager, providing integration of ownCloud accounts with the Android system.
  * 
  *  TODO - better separation in operations for OAuth-capable and regular ownCloud accounts.
- *  TODO - review completeness 
- * 
- * @author David A. Velasco
+ *  TODO - review completeness
  */
 public class AccountAuthenticator extends AbstractAccountAuthenticator {
     
@@ -122,39 +123,39 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
         return bundle;
     }
 
-    /**\r
-     * {@inheritDoc}\r
-     */\r
-    @Override\r
-    public Bundle confirmCredentials(AccountAuthenticatorResponse response,\r
-            Account account, Bundle options) throws NetworkErrorException {\r
-        try {\r
-            validateAccountType(account.type);\r
-        } catch (AuthenticatorException e) {\r
-            Log_OC.e(TAG, "Failed to validate account type " + account.type + ": "\r
-                    + e.getMessage());\r
-            e.printStackTrace();\r
-            return e.getFailureBundle();\r
-        }\r
-        Intent intent = new Intent(mContext, AuthenticatorActivity.class);\r
-        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,\r
-                response);\r
-        intent.putExtra(KEY_ACCOUNT, account);\r
-        intent.putExtra(KEY_LOGIN_OPTIONS, options);\r
-\r
-        setIntentFlags(intent);\r
-\r
-        Bundle resultBundle = new Bundle();\r
-        resultBundle.putParcelable(AccountManager.KEY_INTENT, intent);\r
-        return resultBundle;\r
-    }\r
-\r
-    @Override\r
-    public Bundle editProperties(AccountAuthenticatorResponse response,\r
-            String accountType) {\r
-        return null;\r
-    }\r
-\r
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Bundle confirmCredentials(AccountAuthenticatorResponse response,
+            Account account, Bundle options) throws NetworkErrorException {
+        try {
+            validateAccountType(account.type);
+        } catch (AuthenticatorException e) {
+            Log_OC.e(TAG, "Failed to validate account type " + account.type + ": "
+                    + e.getMessage());
+            e.printStackTrace();
+            return e.getFailureBundle();
+        }
+        Intent intent = new Intent(mContext, AuthenticatorActivity.class);
+        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
+                response);
+        intent.putExtra(KEY_ACCOUNT, account);
+        intent.putExtra(KEY_LOGIN_OPTIONS, options);
+
+        setIntentFlags(intent);
+
+        Bundle resultBundle = new Bundle();
+        resultBundle.putParcelable(AccountManager.KEY_INTENT, intent);
+        return resultBundle;
+    }
+
+    @Override
+    public Bundle editProperties(AccountAuthenticatorResponse response,
+            String accountType) {
+        return null;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -253,69 +254,69 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
         }
     }
 
-    private void validateAuthTokenType(String authTokenType)\r
-            throws UnsupportedAuthTokenTypeException {\r
-        if (!authTokenType.equals(MainApp.getAuthTokenType()) &&\r
-            !authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType())) &&\r
-            !authTokenType.equals(AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType())) &&\r
+    private void validateAuthTokenType(String authTokenType)
+            throws UnsupportedAuthTokenTypeException {
+        if (!authTokenType.equals(MainApp.getAuthTokenType()) &&
+            !authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType())) &&
+            !authTokenType.equals(AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType())) &&
             !authTokenType.equals(AccountTypeUtils.getAuthTokenTypeRefreshToken(MainApp.getAccountType())) &&
-            !authTokenType.equals(AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()))) {\r
-            throw new UnsupportedAuthTokenTypeException();\r
-        }\r
-    }\r
-\r
-    public static class AuthenticatorException extends Exception {\r
-        private static final long serialVersionUID = 1L;\r
-        private Bundle mFailureBundle;\r
-\r
-        public AuthenticatorException(int code, String errorMsg) {\r
-            mFailureBundle = new Bundle();\r
-            mFailureBundle.putInt(AccountManager.KEY_ERROR_CODE, code);\r
-            mFailureBundle\r
-                    .putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);\r
-        }\r
-\r
-        public Bundle getFailureBundle() {\r
-            return mFailureBundle;\r
-        }\r
-    }\r
-\r
-    public static class UnsupportedAccountTypeException extends\r
-            AuthenticatorException {\r
-        private static final long serialVersionUID = 1L;\r
-\r
-        public UnsupportedAccountTypeException() {\r
-            super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,\r
-                    "Unsupported account type");\r
-        }\r
-    }\r
-\r
-    public static class UnsupportedAuthTokenTypeException extends\r
-            AuthenticatorException {\r
-        private static final long serialVersionUID = 1L;\r
-\r
-        public UnsupportedAuthTokenTypeException() {\r
-            super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,\r
-                    "Unsupported auth token type");\r
-        }\r
-    }\r
-\r
-    public static class UnsupportedFeaturesException extends\r
-            AuthenticatorException {\r
-        public static final long serialVersionUID = 1L;\r
-\r
-        public UnsupportedFeaturesException() {\r
-            super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,\r
-                    "Unsupported features");\r
-        }\r
-    }\r
-\r
-    public static class AccessDeniedException extends AuthenticatorException {\r
-        public AccessDeniedException(int code, String errorMsg) {\r
-            super(AccountManager.ERROR_CODE_INVALID_RESPONSE, "Access Denied");\r
-        }\r
-\r
-        private static final long serialVersionUID = 1L;\r
-\r
-    }\r
-}\r
+            !authTokenType.equals(AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()))) {
+            throw new UnsupportedAuthTokenTypeException();
+        }
+    }
+
+    public static class AuthenticatorException extends Exception {
+        private static final long serialVersionUID = 1L;
+        private Bundle mFailureBundle;
+
+        public AuthenticatorException(int code, String errorMsg) {
+            mFailureBundle = new Bundle();
+            mFailureBundle.putInt(AccountManager.KEY_ERROR_CODE, code);
+            mFailureBundle
+                    .putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
+        }
+
+        public Bundle getFailureBundle() {
+            return mFailureBundle;
+        }
+    }
+
+    public static class UnsupportedAccountTypeException extends
+            AuthenticatorException {
+        private static final long serialVersionUID = 1L;
+
+        public UnsupportedAccountTypeException() {
+            super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
+                    "Unsupported account type");
+        }
+    }
+
+    public static class UnsupportedAuthTokenTypeException extends
+            AuthenticatorException {
+        private static final long serialVersionUID = 1L;
+
+        public UnsupportedAuthTokenTypeException() {
+            super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
+                    "Unsupported auth token type");
+        }
+    }
+
+    public static class UnsupportedFeaturesException extends
+            AuthenticatorException {
+        public static final long serialVersionUID = 1L;
+
+        public UnsupportedFeaturesException() {
+            super(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
+                    "Unsupported features");
+        }
+    }
+
+    public static class AccessDeniedException extends AuthenticatorException {
+        public AccessDeniedException(int code, String errorMsg) {
+            super(AccountManager.ERROR_CODE_INVALID_RESPONSE, "Access Denied");
+        }
+
+        private static final long serialVersionUID = 1L;
+
+    }
+}
index c479cea..915b015 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index dc02344..bd3a8e7 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
  *   Copyright (C) 2012  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
index 0f7892e..1e4e8b4 100644 (file)
@@ -1,6 +1,11 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
+ *   @author David A. Velasco\r
+ *   @author masensio\r
  *   Copyright (C) 2012  Bartek Przybylski\r
- *   Copyright (C) 2012-2014 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -64,7 +69,10 @@ import com.actionbarsherlock.app.SherlockDialogFragment;
 import com.owncloud.android.MainApp;\r
 import com.owncloud.android.R;\r
 import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;\r
+import com.owncloud.android.lib.common.OwnCloudCredentials;\r
+import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;\r
 import com.owncloud.android.lib.common.accounts.AccountTypeUtils;\r
+import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;\r
 import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;\r
 import com.owncloud.android.lib.common.network.CertificateCombinedException;\r
 import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;\r
@@ -72,7 +80,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;\r
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;\r
 import com.owncloud.android.lib.common.utils.Log_OC;\r
-import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;\r
 import com.owncloud.android.lib.resources.status.OwnCloudVersion;\r
 import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;\r
 import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod;\r
@@ -89,14 +96,11 @@ import com.owncloud.android.utils.DisplayUtils;
 \r
 /**\r
  * This Activity is used to add an ownCloud account to the App\r
- * \r
- * @author Bartek Przybylski\r
- * @author David A. Velasco\r
- * @author masensio\r
  */\r
 public class AuthenticatorActivity extends AccountAuthenticatorActivity\r
-implements  OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener, \r
-SsoWebViewClientListener, OnSslUntrustedCertListener {\r
+        implements  OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener,\r
+        SsoWebViewClientListener, OnSslUntrustedCertListener,\r
+        AuthenticatorAsyncTask.OnAuthenticatorTaskListener {\r
 \r
     private static final String TAG = AuthenticatorActivity.class.getSimpleName();\r
 \r
@@ -132,6 +136,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     private static final String CREDENTIALS_DIALOG_TAG = "CREDENTIALS_DIALOG";\r
     private static final String KEY_AUTH_IS_FIRST_ATTEMPT_TAG = "KEY_AUTH_IS_FIRST_ATTEMPT";\r
 \r
+    private static final String KEY_USERNAME = "USERNAME";\r
+    private static final String KEY_PASSWORD = "PASSWORD";\r
+    private static final String KEY_ASYNC_TASK_IN_PROGRESS = "AUTH_IN_PROGRESS";\r
     \r
     /// parameters from EXTRAs in starter Intent\r
     private byte mAction;\r
@@ -175,14 +182,19 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     private int mAuthStatusText = 0, mAuthStatusIcon = 0;\r
     \r
     private String mAuthToken = "";\r
+    private AuthenticatorAsyncTask mAsyncTask;\r
 \r
     private boolean mIsFirstAuthAttempt;\r
-\r
     \r
     /// Identifier of operation in progress which result shouldn't be lost \r
     private long mWaitingForOpId = Long.MAX_VALUE;\r
 \r
-    \r
+    private final String BASIC_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
+    private final String OAUTH_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
+    private final String SAML_TOKEN_TYPE =\r
+            AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());\r
+\r
+\r
     /**\r
      * {@inheritDoc}\r
      * \r
@@ -227,7 +239,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         setContentView(R.layout.account_setup);\r
         \r
         /// initialize general UI elements\r
-        initOverallUi(savedInstanceState);\r
+        initOverallUi();\r
         \r
         mOkButton = findViewById(R.id.buttonOK);\r
 \r
@@ -265,21 +277,19 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 \r
     private String chooseAuthTokenType(boolean oauth, boolean saml) {\r
         if (saml) {\r
-            return AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());\r
+            return SAML_TOKEN_TYPE;\r
         } else if (oauth) {\r
-             return AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
+             return OAUTH_TOKEN_TYPE;\r
         } else {\r
-            return AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
+            return BASIC_TOKEN_TYPE;\r
         }\r
     }\r
 \r
     \r
     /**\r
      * Configures elements in the user interface under direct control of the Activity.\r
-     * \r
-     * @param savedInstanceState        Saved activity state, as in {{@link #onCreate(Bundle)}\r
      */\r
-    private void initOverallUi(Bundle savedInstanceState) {\r
+    private void initOverallUi() {\r
         \r
         /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)\r
         boolean isWelcomeLinkVisible = getResources().getBoolean(R.bool.show_welcome_link);\r
@@ -415,9 +425,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                     if (\r
                             AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(\r
                                     MainApp.getAccountType()\r
-                                    ).equals(mAuthTokenType) &&\r
-                            mHostUrlInput.hasFocus()\r
-                    ) {\r
+                            ).equals(mAuthTokenType) &&\r
+                                    mHostUrlInput.hasFocus()\r
+                            ) {\r
                         checkOcServer();\r
                     }\r
                 }\r
@@ -549,7 +559,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * intended to defer the processing of the redirection caught in \r
      * {@link #onNewIntent(Intent)} until {@link #onResume()} \r
      * \r
-     * See {@link #loadSavedInstanceState(Bundle)}\r
+     * See {@link #onSaveInstanceState(Bundle)}\r
      */\r
     @Override\r
     protected void onSaveInstanceState(Bundle outState) {\r
@@ -581,9 +591,42 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         /// authentication\r
         outState.putBoolean(KEY_AUTH_IS_FIRST_ATTEMPT_TAG, mIsFirstAuthAttempt);\r
 \r
+        /// AsyncTask (User and password)\r
+        outState.putString(KEY_USERNAME, mUsernameInput.getText().toString());\r
+        outState.putString(KEY_PASSWORD, mPasswordInput.getText().toString());\r
+\r
+        if (mAsyncTask != null) {\r
+            mAsyncTask.cancel(true);\r
+            outState.putBoolean(KEY_ASYNC_TASK_IN_PROGRESS, true);\r
+        } else {\r
+            outState.putBoolean(KEY_ASYNC_TASK_IN_PROGRESS, false);\r
+        }\r
+        mAsyncTask = null;\r
+\r
         //Log_OC.wtf(TAG, "onSaveInstanceState end" );\r
     }\r
 \r
+    @Override\r
+    public void onRestoreInstanceState(Bundle savedInstanceState) {\r
+        super.onRestoreInstanceState(savedInstanceState);\r
+\r
+        // AsyncTask\r
+        boolean inProgress = savedInstanceState.getBoolean(KEY_ASYNC_TASK_IN_PROGRESS);\r
+        if (inProgress){\r
+            String username = savedInstanceState.getString(KEY_USERNAME);\r
+            String password = savedInstanceState.getString(KEY_PASSWORD);\r
+\r
+            OwnCloudCredentials credentials = null;\r
+            if (BASIC_TOKEN_TYPE.equals(mAuthTokenType)) {\r
+                credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password);\r
+\r
+            } else if (OAUTH_TOKEN_TYPE.equals(mAuthTokenType)) {\r
+                credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);\r
+\r
+            }\r
+            accessRootFolder(credentials);\r
+        }\r
+    }\r
 \r
     /**\r
      * The redirection triggered by the OAuth authentication server as response to the \r
@@ -608,7 +651,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      */\r
     @Override\r
     protected void onResume() {\r
-        //Log_OC.wtf(TAG, "onResume init" );\r
         super.onResume();\r
         \r
         // bound here to avoid spurious changes triggered by Android on device rotations\r
@@ -623,15 +665,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             doOnResumeAndBound();\r
         }\r
         \r
-        //Log_OC.wtf(TAG, "onResume end" );\r
     }\r
 \r
     \r
     @Override\r
     protected void onPause() {\r
-        //Log_OC.wtf(TAG, "onPause init" );\r
         if (mOperationsServiceBinder != null) {\r
-            //Log_OC.wtf(TAG, "unregistering to listen for operation callbacks" );\r
             mOperationsServiceBinder.removeOperationListener(this);\r
         }\r
         \r
@@ -639,7 +678,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         mHostUrlInput.setOnFocusChangeListener(null);\r
         \r
         super.onPause();\r
-        //Log_OC.wtf(TAG, "onPause end" );\r
     }\r
     \r
     @Override\r
@@ -683,7 +721,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         \r
         if (mOperationsServiceBinder != null) {\r
             //Log_OC.wtf(TAG, "getting access token..." );\r
-            mWaitingForOpId = mOperationsServiceBinder.newOperation(getServerInfoIntent);\r
+            mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);\r
         }\r
     }\r
 \r
@@ -695,14 +733,14 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     public void onFocusChange(View view, boolean hasFocus) {\r
         if (view.getId() == R.id.hostUrlInput) {   \r
             if (!hasFocus) {\r
-                onUrlInputFocusLost((TextView) view);\r
+                onUrlInputFocusLost();\r
             }\r
             else {\r
                 showRefreshButton(false);\r
             }\r
 \r
         } else if (view.getId() == R.id.account_password) {\r
-            onPasswordFocusChanged((TextView) view, hasFocus);\r
+            onPasswordFocusChanged(hasFocus);\r
         }\r
     }\r
 \r
@@ -715,10 +753,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * started. \r
      * \r
      * When hasFocus:    user 'comes back' to write again the server URL.\r
-     * \r
-     * @param hostInput     TextView with the URL input field receiving the change of focus.\r
      */\r
-    private void onUrlInputFocusLost(TextView hostInput) {\r
+    private void onUrlInputFocusLost() {\r
         if (!mServerInfo.mBaseUrl.equals(\r
                 normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn))) {\r
             // check server again only if the user changed something in the field\r
@@ -752,7 +788,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 normalizeUrlSuffix(uri)\r
             );\r
             if (mOperationsServiceBinder != null) {\r
-                mWaitingForOpId = mOperationsServiceBinder.newOperation(getServerInfoIntent);\r
+                mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);\r
             } else {\r
               Log_OC.wtf(TAG, "Server check tried with OperationService unbound!" );\r
             }\r
@@ -772,10 +808,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * \r
      * When (!hasFocus), the button is made invisible and the password is hidden.\r
      * \r
-     * @param passwordInput    TextView with the password input field receiving the change of focus.\r
      * @param hasFocus          'True' if focus is received, 'false' if is lost\r
      */\r
-    private void onPasswordFocusChanged(TextView passwordInput, boolean hasFocus) {\r
+    private void onPasswordFocusChanged(boolean hasFocus) {\r
         if (hasFocus) {\r
             showViewPasswordButton();\r
         } else {\r
@@ -840,7 +875,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             mServerStatusText = R.string.auth_wtf_reenter_URL;\r
             showServerStatus();\r
             mOkButton.setEnabled(false);\r
-            //Log_OC.wtf(TAG,  "The user was allowed to click 'connect' to an unchecked server!!");\r
             return;\r
         }\r
 \r
@@ -873,25 +907,17 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
 \r
         /// validate credentials accessing the root folder\r
-        accessRootFolderRemoteOperation(username, password);\r
-        \r
+        OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password);\r
+        accessRootFolder(credentials);\r
     }\r
 \r
-    private void accessRootFolderRemoteOperation(String username, String password) {\r
-        Intent existenceCheckIntent = new Intent();\r
-        existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);\r
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);\r
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, "/");\r
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);\r
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);\r
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);\r
-        \r
-        if (mOperationsServiceBinder != null) {\r
-            //Log_OC.wtf(TAG, "starting existenceCheckRemoteOperation..." );\r
-            mWaitingForOpId = mOperationsServiceBinder.newOperation(existenceCheckIntent);\r
-        }\r
+    private void accessRootFolder(OwnCloudCredentials credentials) {\r
+        mAsyncTask = new AuthenticatorAsyncTask(this);\r
+        Object[] params = { mServerInfo.mBaseUrl, credentials };\r
+        mAsyncTask.execute(params);\r
     }\r
 \r
+\r
     /**\r
      * Starts the OAuth 'grant type' flow to get an access token, with \r
      * a GET AUTHORIZATION request to the BUILT-IN authorization server. \r
@@ -929,17 +955,16 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * in the server.\r
      */\r
     private void startSamlBasedFederatedSingleSignOnAuthorization() {\r
-        // be gentle with the user\r
+        /// be gentle with the user\r
         mAuthStatusIcon = R.drawable.progress_small;\r
         mAuthStatusText = R.string.auth_connecting_auth_server;\r
         showAuthStatus();\r
-        IndeterminateProgressDialog dialog = \r
-                IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
-        dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
-\r
-        /// validate credentials accessing the root folder\r
-        accessRootFolderRemoteOperation("", "");\r
 \r
+        /// Show SAML-based SSO web dialog\r
+        String targetUrl = mServerInfo.mBaseUrl\r
+                + AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
+        SamlWebViewDialog dialog = SamlWebViewDialog.newInstance(targetUrl, targetUrl);\r
+        dialog.show(getSupportFragmentManager(), SAML_DIALOG_TAG);\r
     }\r
 \r
     /**\r
@@ -959,15 +984,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         } else if (operation instanceof OAuth2GetAccessToken) {\r
             onGetOAuthAccessTokenFinish(result);\r
 \r
-        } else if (operation instanceof ExistenceCheckRemoteOperation)  {\r
-            //Log_OC.wtf(TAG, "received detection response through callback" );\r
-            if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).\r
-                    equals(mAuthTokenType)) {\r
-                onSamlBasedFederatedSingleSignOnAuthorizationStart(result);\r
-\r
-            } else {\r
-                onAuthorizationCheckFinish(result);\r
-            }\r
         } else if (operation instanceof GetRemoteUserNameOperation) {\r
             onGetUserNameFinish(result);\r
         }\r
@@ -988,20 +1004,20 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 if (!mUsernameInput.getText().toString().equals(username)) {\r
                     // fail - not a new account, but an existing one; disallow\r
                     result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME);\r
-                    /*\r
-                    OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(\r
-                            new OwnCloudAccount(\r
-                                    Uri.parse(mServerInfo.mBaseUrl),\r
-                                    OwnCloudCredentialsFactory.newSamlSsoCredentials(mAuthToken))\r
-                            );\r
-                            */\r
                     mAuthToken = "";\r
                     updateAuthStatusIconAndText(result);\r
                     showAuthStatus();\r
                     Log_OC.d(TAG, result.getLogMessage());\r
                 } else {\r
-                    updateToken();\r
-                    success = true;\r
+                    try {\r
+                        updateAccountAuthentication();\r
+                        success = true;\r
+\r
+                    } catch (AccountNotFoundException e) {\r
+                        Log_OC.e(TAG, "Account " + mAccount + " was removed!", e);\r
+                        Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show();\r
+                        finish();\r
+                    }\r
                 }\r
             }\r
 \r
@@ -1015,36 +1031,10 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 \r
     }\r
 \r
-    private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperationResult result) {\r
-        mWaitingForOpId = Long.MAX_VALUE;\r
-        dismissDialog(WAIT_DIALOG_TAG);\r
-
-        if (result.isIdPRedirection()) {
-            String url = result.getRedirectedLocation();\r
-            String targetUrl = mServerInfo.mBaseUrl \r
-                    + AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-\r
-            // Show dialog\r
-            SamlWebViewDialog dialog = SamlWebViewDialog.newInstance(url, targetUrl);            \r
-            dialog.show(getSupportFragmentManager(), SAML_DIALOG_TAG);\r
-\r
-            mAuthStatusIcon = 0;\r
-            mAuthStatusText = 0;\r
-\r
-        } else {\r
-            mAuthStatusIcon = R.drawable.common_error;\r
-            mAuthStatusText = R.string.auth_unsupported_auth_method;\r
-\r
-        }\r
-        showAuthStatus();\r
-    }\r
-\r
-\r
     /**\r
      * Processes the result of the server check performed when the user finishes the enter of the\r
      * server URL.\r
-     * \r
-     * @param operation     Server check performed.\r
+     *\r
      * @param result        Result of the check.\r
      */\r
     private void onGetServerInfoFinish(RemoteOperationResult result) {\r
@@ -1089,16 +1079,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 \r
 \r
     private boolean authSupported(AuthenticationMethod authMethod) {\r
-        String basic = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
-        String oAuth = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
-        String saml =  AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());\r
-        \r
-        return (( mAuthTokenType.equals(basic) && \r
-                    authMethod.equals(AuthenticationMethod.BASIC_HTTP_AUTH) ) ||\r
-                ( mAuthTokenType.equals(oAuth) && \r
-                    authMethod.equals(AuthenticationMethod.BEARER_TOKEN)) ||\r
-                ( mAuthTokenType.equals(saml)  && \r
-                    authMethod.equals(AuthenticationMethod.SAML_WEB_SSO))\r
+        return (( BASIC_TOKEN_TYPE.equals(mAuthTokenType) &&\r
+                    AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod) ) ||\r
+                ( OAUTH_TOKEN_TYPE.equals(mAuthTokenType) &&\r
+                    AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) ||\r
+                ( SAML_TOKEN_TYPE.equals(mAuthTokenType)  &&\r
+                    AuthenticationMethod.SAML_WEB_SSO.equals(authMethod))\r
         );\r
     }\r
 \r
@@ -1339,8 +1325,10 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             Map<String, String> tokens = (Map<String, String>)(result.getData().get(0));\r
             mAuthToken = tokens.get(OAuth2Constants.KEY_ACCESS_TOKEN);\r
             Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);\r
-            \r
-            accessRootFolderRemoteOperation("", "");\r
+\r
+            /// validate token accessing to root folder / getting session\r
+            OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);\r
+            accessRootFolder(credentials);\r
 \r
         } else {\r
             updateAuthStatusIconAndText(result);\r
@@ -1354,11 +1342,11 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * Processes the result of the access check performed to try the user credentials.\r
      * \r
      * Creates a new account through the AccountManager.\r
-     * \r
-     * @param operation     Access check performed.\r
+     *\r
      * @param result        Result of the operation.\r
      */\r
-    private void onAuthorizationCheckFinish(RemoteOperationResult result) {\r
+    @Override\r
+    public void onAuthenticatorTaskCallback(RemoteOperationResult result) {\r
         mWaitingForOpId = Long.MAX_VALUE;\r
         dismissDialog(WAIT_DIALOG_TAG);\r
 \r
@@ -1370,15 +1358,22 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 success = createAccount();\r
 \r
             } else {\r
-                updateToken();\r
-                success = true;\r
+                try {\r
+                    updateAccountAuthentication();\r
+                    success = true;\r
+\r
+                } catch (AccountNotFoundException e) {\r
+                    Log_OC.e(TAG, "Account " + mAccount + " was removed!", e);\r
+                    Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show();\r
+                    finish();\r
+                }\r
             }\r
 \r
             if (success) {\r
                 finish();\r
             }\r
             \r
-        } else if (result.isServerFail() || result.isException()) {
+        } else if (result.isServerFail() || result.isException()) {\r
             /// server errors or exceptions in authorization take to requiring a new check of \r
             /// the server\r
             mServerIsChecked = true;\r
@@ -1412,10 +1407,16 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 \r
 \r
     /**\r
-     * Sets the proper response to get that the Account Authenticator that started this activity \r
+     * Updates the authentication token.\r
+     *\r
+     * Sets the proper response so that the AccountAuthenticator that started this activity\r
      * saves a new authorization token for mAccount.\r
+     *\r
+     * Kills the session kept by OwnCloudClientManager so that a new one will created with\r
+     * the new credentials when needed.\r
      */\r
-    private void updateToken() {\r
+    private void updateAccountAuthentication() throws AccountNotFoundException {\r
+        \r
         Bundle response = new Bundle();\r
         response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);\r
         response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);\r
@@ -1501,21 +1502,19 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             final Intent intent = new Intent();       \r
             intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE,    MainApp.getAccountType());\r
             intent.putExtra(AccountManager.KEY_ACCOUNT_NAME,    mAccount.name);\r
-            /*if (!isOAuth)\r
-                intent.putExtra(AccountManager.KEY_AUTHTOKEN,   MainApp.getAccountType()); */\r
             intent.putExtra(AccountManager.KEY_USERDATA,        username);\r
             if (isOAuth || isSaml) {\r
                 mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);\r
             }\r
             /// add user data to the new account; TODO probably can be done in the last parameter \r
-            //      addAccountExplicitly, or in KEY_USERDATA
+            //      addAccountExplicitly, or in KEY_USERDATA\r
             mAccountMgr.setUserData(\r
                     mAccount, Constants.KEY_OC_VERSION,    mServerInfo.mVersion.getVersion()\r
             );\r
             mAccountMgr.setUserData(\r
                     mAccount, Constants.KEY_OC_BASE_URL,   mServerInfo.mBaseUrl\r
             );\r
-
+\r
             if (isSaml) {\r
                 mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE"); \r
             } else if (isOAuth) {\r
@@ -1547,9 +1546,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     /**\r
      * Updates the content and visibility state of the icon and text associated\r
      * to the last check on the ownCloud server.\r
-     * \r
-     * @param serverStatusText      Resource identifier of the text to show.\r
-     * @param serverStatusIcon      Resource identifier of the icon to show.\r
+     *\r
      */\r
     private void showServerStatus() {\r
         if (mServerStatusIcon == 0 && mServerStatusText == 0) {\r
@@ -1627,9 +1624,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     public void onCheckClick(View view) {\r
         CheckBox oAuth2Check = (CheckBox)view;\r
         if (oAuth2Check.isChecked()) {\r
-            mAuthTokenType = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
+            mAuthTokenType = OAUTH_TOKEN_TYPE;\r
         } else {\r
-            mAuthTokenType = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
+            mAuthTokenType = BASIC_TOKEN_TYPE;\r
         }\r
         updateAuthenticationPreFragmentVisibility();\r
     }\r
@@ -1703,8 +1700,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         getUserNameIntent.putExtra(OperationsService.EXTRA_COOKIE, sessionCookie);\r
         \r
         if (mOperationsServiceBinder != null) {\r
-            //Log_OC.wtf(TAG, "starting getRemoteUserNameOperation..." );\r
-            mWaitingForOpId = mOperationsServiceBinder.newOperation(getUserNameIntent);\r
+            mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getUserNameIntent);\r
         }\r
     }\r
 \r
@@ -1836,7 +1832,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             if (component.equals(\r
                     new ComponentName(AuthenticatorActivity.this, OperationsService.class)\r
                 )) {\r
-                //Log_OC.wtf(TAG, "Operations service connected");\r
                 mOperationsServiceBinder = (OperationsServiceBinder) service;\r
                 \r
                 doOnResumeAndBound();\r
@@ -1892,4 +1887,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     public void doNegativeAuthenticatioDialogClick(){\r
         mIsFirstAuthAttempt = true;\r
     }\r
+\r
+\r
 }\r
diff --git a/src/com/owncloud/android/authentication/AuthenticatorAsyncTask.java b/src/com/owncloud/android/authentication/AuthenticatorAsyncTask.java
new file mode 100644 (file)
index 0000000..be15d1c
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio on 09/02/2015.
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.authentication;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.Uri;
+import android.os.AsyncTask;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.OwnCloudClientFactory;
+import com.owncloud.android.lib.common.OwnCloudCredentials;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
+
+import java.lang.ref.WeakReference;
+
+
+/**
+ * Async Task to verify the credentials of a user
+ */
+public class AuthenticatorAsyncTask  extends AsyncTask<Object, Void, RemoteOperationResult> {
+
+    private static String REMOTE_PATH = "/";
+    private static boolean SUCCESS_IF_ABSENT = false;
+
+    private Context mContext;
+    private final WeakReference<OnAuthenticatorTaskListener> mListener;
+    protected Activity mActivity;
+
+    public AuthenticatorAsyncTask(Activity activity) {
+        mContext = activity.getApplicationContext();
+        mListener = new WeakReference<OnAuthenticatorTaskListener>((OnAuthenticatorTaskListener)activity);
+    }
+
+    @Override
+    protected RemoteOperationResult doInBackground(Object... params) {
+
+        RemoteOperationResult result;
+        if (params!= null && params.length==2) {
+            String url = (String)params[0];
+            OwnCloudCredentials credentials = (OwnCloudCredentials)params[1];
+
+            // Client
+            Uri uri = Uri.parse(url);
+            OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true);
+
+            client.setCredentials(credentials);
+
+            // Operation
+            ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(
+                    REMOTE_PATH,
+                    mContext,
+                    SUCCESS_IF_ABSENT
+            );
+            result = operation.execute(client);
+
+        } else {
+            result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
+        }
+
+        return result;
+    }
+
+    @Override
+    protected void onPostExecute(RemoteOperationResult result) {
+
+        if (result!= null)
+        {
+            OnAuthenticatorTaskListener listener = mListener.get();
+            if (listener!= null)
+            {
+                listener.onAuthenticatorTaskCallback(result);
+            }
+        }
+    }
+    /*
+     * Interface to retrieve data from recognition task
+     */
+    public interface OnAuthenticatorTaskListener{
+
+        void onAuthenticatorTaskCallback(RemoteOperationResult result);
+    }
+}
index f96b627..f6bd664 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -21,8 +24,6 @@ package com.owncloud.android.authentication;
  * Constant values for OAuth 2 protocol.
  * 
  * Includes required and optional parameter NAMES used in the 'authorization code' grant type.
- *  
- * @author David A. Velasco
  */
 
 public class OAuth2Constants {
index b90ab85..46a980b 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -50,8 +53,6 @@ import android.webkit.WebViewClient;
  * 
  * Assumes that the single-sign-on is kept thanks to a cookie set at the end of the
  * authentication process.
- *   
- * @author David A. Velasco
  */
 public class SsoWebViewClient extends WebViewClient {
         
@@ -124,7 +125,7 @@ public class SsoWebViewClient extends WebViewClient {
             view.setVisibility(View.GONE);
             CookieManager cookieManager = CookieManager.getInstance();
             final String cookies = cookieManager.getCookie(url);
-            Log_OC.d(TAG, "Cookies: " + cookies);
+            //Log_OC.d(TAG, "Cookies: " + cookies);
             if (mListenerHandler != null && mListenerRef != null) {
                 // this is good idea because onPageFinished is not running in the UI thread
                 mListenerHandler.post(new Runnable() {
@@ -141,22 +142,14 @@ public class SsoWebViewClient extends WebViewClient {
         } 
     }
     
-    
-    @Override
-    public void doUpdateVisitedHistory (WebView view, String url, boolean isReload) {
-        Log_OC.d(TAG, "doUpdateVisitedHistory : " + url);
-    }
-    
     @Override
     public void onReceivedSslError (final WebView view, final SslErrorHandler handler, SslError error) {
-        Log_OC.d(TAG, "onReceivedSslError : " + error);
+        Log_OC.e(TAG, "onReceivedSslError : " + error);
         // Test 1
         X509Certificate x509Certificate = getX509CertificateFromError(error);
         boolean isKnownServer = false;
         
         if (x509Certificate != null) {
-            Log_OC.d(TAG, "------>>>>> x509Certificate " + x509Certificate.toString());
-            
             try {
                 isKnownServer = NetworkUtils.isCertInKnownServersStore((Certificate) x509Certificate, mContext);
             } catch (Exception e) {
@@ -201,36 +194,4 @@ public class SsoWebViewClient extends WebViewClient {
         ((AuthenticatorActivity)mContext).createAuthenticationDialog(view, handler);
     }
 
-    @Override
-    public WebResourceResponse shouldInterceptRequest (WebView view, String url) {
-        Log_OC.d(TAG, "shouldInterceptRequest : " + url);
-        return null;
-    }
-    
-    @Override
-    public void onLoadResource (WebView view, String url) {
-        Log_OC.d(TAG, "onLoadResource : " + url);   
-    }
-    
-    @Override
-    public void onReceivedLoginRequest (WebView view, String realm, String account, String args) {
-        Log_OC.d(TAG, "onReceivedLoginRequest : " + realm + ", " + account + ", " + args);
-    }
-    
-    @Override
-    public void onScaleChanged (WebView view, float oldScale, float newScale) {
-        Log_OC.d(TAG, "onScaleChanged : " + oldScale + " -> " + newScale);
-        super.onScaleChanged(view, oldScale, newScale);
-    }
-
-    @Override
-    public void onUnhandledKeyEvent (WebView view, KeyEvent event) {
-        Log_OC.d(TAG, "onUnhandledKeyEvent : " + event);
-    }
-    
-    @Override
-    public boolean shouldOverrideKeyEvent (WebView view, KeyEvent event) {
-        Log_OC.d(TAG, "shouldOverrideKeyEvent : " + event);
-        return false;
-    }
 }
index d803064..a197e08 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -46,6 +48,7 @@ import android.content.OperationApplicationException;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.RemoteException;
+import android.provider.MediaStore;
 
 public class FileDataStorageManager {
 
@@ -193,6 +196,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
         cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
         cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail());
+        cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading());
         
         boolean sameRemotePath = fileExists(file.getRemotePath());
         if (sameRemotePath ||
@@ -261,8 +265,8 @@ public class FileDataStorageManager {
      * HERE ONLY DATA CONSISTENCY SHOULD BE GRANTED
      *  
      * @param folder
-     * @param files
-     * @param removeNotUpdated
+     * @param updatedFiles
+     * @param filesToRemove
      */
     public void saveFolder(
             OCFile folder, Collection<OCFile> updatedFiles, Collection<OCFile> filesToRemove
@@ -302,6 +306,7 @@ public class FileDataStorageManager {
             cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
             cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
             cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail());
+            cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading());
 
             boolean existsByPath = fileExists(file.getRemotePath());
             if (existsByPath || fileExists(file.getFileId())) {
@@ -491,7 +496,7 @@ public class FileDataStorageManager {
                 if (removeLocalCopy && file.isDown() && localPath != null && success) {
                     success = new File(localPath).delete();
                     if (success) {
-                        triggerMediaScan(localPath);
+                        deleteFileInMediaScan(localPath);
                     }
                     if (!removeDBData && success) {
                         // maybe unnecessary, but should be checked TODO remove if unnecessary
@@ -539,7 +544,8 @@ public class FileDataStorageManager {
 
     private boolean removeLocalFolder(OCFile folder) {
         boolean success = true;
-        File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder));
+        String localFolderPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder);
+        File localFolder = new File(localFolderPath);
         if (localFolder.exists()) {
             // stage 1: remove the local files already registered in the files database
             Vector<OCFile> files = getFolderContent(folder.getFileId());
@@ -549,13 +555,13 @@ public class FileDataStorageManager {
                         success &= removeLocalFolder(file);
                     } else {
                         if (file.isDown()) {
-                            String path = file.getStoragePath();
                             File localFile = new File(file.getStoragePath());
                             success &= localFile.delete();
                             if (success) {
+                                // notify MediaScanner about removed file
+                                deleteFileInMediaScan(file.getStoragePath());
                                 file.setStoragePath(null);
                                 saveFile(file);
-                                triggerMediaScan(path); // notify MediaScanner about removed file
                             }
                         }
                     }
@@ -579,7 +585,6 @@ public class FileDataStorageManager {
                 } else {
                     String path = localFile.getAbsolutePath();
                     success &= localFile.delete();
-                    triggerMediaScan(path); // notify MediaScanner about removed file
                 }
             }
         }
@@ -714,7 +719,7 @@ public class FileDataStorageManager {
                 Iterator<String> it = originalPathsToTriggerMediaScan.iterator();
                 while (it.hasNext()) {
                     // Notify MediaScanner about removed file
-                    triggerMediaScan(it.next());
+                    deleteFileInMediaScan(it.next());
                 }
                 it = newPathsToTriggerMediaScan.iterator();
                 while (it.hasNext()) {
@@ -877,6 +882,8 @@ public class FileDataStorageManager {
             file.setRemoteId(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_REMOTE_ID)));
             file.setNeedsUpdateThumbnail(c.getInt(
                     c.getColumnIndex(ProviderTableMeta.FILE_UPDATE_THUMBNAIL)) == 1 ? true : false);
+            file.setDownloading(c.getInt(
+                    c.getColumnIndex(ProviderTableMeta.FILE_IS_DOWNLOADING)) == 1 ? true : false);
                     
         }
         return file;
@@ -1259,6 +1266,10 @@ public class FileDataStorageManager {
                     ProviderTableMeta.FILE_UPDATE_THUMBNAIL, 
                     file.needsUpdateThumbnail() ? 1 : 0
                 );
+                cv.put(
+                        ProviderTableMeta.FILE_IS_DOWNLOADING,
+                        file.isDownloading() ? 1 : 0
+                );
 
                 boolean existsByPath = fileExists(file.getRemotePath());
                 if (existsByPath || fileExists(file.getFileId())) {
@@ -1490,4 +1501,46 @@ public class FileDataStorageManager {
         MainApp.getAppContext().sendBroadcast(intent);
     }
 
+    public void deleteFileInMediaScan(String path) {
+
+        String mimetypeString = FileStorageUtils.getMimeTypeFromName(path);
+        ContentResolver contentResolver = getContentResolver();
+
+        if (contentResolver != null) {
+            if (mimetypeString.startsWith("image/")) {
+                // Images
+                contentResolver.delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+                        MediaStore.Images.Media.DATA + "=?", new String[]{path});
+            } else if (mimetypeString.startsWith("audio/")) {
+                // Audio
+                contentResolver.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
+                        MediaStore.Audio.Media.DATA + "=?", new String[]{path});
+            } else if (mimetypeString.startsWith("video/")) {
+                // Video
+                contentResolver.delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
+                        MediaStore.Video.Media.DATA + "=?", new String[]{path});
+            }
+        } else {
+            ContentProviderClient contentProviderClient = getContentProviderClient();
+            try {
+                if (mimetypeString.startsWith("image/")) {
+                    // Images
+                    contentProviderClient.delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+                            MediaStore.Images.Media.DATA + "=?", new String[]{path});
+                } else if (mimetypeString.startsWith("audio/")) {
+                    // Audio
+                    contentProviderClient.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
+                            MediaStore.Audio.Media.DATA + "=?", new String[]{path});
+                } else if (mimetypeString.startsWith("video/")) {
+                    // Video
+                    contentProviderClient.delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
+                            MediaStore.Video.Media.DATA + "=?", new String[]{path});
+                }
+            } catch (RemoteException e) {
+                Log_OC.e(TAG, "Exception deleting media file in MediaStore " + e.getMessage());
+            }
+        }
+
+    }
+
 }
index cf25d27..2c9c53b 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -20,9 +22,9 @@ package com.owncloud.android.datamodel;
 
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.webkit.MimeTypeMap;
 
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.utils.FileStorageUtils;
 
 import java.io.File;
 
@@ -70,6 +72,8 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     private boolean mNeedsUpdateThumbnail;
 
+    private boolean mIsDownloading;
+
 
     /**
      * Create new {@link OCFile} with given path.
@@ -112,6 +116,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         mPermissions = source.readString();
         mRemoteId = source.readString();
         mNeedsUpdateThumbnail = source.readInt() == 0;
+        mIsDownloading = source.readInt() == 0;
 
     }
 
@@ -136,6 +141,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         dest.writeString(mPermissions);
         dest.writeString(mRemoteId);
         dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
+        dest.writeInt(mIsDownloading ? 1 : 0);
     }
 
     /**
@@ -348,6 +354,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         mPermissions = null;
         mRemoteId = null;
         mNeedsUpdateThumbnail = false;
+        mIsDownloading = false;
     }
 
     /**
@@ -533,17 +540,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
      */
     public boolean isImage() {
         return ((mMimeType != null && mMimeType.startsWith("image/")) ||
-                getMimeTypeFromName().startsWith("image/"));
-    }
-
-    public String getMimeTypeFromName() {
-        String extension = "";
-        int pos = mRemotePath.lastIndexOf('.');
-        if (pos >= 0) {
-            extension = mRemotePath.substring(pos + 1);
-        }
-        String result = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
-        return (result != null) ? result : "";
+                FileStorageUtils.getMimeTypeFromName(mRemotePath).startsWith("image/"));
     }
 
     public String getPermissions() {
@@ -562,4 +559,16 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         this.mRemoteId = remoteId;
     }
 
+    public boolean isDownloading() {
+        return mIsDownloading;
+    }
+
+    public void setDownloading(boolean isDownloading) {
+        this.mIsDownloading = isDownloading;
+    }
+
+    public boolean isSynchronizing() {
+        // TODO real implementation
+        return false;
+    }
 }
index ce53c44..87fa43f 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Tobias Kaminsky
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -29,10 +33,8 @@ import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.CompressFormat;
 import android.graphics.BitmapFactory;
-import android.graphics.Matrix;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
-import android.media.ExifInterface;
 import android.media.ThumbnailUtils;
 import android.net.Uri;
 import android.os.AsyncTask;
@@ -51,10 +53,7 @@ import com.owncloud.android.utils.BitmapUtils;
 import com.owncloud.android.utils.DisplayUtils;
 
 /**
- * Manager for concurrent access to thumbnails cache. 
- *  
- * @author Tobias Kaminsky
- * @author David A. Velasco
+ * Manager for concurrent access to thumbnails cache.
  */
 public class ThumbnailsCacheManager {
     
@@ -76,7 +75,7 @@ public class ThumbnailsCacheManager {
     public static Bitmap mDefaultImg = 
             BitmapFactory.decodeResource(
                     MainApp.getAppContext().getResources(), 
-                    DisplayUtils.getResourceId("image/png", "default.png")
+                    DisplayUtils.getFileTypeIconId("image/png", "default.png")
             );
 
     
@@ -139,44 +138,15 @@ public class ThumbnailsCacheManager {
         return null;
     }
 
-    
-    public static boolean cancelPotentialWork(OCFile file, ImageView imageView) {
-        final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
-
-        if (bitmapWorkerTask != null) {
-            final OCFile bitmapData = bitmapWorkerTask.mFile;
-            // If bitmapData is not yet set or it differs from the new data
-            if (bitmapData == null || bitmapData != file) {
-                // Cancel previous task
-                bitmapWorkerTask.cancel(true);
-            } else {
-                // The same work is already in progress
-                return false;
-            }
-        }
-        // No task associated with the ImageView, or an existing task was cancelled
-        return true;
-    }
-    
-    public static ThumbnailGenerationTask getBitmapWorkerTask(ImageView imageView) {
-        if (imageView != null) {
-            final Drawable drawable = imageView.getDrawable();
-            if (drawable instanceof AsyncDrawable) {
-                final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable;
-                return asyncDrawable.getBitmapWorkerTask();
-            }
-         }
-         return null;
-     }
-
-    public static class ThumbnailGenerationTask extends AsyncTask<OCFile, Void, Bitmap> {
+    public static class ThumbnailGenerationTask extends AsyncTask<Object, Void, Bitmap> {
         private final WeakReference<ImageView> mImageViewReference;
         private static Account mAccount;
-        private OCFile mFile;
+        private Object mFile;
         private FileDataStorageManager mStorageManager;
-        
+
+
         public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account) {
-         // Use a WeakReference to ensure the ImageView can be garbage collected
+            // Use a WeakReference to ensure the ImageView can be garbage collected
             mImageViewReference = new WeakReference<ImageView>(imageView);
             if (storageManager == null)
                 throw new IllegalArgumentException("storageManager must not be NULL");
@@ -184,95 +154,46 @@ public class ThumbnailsCacheManager {
             mAccount = account;
         }
 
-        // Decode image in background.
+        public ThumbnailGenerationTask(ImageView imageView) {
+            // Use a WeakReference to ensure the ImageView can be garbage collected
+            mImageViewReference = new WeakReference<ImageView>(imageView);
+        }
+
         @Override
-        protected Bitmap doInBackground(OCFile... params) {
+        protected Bitmap doInBackground(Object... params) {
             Bitmap thumbnail = null;
-            
+
             try {
                 if (mAccount != null) {
                     AccountManager accountMgr = AccountManager.get(MainApp.getAppContext());
-                    
+
                     mServerVersion = accountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION);
                     OwnCloudAccount ocAccount = new OwnCloudAccount(mAccount, MainApp.getAppContext());
                     mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
                             getClientFor(ocAccount, MainApp.getAppContext());
                 }
-                
+
                 mFile = params[0];
-                final String imageKey = String.valueOf(mFile.getRemoteId());
-    
-                // Check disk cache in background thread
-                thumbnail = getBitmapFromDiskCache(imageKey);
-    
-                // Not found in disk cache
-                if (thumbnail == null || mFile.needsUpdateThumbnail()) { 
-                    // Converts dp to pixel
-                    Resources r = MainApp.getAppContext().getResources();
-                    
-                    int px = (int) Math.round(r.getDimension(R.dimen.file_icon_size));
-                    
-                    if (mFile.isDown()){
-                        Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
-                                mFile.getStoragePath(), px, px);
-                        
-                        if (bitmap != null) {
-                            thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
-                            
-                            // Rotate image, obeying exif tag
-                            thumbnail = BitmapUtils.rotateImage(thumbnail, mFile.getStoragePath());
-    
-                            // Add thumbnail to cache
-                            addBitmapToCache(imageKey, thumbnail);
+                
+                if (mFile instanceof OCFile) {
+                    thumbnail = doOCFileInBackground();
+                }  else if (mFile instanceof File) {
+                    thumbnail = doFileInBackground();
+                } else {
+                    // do nothing
+                }
 
-                            mFile.setNeedsUpdateThumbnail(false);
-                            mStorageManager.saveFile(mFile);
-                        }
-    
-                    } else {
-                        // Download thumbnail from server
-                        if (mClient != null && mServerVersion != null) {
-                            OwnCloudVersion serverOCVersion = new OwnCloudVersion(mServerVersion);
-                            if (serverOCVersion.compareTo(new OwnCloudVersion(MINOR_SERVER_VERSION_FOR_THUMBS)) >= 0) {
-                                try {
-                                    int status = -1;
-
-                                    String uri = mClient.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" + 
-                                            px + "/" + px + Uri.encode(mFile.getRemotePath(), "/");
-                                    Log_OC.d("Thumbnail", "URI: " + uri);
-                                    GetMethod get = new GetMethod(uri);
-                                    status = mClient.executeMethod(get);
-                                    if (status == HttpStatus.SC_OK) {
-                                        byte[] bytes = get.getResponseBody();
-                                        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
-                                        thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
-
-                                        // Add thumbnail to cache
-                                        if (thumbnail != null) {
-                                            addBitmapToCache(imageKey, thumbnail);
-                                        }
-                                    }
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-                            } else {
-                                Log_OC.d(TAG, "Server too old");
-                            }
-                        }
+                }catch(Throwable t){
+                    // the app should never break due to a problem with thumbnails
+                    Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t);
+                    if (t instanceof OutOfMemoryError) {
+                        System.gc();
                     }
                 }
-                
-            } catch (Throwable t) {
-                // the app should never break due to a problem with thumbnails
-                Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t);
-                if (t instanceof OutOfMemoryError) {
-                    System.gc();
-                }
-            }
-            
+
             return thumbnail;
         }
-        
+
         protected void onPostExecute(Bitmap bitmap){
             if (isCancelled()) {
                 bitmap = null;
@@ -280,47 +201,183 @@ public class ThumbnailsCacheManager {
 
             if (mImageViewReference != null && bitmap != null) {
                 final ImageView imageView = mImageViewReference.get();
-                final ThumbnailGenerationTask bitmapWorkerTask =
-                        getBitmapWorkerTask(imageView);
+                final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
                 if (this == bitmapWorkerTask && imageView != null) {
-                    if (imageView.getTag().equals(mFile.getFileId())) {
+                    String tagId = "";
+                    if (mFile instanceof OCFile){
+                        tagId = String.valueOf(((OCFile)mFile).getFileId());
+                    } else if (mFile instanceof File){
+                        tagId = String.valueOf(((File)mFile).hashCode());
+                    }
+                    if (String.valueOf(imageView.getTag()).equals(tagId)) {
                         imageView.setImageBitmap(bitmap);
                     }
                 }
             }
         }
+
+        /**
+         * Add thumbnail to cache
+         * @param imageKey: thumb key
+         * @param bitmap:   image for extracting thumbnail
+         * @param path:     image path
+         * @param px:       thumbnail dp
+         * @return Bitmap
+         */
+        private Bitmap addThumbnailToCache(String imageKey, Bitmap bitmap, String path, int px){
+
+            Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
+
+            // Rotate image, obeying exif tag
+            thumbnail = BitmapUtils.rotateImage(thumbnail,path);
+
+            // Add thumbnail to cache
+            addBitmapToCache(imageKey, thumbnail);
+
+            return thumbnail;
+        }
+
+        /**
+         * Converts size of file icon from dp to pixel
+         * @return int
+         */
+        private int getThumbnailDimension(){
+            // Converts dp to pixel
+            Resources r = MainApp.getAppContext().getResources();
+            return (int) Math.round(r.getDimension(R.dimen.file_icon_size_grid));
+        }
+
+        private Bitmap doOCFileInBackground() {
+            Bitmap thumbnail = null;
+            OCFile file = (OCFile)mFile;
+
+            final String imageKey = String.valueOf(file.getRemoteId());
+
+            // Check disk cache in background thread
+            thumbnail = getBitmapFromDiskCache(imageKey);
+
+            // Not found in disk cache
+            if (thumbnail == null || file.needsUpdateThumbnail()) {
+
+                int px = getThumbnailDimension();
+
+                if (file.isDown()) {
+                    Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
+                            file.getStoragePath(), px, px);
+
+                    if (bitmap != null) {
+                        thumbnail = addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), px);
+
+                        file.setNeedsUpdateThumbnail(false);
+                        mStorageManager.saveFile(file);
+                    }
+
+                } else {
+                    // Download thumbnail from server
+                    if (mClient != null && mServerVersion != null) {
+                        OwnCloudVersion serverOCVersion = new OwnCloudVersion(mServerVersion);
+                        if (serverOCVersion.compareTo(new OwnCloudVersion(MINOR_SERVER_VERSION_FOR_THUMBS)) >= 0) {
+                            try {
+                                int status = -1;
+
+                                String uri = mClient.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" +
+                                        px + "/" + px + Uri.encode(file.getRemotePath(), "/");
+                                Log_OC.d("Thumbnail", "URI: " + uri);
+                                GetMethod get = new GetMethod(uri);
+                                status = mClient.executeMethod(get);
+                                if (status == HttpStatus.SC_OK) {
+                                    byte[] bytes = get.getResponseBody();
+                                    Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
+                                    thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
+
+                                    // Add thumbnail to cache
+                                    if (thumbnail != null) {
+                                        addBitmapToCache(imageKey, thumbnail);
+                                    }
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        } else {
+                            Log_OC.d(TAG, "Server too old");
+                        }
+                    }
+                }
+            }
+
+            return thumbnail;
+
+        }
+
+        private Bitmap doFileInBackground() {
+            Bitmap thumbnail = null;
+            File file = (File)mFile;
+
+            final String imageKey = String.valueOf(file.hashCode());
+
+            // Check disk cache in background thread
+            thumbnail = getBitmapFromDiskCache(imageKey);
+
+            // Not found in disk cache
+            if (thumbnail == null) {
+
+                int px = getThumbnailDimension();
+
+                Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
+                        file.getAbsolutePath(), px, px);
+
+                if (bitmap != null) {
+                    thumbnail = addThumbnailToCache(imageKey, bitmap, file.getPath(), px);
+                }
+            }
+            return thumbnail;
+        }
+
     }
-  
-    
+
+    public static boolean cancelPotentialWork(Object file, ImageView imageView) {
+        final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
+
+        if (bitmapWorkerTask != null) {
+            final Object bitmapData = bitmapWorkerTask.mFile;
+            // If bitmapData is not yet set or it differs from the new data
+            if (bitmapData == null || bitmapData != file) {
+                // Cancel previous task
+                bitmapWorkerTask.cancel(true);
+            } else {
+                // The same work is already in progress
+                return false;
+            }
+        }
+        // No task associated with the ImageView, or an existing task was cancelled
+        return true;
+    }
+
+    public static ThumbnailGenerationTask getBitmapWorkerTask(ImageView imageView) {
+        if (imageView != null) {
+            final Drawable drawable = imageView.getDrawable();
+            if (drawable instanceof AsyncDrawable) {
+                final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable;
+                return asyncDrawable.getBitmapWorkerTask();
+            }
+        }
+        return null;
+    }
+
     public static class AsyncDrawable extends BitmapDrawable {
         private final WeakReference<ThumbnailGenerationTask> bitmapWorkerTaskReference;
 
         public AsyncDrawable(
                 Resources res, Bitmap bitmap, ThumbnailGenerationTask bitmapWorkerTask
-            ) {
-            
+        ) {
+
             super(res, bitmap);
             bitmapWorkerTaskReference =
-                new WeakReference<ThumbnailGenerationTask>(bitmapWorkerTask);
+                    new WeakReference<ThumbnailGenerationTask>(bitmapWorkerTask);
         }
 
         public ThumbnailGenerationTask getBitmapWorkerTask() {
             return bitmapWorkerTaskReference.get();
         }
     }
-
-    
-    /**
-     * Remove from cache the remoteId passed
-     * @param fileRemoteId: remote id of mFile passed
-     */
-    public static void removeFileFromCache(String fileRemoteId){
-        synchronized (mThumbnailsDiskCacheLock) {
-            if (mThumbnailCache != null) {
-                mThumbnailCache.removeKey(fileRemoteId);
-            }
-            mThumbnailsDiskCacheLock.notifyAll(); // Wake any waiting threads
-        }
-    }
-    
 }
index 717066b..6611306 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
  *   Copyright (C) 2011-2012  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -28,9 +31,6 @@ import android.database.sqlite.SQLiteOpenHelper;
 
 /**
  * Custom database helper for ownCloud
- * 
- * @author Bartek Przybylski
- * 
  */
 public class DbHandler {
     private SQLiteDatabase mDB;
@@ -114,7 +114,14 @@ public class DbHandler {
                 db.execSQL("ALTER TABLE " + TABLE_INSTANT_UPLOAD + " ADD COLUMN attempt INTEGER;");
             }
             db.execSQL("ALTER TABLE " + TABLE_INSTANT_UPLOAD + " ADD COLUMN message TEXT;");
-
+        }
+        
+        @Override
+        public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            //downgrading is the exception, so deleting and re-creating is acceptable.
+            //otherwise exception will be thrown (cannot downgrade) and oc app will crash.
+            db.execSQL("DROP TABLE IF EXISTS " + TABLE_INSTANT_UPLOAD + ";");
+            onCreate(db);
         }
     }
 }
index bc59869..1f789d1 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -24,14 +27,11 @@ import com.owncloud.android.MainApp;
 \r
 /**\r
  * Meta-Class that holds various static field information\r
- * \r
- * @author Bartek Przybylski\r
- * \r
  */\r
 public class ProviderMeta {\r
 \r
     public static final String DB_NAME = "filelist";\r
-    public static final int DB_VERSION = 8;\r
+    public static final int DB_VERSION = 9;\r
 \r
     private ProviderMeta() {\r
     }\r
@@ -71,6 +71,7 @@ public class ProviderMeta {
         public static final String FILE_PERMISSIONS = "permissions";\r
         public static final String FILE_REMOTE_ID = "remote_id";\r
         public static final String FILE_UPDATE_THUMBNAIL = "update_thumbnail";\r
+        public static final String FILE_IS_DOWNLOADING= "is_downloading";\r
 \r
         public static final String FILE_DEFAULT_SORT_ORDER = FILE_NAME\r
                 + " collate nocase asc";\r
index 4e139ae..2cf4358 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -29,8 +32,6 @@ import android.content.Intent;
 /**
  * App-registered receiver catching the broadcast intent reporting that the system was 
  * just boot up.
- * 
- * @author David A. Velasco
  */
 public class BootupBroadcastReceiver extends BroadcastReceiver {
 
index 6eb746c..04e9fbc 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,13 +34,13 @@ import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
 import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
+import com.owncloud.android.services.OperationsService;
+import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 
 /**
  * Filters out the file actions available in a given {@link Menu} for a given {@link OCFile} 
  * according to the current state of the latest. 
- * 
- * @author David A. Velasco
  */
 public class FileMenuFilter {
 
@@ -51,8 +54,8 @@ public class FileMenuFilter {
      * 
      * @param targetFile        {@link OCFile} target of the action to filter in the {@link Menu}.
      * @param account           ownCloud {@link Account} holding targetFile.
-     * @param cg                Accessor to app components, needed to get access the 
-     *                          {@link FileUploader} and {@link FileDownloader} services.
+     * @param cg                Accessor to app components, needed to access the
+     *                          {@link FileUploader} and {@link FileDownloader} services
      * @param context           Android {@link Context}, needed to access build setup resources.
      */
     public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg, Context context) {
@@ -140,15 +143,17 @@ public class FileMenuFilter {
         boolean uploading = false;
         if (mComponentsGetter != null && mFile != null && mAccount != null) {
             FileDownloaderBinder downloaderBinder = mComponentsGetter.getFileDownloaderBinder();
-            downloading = downloaderBinder != null && downloaderBinder.isDownloading(mAccount, mFile);
+            downloading = (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, mFile));
+            OperationsServiceBinder opsBinder = mComponentsGetter.getOperationsServiceBinder();
+            downloading |= (opsBinder != null && opsBinder.isSynchronizing(mAccount, mFile.getRemotePath()));
             FileUploaderBinder uploaderBinder = mComponentsGetter.getFileUploaderBinder();
-            uploading = uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile);
+            uploading = (uploaderBinder != null && uploaderBinder.isUploading(mAccount, mFile));
         }
         
         /// decision is taken for each possible action on a file in the menu
         
         // DOWNLOAD 
-        if (mFile == null || mFile.isFolder() || mFile.isDown() || downloading || uploading) {
+        if (mFile == null || mFile.isDown() || downloading || uploading) {
             toHide.add(R.id.action_download_file);
             
         } else {
@@ -189,7 +194,7 @@ public class FileMenuFilter {
         
         
         // CANCEL DOWNLOAD
-        if (mFile == null || !downloading || mFile.isFolder()) {
+        if (mFile == null || !downloading) {
             toHide.add(R.id.action_cancel_download);
         } else {
             toShow.add(R.id.action_cancel_download);
index e1ab195..4658811 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -41,9 +45,7 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.dialog.ShareLinkToDialog;
 
 /**
- * 
- * @author masensio
- * @author David A. Velasco
+ *
  */
 public class FileOperationsHelper {
 
@@ -127,7 +129,7 @@ public class FileOperationsHelper {
             service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
             service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
             service.putExtra(OperationsService.EXTRA_SEND_INTENT, sendIntent);
-            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().newOperation(service);
+            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
             
         } else {
             Log_OC.wtf(TAG, "Trying to open a NULL OCFile");
@@ -165,7 +167,7 @@ public class FileOperationsHelper {
             service.setAction(OperationsService.ACTION_UNSHARE);
             service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
             service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
-            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().newOperation(service);
+            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
             
             mFileActivity.showLoadingDialog();
             
@@ -197,18 +199,25 @@ public class FileOperationsHelper {
     
     
     public void syncFile(OCFile file) {
-        // Sync file
-        Intent service = new Intent(mFileActivity, OperationsService.class);
-        service.setAction(OperationsService.ACTION_SYNC_FILE);
-        service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
-        service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath()); 
-        service.putExtra(OperationsService.EXTRA_SYNC_FILE_CONTENTS, true);
-        mWaitingForOpId = mFileActivity.getOperationsServiceBinder().newOperation(service);
         
-        mFileActivity.showLoadingDialog();
+        if (!file.isFolder()){
+            Intent intent = new Intent(mFileActivity, OperationsService.class);
+            intent.setAction(OperationsService.ACTION_SYNC_FILE);
+            intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+            intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+            intent.putExtra(OperationsService.EXTRA_SYNC_FILE_CONTENTS, true);
+            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(intent);
+            mFileActivity.showLoadingDialog();
+            
+        } else {
+            Intent intent = new Intent(mFileActivity, OperationsService.class);
+            intent.setAction(OperationsService.ACTION_SYNC_FOLDER);
+            intent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+            intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+            mFileActivity.startService(intent);
+        }
     }
     
-    
     public void renameFile(OCFile file, String newFilename) {
         // RenameFile
         Intent service = new Intent(mFileActivity, OperationsService.class);
@@ -216,7 +225,7 @@ public class FileOperationsHelper {
         service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
         service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
         service.putExtra(OperationsService.EXTRA_NEWNAME, newFilename);
-        mWaitingForOpId = mFileActivity.getOperationsServiceBinder().newOperation(service);
+        mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
         
         mFileActivity.showLoadingDialog();
     }
@@ -229,7 +238,7 @@ public class FileOperationsHelper {
         service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
         service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
         service.putExtra(OperationsService.EXTRA_REMOVE_ONLY_LOCAL, onlyLocalCopy);
-        mWaitingForOpId =  mFileActivity.getOperationsServiceBinder().newOperation(service);
+        mWaitingForOpId =  mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
         
         mFileActivity.showLoadingDialog();
     }
@@ -242,26 +251,38 @@ public class FileOperationsHelper {
         service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
         service.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);
         service.putExtra(OperationsService.EXTRA_CREATE_FULL_PATH, createFullPath);
-        mWaitingForOpId =  mFileActivity.getOperationsServiceBinder().newOperation(service);
+        mWaitingForOpId =  mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
         
         mFileActivity.showLoadingDialog();
     }
 
-    
+    /**
+     * Cancel the transference in downloads (files/folders) and file uploads
+     * @param file OCFile
+     */
     public void cancelTransference(OCFile file) {
         Account account = mFileActivity.getAccount();
+        if (file.isFolder()) {
+            OperationsService.OperationsServiceBinder opsBinder = mFileActivity.getOperationsServiceBinder();
+            if (opsBinder != null) {
+                opsBinder.cancel(account, file);
+            }
+        }
+
+        // for both files and folders
         FileDownloaderBinder downloaderBinder = mFileActivity.getFileDownloaderBinder();
-        FileUploaderBinder uploaderBinder =  mFileActivity.getFileUploaderBinder();
+        FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder();
         if (downloaderBinder != null && downloaderBinder.isDownloading(account, file)) {
+            downloaderBinder.cancel(account, file);
+
+            // TODO - review why is this here, and solve in a better way
             // Remove etag for parent, if file is a keep_in_sync
             if (file.keepInSync()) {
-               OCFile parent = mFileActivity.getStorageManager().getFileById(file.getParentId());
-               parent.setEtag("");
-               mFileActivity.getStorageManager().saveFile(parent);
+                OCFile parent = mFileActivity.getStorageManager().getFileById(file.getParentId());
+                parent.setEtag("");
+                mFileActivity.getStorageManager().saveFile(parent);
             }
-            
-            downloaderBinder.cancel(account, file);
-            
+
         } else if (uploaderBinder != null && uploaderBinder.isUploading(account, file)) {
             uploaderBinder.cancel(account, file);
         }
@@ -279,7 +300,7 @@ public class FileOperationsHelper {
         service.putExtra(OperationsService.EXTRA_NEW_PARENT_PATH, newfile.getRemotePath());
         service.putExtra(OperationsService.EXTRA_REMOTE_PATH, currentFile.getRemotePath());
         service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
-        mWaitingForOpId =  mFileActivity.getOperationsServiceBinder().newOperation(service);
+        mWaitingForOpId =  mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
 
         mFileActivity.showLoadingDialog();
     }
index c1c3e9c..b52c36d 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index c9ad961..f5be6a7 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2012-2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -25,10 +27,9 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 
 import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -51,7 +52,9 @@ import com.owncloud.android.ui.preview.PreviewImageFragment;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 
 import android.accounts.Account;
+import android.accounts.AccountManager;
 import android.accounts.AccountsException;
+import android.accounts.OnAccountsUpdateListener;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -64,118 +67,159 @@ import android.os.Looper;
 import android.os.Message;
 import android.os.Process;
 import android.support.v4.app.NotificationCompat;
+import android.util.Pair;
+
+public class FileDownloader extends Service
+        implements OnDatatransferProgressListener, OnAccountsUpdateListener {
 
-public class FileDownloader extends Service implements OnDatatransferProgressListener {
-    
     public static final String EXTRA_ACCOUNT = "ACCOUNT";
     public static final String EXTRA_FILE = "FILE";
-    
+
     private static final String DOWNLOAD_ADDED_MESSAGE = "DOWNLOAD_ADDED";
     private static final String DOWNLOAD_FINISH_MESSAGE = "DOWNLOAD_FINISH";
-    public static final String EXTRA_DOWNLOAD_RESULT = "RESULT";    
+    public static final String EXTRA_DOWNLOAD_RESULT = "RESULT";
     public static final String EXTRA_FILE_PATH = "FILE_PATH";
     public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";
+    public static final String EXTRA_LINKED_TO_PATH = "LINKED_TO";
     public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
-    
+
     private static final String TAG = "FileDownloader";
 
     private Looper mServiceLooper;
     private ServiceHandler mServiceHandler;
     private IBinder mBinder;
     private OwnCloudClient mDownloadClient = null;
-    private Account mLastAccount = null;
+    private Account mCurrentAccount = null;
     private FileDataStorageManager mStorageManager;
-    
-    private ConcurrentMap<String, DownloadFileOperation> mPendingDownloads = new ConcurrentHashMap<String, DownloadFileOperation>();
+
+    private IndexedForest<DownloadFileOperation> mPendingDownloads = new IndexedForest<DownloadFileOperation>();
+
     private DownloadFileOperation mCurrentDownload = null;
-    
+
     private NotificationManager mNotificationManager;
     private NotificationCompat.Builder mNotificationBuilder;
     private int mLastPercent;
-    
-    
+
+
     public static String getDownloadAddedMessage() {
-        return FileDownloader.class.getName().toString() + DOWNLOAD_ADDED_MESSAGE;
+        return FileDownloader.class.getName() + DOWNLOAD_ADDED_MESSAGE;
     }
-    
+
     public static String getDownloadFinishMessage() {
-        return FileDownloader.class.getName().toString() + DOWNLOAD_FINISH_MESSAGE;
-    }
-    
-    /**
-     * Builds a key for mPendingDownloads from the account and file to download
-     * 
-     * @param account   Account where the file to download is stored
-     * @param file      File to download
-     */
-    private String buildRemoteName(Account account, OCFile file) {
-        return account.name + file.getRemotePath();
+        return FileDownloader.class.getName() + DOWNLOAD_FINISH_MESSAGE;
     }
 
-    
     /**
      * Service initialization
      */
     @Override
     public void onCreate() {
         super.onCreate();
+        Log_OC.d(TAG, "Creating service");
         mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-        HandlerThread thread = new HandlerThread("FileDownloaderThread",
-                Process.THREAD_PRIORITY_BACKGROUND);
+        HandlerThread thread = new HandlerThread("FileDownloaderThread", Process.THREAD_PRIORITY_BACKGROUND);
         thread.start();
         mServiceLooper = thread.getLooper();
         mServiceHandler = new ServiceHandler(mServiceLooper, this);
         mBinder = new FileDownloaderBinder();
+
+        // add AccountsUpdatedListener
+        AccountManager am = AccountManager.get(getApplicationContext());
+        am.addOnAccountsUpdatedListener(this, null, false);
     }
 
+
+    /**
+     * Service clean up
+     */
+    @Override
+    public void onDestroy() {
+        Log_OC.v(TAG, "Destroying service");
+        mBinder = null;
+        mServiceHandler = null;
+        mServiceLooper.quit();
+        mServiceLooper = null;
+        mNotificationManager = null;
+
+        // remove AccountsUpdatedListener
+        AccountManager am = AccountManager.get(getApplicationContext());
+        am.removeOnAccountsUpdatedListener(this);
+
+        super.onDestroy();
+    }
+
+
     /**
      * Entry point to add one or several files to the queue of downloads.
-     * 
-     * New downloads are added calling to startService(), resulting in a call to this method. This ensures the service will keep on working 
-     * although the caller activity goes away.
+     * <p/>
+     * New downloads are added calling to startService(), resulting in a call to this method.
+     * This ensures the service will keep on working although the caller activity goes away.
      */
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
-        if (    !intent.hasExtra(EXTRA_ACCOUNT) ||
+        Log_OC.d(TAG, "Starting command with id " + startId);
+
+        if (!intent.hasExtra(EXTRA_ACCOUNT) ||
                 !intent.hasExtra(EXTRA_FILE)
-                /*!intent.hasExtra(EXTRA_FILE_PATH) ||
-                !intent.hasExtra(EXTRA_REMOTE_PATH)*/
-           ) {
+                ) {
             Log_OC.e(TAG, "Not enough information provided in intent");
             return START_NOT_STICKY;
-        }
-        Account account = intent.getParcelableExtra(EXTRA_ACCOUNT);
-        OCFile file = intent.getParcelableExtra(EXTRA_FILE);
-        
-        AbstractList<String> requestedDownloads = new Vector<String>(); // dvelasco: now this always contains just one element, but that can change in a near future (download of multiple selection)
-        String downloadKey = buildRemoteName(account, file);
-        try {
-            DownloadFileOperation newDownload = new DownloadFileOperation(account, file); 
-            mPendingDownloads.putIfAbsent(downloadKey, newDownload);
-            newDownload.addDatatransferProgressListener(this);
-            newDownload.addDatatransferProgressListener((FileDownloaderBinder)mBinder);
-            requestedDownloads.add(downloadKey);
-            sendBroadcastNewDownload(newDownload);
-            
-        } catch (IllegalArgumentException e) {
-            Log_OC.e(TAG, "Not enough information provided in intent: " + e.getMessage());
-            return START_NOT_STICKY;
-        }
-        
-        if (requestedDownloads.size() > 0) {
-            Message msg = mServiceHandler.obtainMessage();
-            msg.arg1 = startId;
-            msg.obj = requestedDownloads;
-            mServiceHandler.sendMessage(msg);
+        } else {
+            final Account account = intent.getParcelableExtra(EXTRA_ACCOUNT);
+            final OCFile file = intent.getParcelableExtra(EXTRA_FILE);
+
+            /*Log_OC.v(
+                    "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                    "Received request to download file"
+            );*/
+
+            AbstractList<String> requestedDownloads = new Vector<String>();
+            try {
+                DownloadFileOperation newDownload = new DownloadFileOperation(account, file);
+                newDownload.addDatatransferProgressListener(this);
+                newDownload.addDatatransferProgressListener((FileDownloaderBinder) mBinder);
+                Pair<String, String> putResult = mPendingDownloads.putIfAbsent(
+                        account, file.getRemotePath(), newDownload
+                );
+                String downloadKey = putResult.first;
+                requestedDownloads.add(downloadKey);
+                    /*Log_OC.v(
+                        "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                        "Download on " + file.getRemotePath() + " added to queue"
+                    );*/
+
+                // Store file on db with state 'downloading'
+                    /*
+                    TODO - check if helps with UI responsiveness, letting only folders use FileDownloaderBinder to check
+                    FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver());
+                    file.setDownloading(true);
+                    storageManager.saveFile(file);
+                    */
+
+                sendBroadcastNewDownload(newDownload, putResult.second);
+
+            } catch (IllegalArgumentException e) {
+                Log_OC.e(TAG, "Not enough information provided in intent: " + e.getMessage());
+                return START_NOT_STICKY;
+            }
+
+            if (requestedDownloads.size() > 0) {
+                Message msg = mServiceHandler.obtainMessage();
+                msg.arg1 = startId;
+                msg.obj = requestedDownloads;
+                mServiceHandler.sendMessage(msg);
+            }
+            //}
         }
 
         return START_NOT_STICKY;
     }
-    
-    
+
+
     /**
-     * Provides a binder object that clients can use to perform operations on the queue of downloads, excepting the addition of new files. 
-     * 
+     * Provides a binder object that clients can use to perform operations on the queue of downloads,
+     * excepting the addition of new files.
+     * <p/>
      * Implemented to perform cancellation, pause and resume of existing downloads.
      */
     @Override
@@ -189,123 +233,173 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
      */
     @Override
     public boolean onUnbind(Intent intent) {
-        ((FileDownloaderBinder)mBinder).clearListeners();
+        ((FileDownloaderBinder) mBinder).clearListeners();
         return false;   // not accepting rebinding (default behaviour)
     }
 
-    
+    @Override
+    public void onAccountsUpdated(Account[] accounts) {
+         //review the current download and cancel it if its account doesn't exist
+        if (mCurrentDownload != null &&
+                !AccountUtils.exists(mCurrentDownload.getAccount(), getApplicationContext())) {
+            mCurrentDownload.cancel();
+        }
+        // The rest of downloads are cancelled when they try to start
+    }
+
+
     /**
-     *  Binder to let client components to perform operations on the queue of downloads.
-     * 
-     *  It provides by itself the available operations.
+     * Binder to let client components to perform operations on the queue of downloads.
+     * <p/>
+     * It provides by itself the available operations.
      */
     public class FileDownloaderBinder extends Binder implements OnDatatransferProgressListener {
-        
-        /** 
-         * Map of listeners that will be reported about progress of downloads from a {@link FileDownloaderBinder} instance 
+
+        /**
+         * Map of listeners that will be reported about progress of downloads from a {@link FileDownloaderBinder}
+         * instance.
          */
-        private Map<String, OnDatatransferProgressListener> mBoundListeners = new HashMap<String, OnDatatransferProgressListener>();
-        
-        
+        private Map<Long, OnDatatransferProgressListener> mBoundListeners =
+                new HashMap<Long, OnDatatransferProgressListener>();
+
+
         /**
          * Cancels a pending or current download of a remote file.
-         * 
-         * @param account       Owncloud account where the remote file is stored.
-         * @param file          A file in the queue of pending downloads
+         *
+         * @param account ownCloud account where the remote file is stored.
+         * @param file    A file in the queue of pending downloads
          */
         public void cancel(Account account, OCFile file) {
-            DownloadFileOperation download = null;
-            synchronized (mPendingDownloads) {
-                download = mPendingDownloads.remove(buildRemoteName(account, file));
-            }
+            /*Log_OC.v(
+                    "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                    "Received request to cancel download of " + file.getRemotePath()
+            );
+            Log_OC.v(   "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                    "Removing download of " + file.getRemotePath());*/
+            Pair<DownloadFileOperation, String> removeResult =
+                    mPendingDownloads.remove(account, file.getRemotePath());
+            DownloadFileOperation download = removeResult.first;
             if (download != null) {
+                /*Log_OC.v(   "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                        "Canceling returned download of " + file.getRemotePath());*/
                 download.cancel();
+            } else {
+                if (mCurrentDownload != null && mCurrentAccount != null &&
+                        mCurrentDownload.getRemotePath().startsWith(file.getRemotePath()) &&
+                        account.name.equals(mCurrentAccount.name)) {
+                    /*Log_OC.v(   "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                            "Canceling current sync as descendant: " + mCurrentDownload.getRemotePath());*/
+                    mCurrentDownload.cancel();
+                }
             }
         }
-        
-        
+
+        /**
+         * Cancels a pending or current upload for an account
+         *
+         * @param account Owncloud accountName where the remote file will be stored.
+         */
+        public void cancel(Account account) {
+            Log_OC.d(TAG, "Account= " + account.name);
+
+            if (mCurrentDownload != null) {
+                Log_OC.d(TAG, "Current Download Account= " + mCurrentDownload.getAccount().name);
+                if (mCurrentDownload.getAccount().name.equals(account.name)) {
+                    mCurrentDownload.cancel();
+                }
+            }
+            // Cancel pending downloads
+            cancelDownloadsForAccount(account);
+        }
+
         public void clearListeners() {
             mBoundListeners.clear();
         }
 
 
         /**
-         * Returns True when the file described by 'file' in the ownCloud account 'account' is downloading or waiting to download.
-         * 
-         * If 'file' is a directory, returns 'true' if some of its descendant files is downloading or waiting to download. 
-         * 
-         * @param account       Owncloud account where the remote file is stored.
-         * @param file          A file that could be in the queue of downloads.
+         * Returns True when the file described by 'file' in the ownCloud account 'account' is downloading or
+         * waiting to download.
+         * <p/>
+         * If 'file' is a directory, returns 'true' if any of its descendant files is downloading or
+         * waiting to download.
+         *
+         * @param account ownCloud account where the remote file is stored.
+         * @param file    A file that could be in the queue of downloads.
          */
         public boolean isDownloading(Account account, OCFile file) {
             if (account == null || file == null) return false;
-            String targetKey = buildRemoteName(account, file);
-            synchronized (mPendingDownloads) {
-                if (file.isFolder()) {
-                    // this can be slow if there are many downloads :(
-                    Iterator<String> it = mPendingDownloads.keySet().iterator();
-                    boolean found = false;
-                    while (it.hasNext() && !found) {
-                        found = it.next().startsWith(targetKey);
-                    }
-                    return found;
-                } else {
-                    return (mPendingDownloads.containsKey(targetKey));
-                }
-            }
+            return (mPendingDownloads.contains(account, file.getRemotePath()));
         }
 
-        
+
         /**
          * Adds a listener interested in the progress of the download for a concrete file.
-         * 
-         * @param listener      Object to notify about progress of transfer.    
-         * @param account       ownCloud account holding the file of interest.
-         * @param file          {@link OCfile} of interest for listener. 
+         *
+         * @param listener Object to notify about progress of transfer.
+         * @param account  ownCloud account holding the file of interest.
+         * @param file     {@link OCFile} of interest for listener.
          */
-        public void addDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {
+        public void addDatatransferProgressListener(
+                OnDatatransferProgressListener listener, Account account, OCFile file
+        ) {
             if (account == null || file == null || listener == null) return;
-            String targetKey = buildRemoteName(account, file);
-            mBoundListeners.put(targetKey, listener);
+            //String targetKey = buildKey(account, file.getRemotePath());
+            mBoundListeners.put(file.getFileId(), listener);
         }
-        
-        
+
+
         /**
          * Removes a listener interested in the progress of the download for a concrete file.
-         * 
-         * @param listener      Object to notify about progress of transfer.    
-         * @param account       ownCloud account holding the file of interest.
-         * @param file          {@link OCfile} of interest for listener. 
+         *
+         * @param listener Object to notify about progress of transfer.
+         * @param account  ownCloud account holding the file of interest.
+         * @param file     {@link OCFile} of interest for listener.
          */
-        public void removeDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {
+        public void removeDatatransferProgressListener(
+                OnDatatransferProgressListener listener, Account account, OCFile file
+        ) {
             if (account == null || file == null || listener == null) return;
-            String targetKey = buildRemoteName(account, file);
-            if (mBoundListeners.get(targetKey) == listener) {
-                mBoundListeners.remove(targetKey);
+            //String targetKey = buildKey(account, file.getRemotePath());
+            Long fileId = file.getFileId();
+            if (mBoundListeners.get(fileId) == listener) {
+                mBoundListeners.remove(fileId);
             }
         }
 
         @Override
         public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer,
-                String fileName) {
-            String key = buildRemoteName(mCurrentDownload.getAccount(), mCurrentDownload.getFile());
-            OnDatatransferProgressListener boundListener = mBoundListeners.get(key);
+                                       String fileName) {
+            //String key = buildKey(mCurrentDownload.getAccount(), mCurrentDownload.getFile().getRemotePath());
+            OnDatatransferProgressListener boundListener = mBoundListeners.get(mCurrentDownload.getFile().getFileId());
             if (boundListener != null) {
                 boundListener.onTransferProgress(progressRate, totalTransferredSoFar, totalToTransfer, fileName);
             }
         }
-        
+
+        /**
+         * Review downloads and cancel it if its account doesn't exist
+         */
+        public void checkAccountOfCurrentDownload() {
+            if (mCurrentDownload != null &&
+                    !AccountUtils.exists(mCurrentDownload.getAccount(), getApplicationContext())) {
+                mCurrentDownload.cancel();
+            }
+            // The rest of downloads are cancelled when they try to start
+        }
+
     }
-    
-    
-    /** 
-     * Download worker. Performs the pending downloads in the order they were requested. 
-     * 
-     * Created with the Looper of a new thread, started in {@link FileUploader#onCreate()}. 
+
+
+    /**
+     * Download worker. Performs the pending downloads in the order they were requested.
+     * <p/>
+     * Created with the Looper of a new thread, started in {@link FileUploader#onCreate()}.
      */
     private static class ServiceHandler extends Handler {
         // don't make it a final class, and don't remove the static ; lint will warn about a possible memory leak
         FileDownloader mService;
+
         public ServiceHandler(Looper looper, FileDownloader service) {
             super(looper);
             if (service == null)
@@ -320,65 +414,83 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
             if (msg.obj != null) {
                 Iterator<String> it = requestedDownloads.iterator();
                 while (it.hasNext()) {
-                    mService.downloadFile(it.next());
+                    String next = it.next();
+                    mService.downloadFile(next);
                 }
             }
+            Log_OC.d(TAG, "Stopping after command with id " + msg.arg1);
             mService.stopSelf(msg.arg1);
         }
     }
-    
+
 
     /**
      * Core download method: requests a file to download and stores it.
-     * 
-     * @param downloadKey   Key to access the download to perform, contained in mPendingDownloads 
+     *
+     * @param downloadKey Key to access the download to perform, contained in mPendingDownloads
      */
     private void downloadFile(String downloadKey) {
-        
-        synchronized(mPendingDownloads) {
-            mCurrentDownload = mPendingDownloads.get(downloadKey);
-        }
-        
+
+        /*Log_OC.v(   "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                "Getting download of " + downloadKey);*/
+        mCurrentDownload = mPendingDownloads.get(downloadKey);
+
         if (mCurrentDownload != null) {
-            
-            notifyDownloadStart(mCurrentDownload);
+            // Detect if the account exists
+            if (AccountUtils.exists(mCurrentDownload.getAccount(), getApplicationContext())) {
+                Log_OC.d(TAG, "Account " + mCurrentDownload.getAccount().name + " exists");
+                notifyDownloadStart(mCurrentDownload);
 
-            RemoteOperationResult downloadResult = null;
-            try {
-                /// prepare client object to send the request to the ownCloud server
-                if (mDownloadClient == null || !mLastAccount.equals(mCurrentDownload.getAccount())) {
-                    mLastAccount = mCurrentDownload.getAccount();
-                    mStorageManager = 
-                            new FileDataStorageManager(mLastAccount, getContentResolver());
-                    OwnCloudAccount ocAccount = new OwnCloudAccount(mLastAccount, this);
+                RemoteOperationResult downloadResult = null;
+                try {
+                    /// prepare client object to send the request to the ownCloud server
+                    if (mCurrentAccount == null || !mCurrentAccount.equals(mCurrentDownload.getAccount())) {
+                        mCurrentAccount = mCurrentDownload.getAccount();
+                        mStorageManager = new FileDataStorageManager(
+                                mCurrentAccount,
+                                getContentResolver()
+                        );
+                    }   // else, reuse storage manager from previous operation
+
+                    // always get client from client manager, to get fresh credentials in case of update
+                    OwnCloudAccount ocAccount = new OwnCloudAccount(mCurrentAccount, this);
                     mDownloadClient = OwnCloudClientManagerFactory.getDefaultSingleton().
                             getClientFor(ocAccount, this);
-                }
 
-                /// perform the download
-                downloadResult = mCurrentDownload.execute(mDownloadClient);
-                if (downloadResult.isSuccess()) {
-                    saveDownloadedFile();
-                }
-            
-            } catch (AccountsException e) {
-                Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
-                downloadResult = new RemoteOperationResult(e);
-            } catch (IOException e) {
-                Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
-                downloadResult = new RemoteOperationResult(e);
-                
-            } finally {
-                synchronized(mPendingDownloads) {
-                    mPendingDownloads.remove(downloadKey);
+
+                    /// perform the download
+                    /*Log_OC.v(   "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                        "Executing download of " + mCurrentDownload.getRemotePath());*/
+                    downloadResult = mCurrentDownload.execute(mDownloadClient);
+                    if (downloadResult.isSuccess()) {
+                        saveDownloadedFile();
+                    }
+
+                } catch (AccountsException e) {
+                    Log_OC.e(TAG, "Error while trying to get authorization for " + mCurrentAccount.name, e);
+                    downloadResult = new RemoteOperationResult(e);
+                } catch (IOException e) {
+                    Log_OC.e(TAG, "Error while trying to get authorization for " + mCurrentAccount.name, e);
+                    downloadResult = new RemoteOperationResult(e);
+
+                } finally {
+                /*Log_OC.v(   "NOW " + TAG + ", thread " + Thread.currentThread().getName(),
+                        "Removing payload " + mCurrentDownload.getRemotePath());*/
+
+                    Pair<DownloadFileOperation, String> removeResult =
+                            mPendingDownloads.removePayload(mCurrentAccount, mCurrentDownload.getRemotePath());
+
+                    /// notify result
+                    notifyDownloadResult(mCurrentDownload, downloadResult);
+
+                    sendBroadcastDownloadFinished(mCurrentDownload, downloadResult, removeResult.second);
                 }
-            }
+            } else {
+                // Cancel the transfer
+                Log_OC.d(TAG, "Account " + mCurrentDownload.getAccount().toString() + " doesn't exist");
+                cancelDownloadsForAccount(mCurrentDownload.getAccount());
 
-            
-            /// notify result
-            notifyDownloadResult(mCurrentDownload, downloadResult);
-            
-            sendBroadcastDownloadFinished(mCurrentDownload, downloadResult);
+            }
         }
     }
 
@@ -403,16 +515,25 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         mStorageManager.triggerMediaScan(file.getStoragePath());
     }
 
+    /**
+     * Update the OC File after a unsuccessful download
+     */
+    private void updateUnsuccessfulDownloadedFile() {
+        OCFile file = mStorageManager.getFileById(mCurrentDownload.getFile().getFileId());
+        file.setDownloading(false);
+        mStorageManager.saveFile(file);
+    }
+
 
     /**
      * Creates a status notification to show the download progress
-     * 
-     * @param download  Download operation starting.
+     *
+     * @param download Download operation starting.
      */
     private void notifyDownloadStart(DownloadFileOperation download) {
         /// create status notification with a progress bar
         mLastPercent = 0;
-        mNotificationBuilder = 
+        mNotificationBuilder =
                 NotificationBuilderWithProgressBar.newNotificationBuilderWithProgressBar(this);
         mNotificationBuilder
                 .setSmallIcon(R.drawable.notification_icon)
@@ -424,7 +545,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
                         String.format(getString(R.string.downloader_download_in_progress_content), 0,
                                 new File(download.getSavePath()).getName())
                 );
-                
+
         /// includes a pending intent in the notification showing the details view of the file
         Intent showDetailsIntent = null;
         if (PreviewImageFragment.canBePreviewed(download.getFile())) {
@@ -435,21 +556,21 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, download.getFile());
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-        
+
         mNotificationBuilder.setContentIntent(PendingIntent.getActivity(
-            this, (int) System.currentTimeMillis(), showDetailsIntent, 0
+                this, (int) System.currentTimeMillis(), showDetailsIntent, 0
         ));
 
         mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotificationBuilder.build());
     }
 
-    
+
     /**
      * Callback method to update the progress bar in the status notification.
      */
     @Override
     public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String filePath) {
-        int percent = (int)(100.0*((double)totalTransferredSoFar)/((double)totalToTransfer));
+        int percent = (int) (100.0 * ((double) totalTransferredSoFar) / ((double) totalToTransfer));
         if (percent != mLastPercent) {
             mNotificationBuilder.setProgress(100, percent, totalToTransfer < 0);
             String fileName = filePath.substring(filePath.lastIndexOf(FileUtils.PATH_SEPARATOR) + 1);
@@ -459,100 +580,120 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         }
         mLastPercent = percent;
     }
-    
-    
+
+
     /**
      * Updates the status notification with the result of a download operation.
-     * 
-     * @param downloadResult    Result of the download operation.
-     * @param download          Finished download operation
+     *
+     * @param downloadResult Result of the download operation.
+     * @param download       Finished download operation
      */
     private void notifyDownloadResult(DownloadFileOperation download, RemoteOperationResult downloadResult) {
         mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker);
         if (!downloadResult.isCancelled()) {
-            int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker : 
-                R.string.downloader_download_failed_ticker;
-            
+            int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker :
+                    R.string.downloader_download_failed_ticker;
+
             boolean needsToUpdateCredentials = (
                     downloadResult.getCode() == ResultCode.UNAUTHORIZED ||
-                    downloadResult.isIdPRedirection()
+                            downloadResult.isIdPRedirection()
             );
-            tickerId = (needsToUpdateCredentials) ? 
+            tickerId = (needsToUpdateCredentials) ?
                     R.string.downloader_download_failed_credentials_error : tickerId;
-            
+
             mNotificationBuilder
-            .setTicker(getString(tickerId))
-            .setContentTitle(getString(tickerId))
-            .setAutoCancel(true)
-            .setOngoing(false)
-            .setProgress(0, 0, false);
-            
+                    .setTicker(getString(tickerId))
+                    .setContentTitle(getString(tickerId))
+                    .setAutoCancel(true)
+                    .setOngoing(false)
+                    .setProgress(0, 0, false);
+
             if (needsToUpdateCredentials) {
-                
+
                 // let the user update credentials with one click
                 Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, download.getAccount());
-                updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);
+                updateAccountCredentials.putExtra(
+                        AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN
+                );
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                 updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
                 mNotificationBuilder
-                    .setContentIntent(PendingIntent.getActivity(
-                        this, (int) System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT));
-                
-                mDownloadClient = null;   // grant that future retries on the same account will get the fresh credentials
-                
+                        .setContentIntent(PendingIntent.getActivity(
+                                this, (int) System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT));
+
             } else {
                 // TODO put something smart in showDetailsIntent
-                Intent   showDetailsIntent = new Intent();
+                Intent showDetailsIntent = new Intent();
                 mNotificationBuilder
-                    .setContentIntent(PendingIntent.getActivity(
-                        this, (int) System.currentTimeMillis(), showDetailsIntent, 0));
+                        .setContentIntent(PendingIntent.getActivity(
+                                this, (int) System.currentTimeMillis(), showDetailsIntent, 0));
             }
-            
-            mNotificationBuilder.setContentText(ErrorMessageAdapter.getErrorCauseMessage(downloadResult, download, getResources()));
+
+            mNotificationBuilder.setContentText(
+                    ErrorMessageAdapter.getErrorCauseMessage(downloadResult, download, getResources())
+            );
             mNotificationManager.notify(tickerId, mNotificationBuilder.build());
-            
+
             // Remove success notification
-            if (downloadResult.isSuccess()) {   
+            if (downloadResult.isSuccess()) {
                 // Sleep 2 seconds, so show the notification before remove it
                 NotificationDelayer.cancelWithDelay(
-                        mNotificationManager, 
-                        R.string.downloader_download_succeeded_ticker, 
+                        mNotificationManager,
+                        R.string.downloader_download_succeeded_ticker,
                         2000);
             }
-                
+
         }
     }
-    
-    
+
+
     /**
      * Sends a broadcast when a download finishes in order to the interested activities can update their view
-     * 
-     * @param download          Finished download operation
-     * @param downloadResult    Result of the download operation
+     *
+     * @param download               Finished download operation
+     * @param downloadResult         Result of the download operation
+     * @param unlinkedFromRemotePath Path in the downloads tree where the download was unlinked from
      */
-    private void sendBroadcastDownloadFinished(DownloadFileOperation download, RemoteOperationResult downloadResult) {
+    private void sendBroadcastDownloadFinished(
+            DownloadFileOperation download,
+            RemoteOperationResult downloadResult,
+            String unlinkedFromRemotePath) {
         Intent end = new Intent(getDownloadFinishMessage());
         end.putExtra(EXTRA_DOWNLOAD_RESULT, downloadResult.isSuccess());
         end.putExtra(ACCOUNT_NAME, download.getAccount().name);
         end.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath());
         end.putExtra(EXTRA_FILE_PATH, download.getSavePath());
+        if (unlinkedFromRemotePath != null) {
+            end.putExtra(EXTRA_LINKED_TO_PATH, unlinkedFromRemotePath);
+        }
         sendStickyBroadcast(end);
     }
-    
-    
+
+
     /**
      * Sends a broadcast when a new download is added to the queue.
-     * 
-     * @param download          Added download operation
+     *
+     * @param download           Added download operation
+     * @param linkedToRemotePath Path in the downloads tree where the download was linked to
      */
-    private void sendBroadcastNewDownload(DownloadFileOperation download) {
+    private void sendBroadcastNewDownload(DownloadFileOperation download, String linkedToRemotePath) {
         Intent added = new Intent(getDownloadAddedMessage());
         added.putExtra(ACCOUNT_NAME, download.getAccount().name);
         added.putExtra(EXTRA_REMOTE_PATH, download.getRemotePath());
         added.putExtra(EXTRA_FILE_PATH, download.getSavePath());
+        added.putExtra(EXTRA_LINKED_TO_PATH, linkedToRemotePath);
         sendStickyBroadcast(added);
     }
 
+    /**
+     * Remove downloads of an account
+     *
+     * @param account       Downloads account to remove
+     */
+    private void cancelDownloadsForAccount(Account account) {
+        // Cancel pending downloads
+        mPendingDownloads.remove(account);
+    }
 }
index 0480440..851e343 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2012-2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,6 +33,7 @@ import java.util.concurrent.ConcurrentMap;
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AccountsException;
+import android.accounts.OnAccountsUpdateListener;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -76,8 +79,8 @@ import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.UriUtils;
 
 
-
-public class FileUploader extends Service implements OnDatatransferProgressListener {
+public class FileUploader extends Service
+        implements OnDatatransferProgressListener, OnAccountsUpdateListener {
 
     private static final String UPLOAD_FINISH_MESSAGE = "UPLOAD_FINISH";
     public static final String EXTRA_UPLOAD_RESULT = "RESULT";
@@ -124,14 +127,14 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     private static final String MIME_TYPE_PDF = "application/pdf";
     private static final String FILE_EXTENSION_PDF = ".pdf";
 
-    
+
     public static String getUploadFinishMessage() {
         return FileUploader.class.getName().toString() + UPLOAD_FINISH_MESSAGE;
     }
-    
+
     /**
      * Builds a key for mPendingUploads from the account and file to upload
-     * 
+     *
      * @param account   Account where the file to upload is stored
      * @param file      File to upload
      */
@@ -145,7 +148,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
     /**
      * Checks if an ownCloud server version should support chunked uploads.
-     * 
+     *
      * @param version OwnCloud version instance corresponding to an ownCloud
      *            server.
      * @return 'True' if the ownCloud server with version supports chunked
@@ -161,24 +164,50 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     @Override
     public void onCreate() {
         super.onCreate();
-        Log_OC.i(TAG, "mPendingUploads size:" + mPendingUploads.size());
+        Log_OC.d(TAG, "Creating service");
         mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
         HandlerThread thread = new HandlerThread("FileUploaderThread", Process.THREAD_PRIORITY_BACKGROUND);
         thread.start();
         mServiceLooper = thread.getLooper();
         mServiceHandler = new ServiceHandler(mServiceLooper, this);
         mBinder = new FileUploaderBinder();
+
+        // add AccountsUpdatedListener
+        AccountManager am = AccountManager.get(getApplicationContext());
+        am.addOnAccountsUpdatedListener(this, null, false);
     }
 
     /**
+     * Service clean up
+     */
+    @Override
+    public void onDestroy() {
+        Log_OC.v(TAG, "Destroying service" );
+        mBinder = null;
+        mServiceHandler = null;
+        mServiceLooper.quit();
+        mServiceLooper = null;
+        mNotificationManager = null;
+
+        // remove AccountsUpdatedListener
+        AccountManager am = AccountManager.get(getApplicationContext());
+        am.removeOnAccountsUpdatedListener(this);
+
+        super.onDestroy();
+    }
+
+
+    /**
      * Entry point to add one or several files to the queue of uploads.
-     * 
+     *
      * New uploads are added calling to startService(), resulting in a call to
      * this method. This ensures the service will keep on working although the
      * caller activity goes away.
      */
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
+        Log_OC.d(TAG, "Starting command with id " + startId);
+
         if (!intent.hasExtra(KEY_ACCOUNT) || !intent.hasExtra(KEY_UPLOAD_TYPE)
                 || !(intent.hasExtra(KEY_LOCAL_FILE) || intent.hasExtra(KEY_FILE))) {
             Log_OC.e(TAG, "Not enough information provided in intent");
@@ -199,7 +228,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         if (uploadType == UPLOAD_SINGLE_FILE) {
 
             if (intent.hasExtra(KEY_FILE)) {
-                files = new OCFile[] { intent.getParcelableExtra(KEY_FILE) };
+                files = new OCFile[] { (OCFile) intent.getParcelableExtra(KEY_FILE) };
 
             } else {
                 localPaths = new String[] { intent.getStringExtra(KEY_LOCAL_FILE) };
@@ -229,7 +258,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false);
         boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false);
         int localAction = intent.getIntExtra(KEY_LOCAL_BEHAVIOUR, LOCAL_BEHAVIOUR_COPY);
-        
+
         if (intent.hasExtra(KEY_FILE) && files == null) {
             Log_OC.e(TAG, "Incorrect array for OCFiles provided in upload intent");
             return Service.START_NOT_STICKY;
@@ -262,7 +291,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         AccountManager aMgr = AccountManager.get(this);
         String version = aMgr.getUserData(account, Constants.KEY_OC_VERSION);
         OwnCloudVersion ocv = new OwnCloudVersion(version);
-        
+
         boolean chunked = FileUploader.chunkedUploadIsSupported(ocv);
         AbstractList<String> requestedUploads = new Vector<String>();
         String uploadKey = null;
@@ -270,7 +299,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         try {
             for (int i = 0; i < files.length; i++) {
                 uploadKey = buildRemoteName(account, files[i].getRemotePath());
-                newUpload = new UploadFileOperation(account, files[i], chunked, isInstant, forceOverwrite, localAction, 
+                newUpload = new UploadFileOperation(account, files[i], chunked, isInstant, forceOverwrite, localAction,
                         getApplicationContext());
                 if (isInstant) {
                     newUpload.setRemoteFolderToBeCreated();
@@ -309,7 +338,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     /**
      * Provides a binder object that clients can use to perform operations on
      * the queue of uploads, excepting the addition of new files.
-     * 
+     *
      * Implemented to perform cancellation, pause and resume of existing
      * uploads.
      */
@@ -317,7 +346,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     public IBinder onBind(Intent arg0) {
         return mBinder;
     }
-    
+
     /**
      * Called when ALL the bound clients were onbound.
      */
@@ -326,24 +355,33 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         ((FileUploaderBinder)mBinder).clearListeners();
         return false;   // not accepting rebinding (default behaviour)
     }
-    
+
+    @Override
+    public void onAccountsUpdated(Account[] accounts) {
+        // Review current upload, and cancel it if its account doen't exist
+        if (mCurrentUpload != null &&
+                !AccountUtils.exists(mCurrentUpload.getAccount(), getApplicationContext())) {
+            mCurrentUpload.cancel();
+        }
+        // The rest of uploads are cancelled when they try to start
+    }
 
     /**
      * Binder to let client components to perform operations on the queue of
      * uploads.
-     * 
+     *
      * It provides by itself the available operations.
      */
     public class FileUploaderBinder extends Binder implements OnDatatransferProgressListener {
-        
-        /** 
+
+        /**
          * Map of listeners that will be reported about progress of uploads from a {@link FileUploaderBinder} instance 
          */
         private Map<String, OnDatatransferProgressListener> mBoundListeners = new HashMap<String, OnDatatransferProgressListener>();
-        
+
         /**
          * Cancels a pending or current upload of a remote file.
-         * 
+         *
          * @param account Owncloud account where the remote file will be stored.
          * @param file A file in the queue of pending uploads
          */
@@ -356,24 +394,37 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                 upload.cancel();
             }
         }
-        
-        
-        
+
+        /**
+         * Cancels a pending or current upload for an account
+         *
+         * @param account Owncloud accountName where the remote file will be stored.
+         */
+        public void cancel(Account account) {
+            Log_OC.d(TAG, "Account= " + account.name);
+
+            if (mCurrentUpload != null) {
+                Log_OC.d(TAG, "Current Upload Account= " + mCurrentUpload.getAccount().name);
+                if (mCurrentUpload.getAccount().name.equals(account.name)) {
+                    mCurrentUpload.cancel();
+                }
+            }
+            // Cancel pending uploads
+            cancelUploadForAccount(account.name);
+        }
+
         public void clearListeners() {
             mBoundListeners.clear();
         }
 
-
-        
-        
         /**
          * Returns True when the file described by 'file' is being uploaded to
          * the ownCloud account 'account' or waiting for it
-         * 
+         *
          * If 'file' is a directory, returns 'true' if some of its descendant files is uploading or waiting to upload. 
-         * 
-         * @param account Owncloud account where the remote file will be stored.
-         * @param file A file that could be in the queue of pending uploads
+         *
+         * @param account   ownCloud account where the remote file will be stored.
+         * @param file      A file that could be in the queue of pending uploads
          */
         public boolean isUploading(Account account, OCFile file) {
             if (account == null || file == null)
@@ -397,25 +448,25 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
         /**
          * Adds a listener interested in the progress of the upload for a concrete file.
-         * 
+         *
          * @param listener      Object to notify about progress of transfer.    
          * @param account       ownCloud account holding the file of interest.
-         * @param file          {@link OCfile} of interest for listener. 
+         * @param file          {@link OCFile} of interest for listener.
          */
         public void addDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {
             if (account == null || file == null || listener == null) return;
             String targetKey = buildRemoteName(account, file);
             mBoundListeners.put(targetKey, listener);
         }
-        
-        
-        
+
+
+
         /**
          * Removes a listener interested in the progress of the upload for a concrete file.
-         * 
+         *
          * @param listener      Object to notify about progress of transfer.    
          * @param account       ownCloud account holding the file of interest.
-         * @param file          {@link OCfile} of interest for listener. 
+         * @param file          {@link OCFile} of interest for listener.
          */
         public void removeDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {
             if (account == null || file == null || listener == null) return;
@@ -428,20 +479,30 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
         @Override
         public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer,
-                String fileName) {
+                                       String fileName) {
             String key = buildRemoteName(mCurrentUpload.getAccount(), mCurrentUpload.getFile());
             OnDatatransferProgressListener boundListener = mBoundListeners.get(key);
             if (boundListener != null) {
                 boundListener.onTransferProgress(progressRate, totalTransferredSoFar, totalToTransfer, fileName);
             }
         }
-        
+
+        /**
+         * Review uploads and cancel it if its account doesn't exist
+         */
+        public void checkAccountOfCurrentUpload() {
+            if (mCurrentUpload != null &&
+                    !AccountUtils.exists(mCurrentUpload.getAccount(), getApplicationContext())) {
+                mCurrentUpload.cancel();
+            }
+            // The rest of uploads are cancelled when they try to start
+        }
     }
 
     /**
      * Upload worker. Performs the pending uploads in the order they were
      * requested.
-     * 
+     *
      * Created with the Looper of a new thread, started in
      * {@link FileUploader#onCreate()}.
      */
@@ -467,13 +528,14 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                     mService.uploadFile(it.next());
                 }
             }
+            Log_OC.d(TAG, "Stopping command after id " + msg.arg1);
             mService.stopSelf(msg.arg1);
         }
     }
 
     /**
      * Core upload method: sends the file(s) to upload
-     * 
+     *
      * @param uploadKey Key to access the upload to perform, contained in
      *            mPendingUploads
      */
@@ -485,63 +547,73 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
         if (mCurrentUpload != null) {
 
-            notifyUploadStart(mCurrentUpload);
+            // Detect if the account exists
+            if (AccountUtils.exists(mCurrentUpload.getAccount(), getApplicationContext())) {
+                Log_OC.d(TAG, "Account " + mCurrentUpload.getAccount().name + " exists");
 
-            RemoteOperationResult uploadResult = null, grantResult = null;
-            
-            try {
-                /// prepare client object to send requests to the ownCloud server
-                if (mUploadClient == null || !mLastAccount.equals(mCurrentUpload.getAccount())) {
-                    mLastAccount = mCurrentUpload.getAccount();
-                    mStorageManager = 
-                            new FileDataStorageManager(mLastAccount, getContentResolver());
-                    OwnCloudAccount ocAccount = new OwnCloudAccount(mLastAccount, this);
-                    mUploadClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                            getClientFor(ocAccount, this);
-                }
-                
-                /// check the existence of the parent folder for the file to upload
-                String remoteParentPath = new File(mCurrentUpload.getRemotePath()).getParent();
-                remoteParentPath = remoteParentPath.endsWith(OCFile.PATH_SEPARATOR) ? remoteParentPath : remoteParentPath + OCFile.PATH_SEPARATOR;
-                grantResult = grantFolderExistence(remoteParentPath);
-            
-                /// perform the upload
-                if (grantResult.isSuccess()) {
-                    OCFile parent = mStorageManager.getFileByPath(remoteParentPath);
-                    mCurrentUpload.getFile().setParentId(parent.getFileId());
-                    uploadResult = mCurrentUpload.execute(mUploadClient);
-                    if (uploadResult.isSuccess()) {
-                        saveUploadedFile();
+                notifyUploadStart(mCurrentUpload);
+
+                RemoteOperationResult uploadResult = null, grantResult = null;
+
+                try {
+                    /// prepare client object to send requests to the ownCloud server
+                    if (mUploadClient == null || !mLastAccount.equals(mCurrentUpload.getAccount())) {
+                        mLastAccount = mCurrentUpload.getAccount();
+                        mStorageManager =
+                                new FileDataStorageManager(mLastAccount, getContentResolver());
+                        OwnCloudAccount ocAccount = new OwnCloudAccount(mLastAccount, this);
+                        mUploadClient = OwnCloudClientManagerFactory.getDefaultSingleton().
+                                getClientFor(ocAccount, this);
+                    }
+
+                    /// check the existence of the parent folder for the file to upload
+                    String remoteParentPath = new File(mCurrentUpload.getRemotePath()).getParent();
+                    remoteParentPath = remoteParentPath.endsWith(OCFile.PATH_SEPARATOR) ?
+                            remoteParentPath : remoteParentPath + OCFile.PATH_SEPARATOR;
+                    grantResult = grantFolderExistence(remoteParentPath);
+
+                    /// perform the upload
+                    if (grantResult.isSuccess()) {
+                        OCFile parent = mStorageManager.getFileByPath(remoteParentPath);
+                        mCurrentUpload.getFile().setParentId(parent.getFileId());
+                        uploadResult = mCurrentUpload.execute(mUploadClient);
+                        if (uploadResult.isSuccess()) {
+                            saveUploadedFile();
+                        }
+                    } else {
+                        uploadResult = grantResult;
+                    }
+
+                } catch (AccountsException e) {
+                    Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
+                    uploadResult = new RemoteOperationResult(e);
+
+                } catch (IOException e) {
+                    Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
+                    uploadResult = new RemoteOperationResult(e);
+
+                } finally {
+                    synchronized (mPendingUploads) {
+                        mPendingUploads.remove(uploadKey);
+                        Log_OC.i(TAG, "Remove CurrentUploadItem from pending upload Item Map.");
+                    }
+                    if (uploadResult.isException()) {
+                        // enforce the creation of a new client object for next uploads; this grant that a new socket will
+                        // be created in the future if the current exception is due to an abrupt lose of network connection
+                        mUploadClient = null;
                     }
-                } else {
-                    uploadResult = grantResult;
-                }
-                
-            } catch (AccountsException e) {
-                Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
-                uploadResult = new RemoteOperationResult(e);
-                
-            } catch (IOException e) {
-                Log_OC.e(TAG, "Error while trying to get autorization for " + mLastAccount.name, e);
-                uploadResult = new RemoteOperationResult(e);
-                
-            } finally {
-                synchronized (mPendingUploads) {
-                    mPendingUploads.remove(uploadKey);
-                    Log_OC.i(TAG, "Remove CurrentUploadItem from pending upload Item Map.");
-                }
-                if (uploadResult.isException()) {
-                    // enforce the creation of a new client object for next uploads; this grant that a new socket will 
-                    // be created in the future if the current exception is due to an abrupt lose of network connection
-                    mUploadClient = null;
                 }
-            }
-            
-            /// notify result
-            
-            notifyUploadResult(uploadResult, mCurrentUpload);
-            sendFinalBroadcast(mCurrentUpload, uploadResult);
 
+                /// notify result
+                notifyUploadResult(uploadResult, mCurrentUpload);
+                sendFinalBroadcast(mCurrentUpload, uploadResult);
+
+            } else {
+                // Cancel the transfer
+                Log_OC.d(TAG, "Account " + mCurrentUpload.getAccount().toString() + " doesn't exist");
+                cancelUploadForAccount(mCurrentUpload.getAccount().name);
+
+            }
         }
 
     }
@@ -549,17 +621,18 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     /**
      * Checks the existence of the folder where the current file will be uploaded both in the remote server 
      * and in the local database.
-     * 
+     *
      * If the upload is set to enforce the creation of the folder, the method tries to create it both remote
      * and locally.
-     *  
+     *
      *  @param  pathToGrant     Full remote path whose existence will be granted.
      *  @return  An {@link OCFile} instance corresponding to the folder where the file will be uploaded.
      */
     private RemoteOperationResult grantFolderExistence(String pathToGrant) {
         RemoteOperation operation = new ExistenceCheckRemoteOperation(pathToGrant, this, false);
         RemoteOperationResult result = operation.execute(mUploadClient);
-        if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND && mCurrentUpload.isRemoteFolderToBeCreated()) {
+        if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND &&
+                mCurrentUpload.isRemoteFolderToBeCreated()) {
             SyncOperation syncOp = new CreateFolderOperation( pathToGrant, true);
             result = syncOp.execute(mUploadClient, mStorageManager);
         }
@@ -577,10 +650,11 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         return result;
     }
 
-    
+
     private OCFile createLocalFolder(String remotePath) {
         String parentPath = new File(remotePath).getParent();
-        parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath : parentPath + OCFile.PATH_SEPARATOR;
+        parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ?
+                parentPath : parentPath + OCFile.PATH_SEPARATOR;
         OCFile parent = mStorageManager.getFileByPath(parentPath);
         if (parent == null) {
             parent = createLocalFolder(parentPath);
@@ -594,15 +668,15 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         }
         return null;
     }
-    
+
 
     /**
      * Saves a OC File after a successful upload.
-     * 
+     *
      * A PROPFIND is necessary to keep the props in the local database
      * synchronized with the server, specially the modification time and Etag
      * (where available)
-     * 
+     *
      * TODO refactor this ugly thing
      */
     private void saveUploadedFile() {
@@ -621,7 +695,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
             updateOCFile(file, (RemoteFile) result.getData().get(0));
             file.setLastSyncDateForProperties(syncDate);
         }
-        
+
         // / maybe this would be better as part of UploadFileOperation... or
         // maybe all this method
         if (mCurrentUpload.wasRenamed()) {
@@ -631,8 +705,8 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                 mStorageManager.saveFile(oldFile);
 
             } // else: it was just an automatic renaming due to a name
-              // coincidence; nothing else is needed, the storagePath is right
-              // in the instance returned by mCurrentUpload.getFile()
+            // coincidence; nothing else is needed, the storagePath is right
+            // in the instance returned by mCurrentUpload.getFile()
         }
         file.setNeedsUpdateThumbnail(true);
         mStorageManager.saveFile(file);
@@ -649,7 +723,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     }
 
     private OCFile obtainNewOCFileToUpload(String remotePath, String localPath, String mimeType,
-            FileDataStorageManager storageManager) {
+                                           FileDataStorageManager storageManager) {
 
         // MIME type
         if (mimeType == null || mimeType.length() <= 0) {
@@ -679,7 +753,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
             newFile.setFileLength(localFile.length());
             newFile.setLastSyncDateForData(localFile.lastModified());
         } // don't worry about not assigning size, the problems with localPath
-          // are checked when the UploadFileOperation instance is created
+        // are checked when the UploadFileOperation instance is created
 
 
         newFile.setMimetype(mimeType);
@@ -689,13 +763,13 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
     /**
      * Creates a status notification to show the upload progress
-     * 
+     *
      * @param upload Upload operation starting.
      */
     private void notifyUploadStart(UploadFileOperation upload) {
         // / create status notification with a progress bar
         mLastPercent = 0;
-        mNotificationBuilder = 
+        mNotificationBuilder =
                 NotificationBuilderWithProgressBar.newNotificationBuilderWithProgressBar(this);
         mNotificationBuilder
                 .setOngoing(true)
@@ -712,7 +786,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         mNotificationBuilder.setContentIntent(PendingIntent.getActivity(
-            this, (int) System.currentTimeMillis(), showDetailsIntent, 0
+                this, (int) System.currentTimeMillis(), showDetailsIntent, 0
         ));
 
         mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());
@@ -736,7 +810,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
     /**
      * Updates the status notification with the result of an upload operation.
-     * 
+     *
      * @param uploadResult Result of the upload operation.
      * @param upload Finished upload operation
      */
@@ -745,33 +819,33 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         Log_OC.d(TAG, "NotifyUploadResult with resultCode: " + uploadResult.getCode());
         // / cancelled operation or success -> silent removal of progress notification
         mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker);
-        
+
         // Show the result: success or fail notification
         if (!uploadResult.isCancelled()) {
-            int tickerId = (uploadResult.isSuccess()) ? R.string.uploader_upload_succeeded_ticker : 
-                R.string.uploader_upload_failed_ticker;
-            
+            int tickerId = (uploadResult.isSuccess()) ? R.string.uploader_upload_succeeded_ticker :
+                    R.string.uploader_upload_failed_ticker;
+
             String content = null;
 
             // check credentials error
             boolean needsToUpdateCredentials = (
-                    uploadResult.getCode() == ResultCode.UNAUTHORIZED || 
-                    uploadResult.isIdPRedirection()
+                    uploadResult.getCode() == ResultCode.UNAUTHORIZED ||
+                            uploadResult.isIdPRedirection()
             );
-            tickerId = (needsToUpdateCredentials) ? 
+            tickerId = (needsToUpdateCredentials) ?
                     R.string.uploader_upload_failed_credentials_error : tickerId;
 
             mNotificationBuilder
-            .setTicker(getString(tickerId))
-            .setContentTitle(getString(tickerId))
-            .setAutoCancel(true)
-            .setOngoing(false)
-            .setProgress(0, 0, false);
-            
+                    .setTicker(getString(tickerId))
+                    .setContentTitle(getString(tickerId))
+                    .setAutoCancel(true)
+                    .setOngoing(false)
+                    .setProgress(0, 0, false);
+
             content =  ErrorMessageAdapter.getErrorCauseMessage(
                     uploadResult, upload, getResources()
             );
-            
+
             if (needsToUpdateCredentials) {
                 // let the user update credentials with one click
                 Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
@@ -779,24 +853,24 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                         AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount()
                 );
                 updateAccountCredentials.putExtra(
-                        AuthenticatorActivity.EXTRA_ACTION, 
+                        AuthenticatorActivity.EXTRA_ACTION,
                         AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN
                 );
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                 updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
                 mNotificationBuilder.setContentIntent(PendingIntent.getActivity(
-                    this, 
-                    (int) System.currentTimeMillis(), 
-                    updateAccountCredentials, 
-                    PendingIntent.FLAG_ONE_SHOT
+                        this,
+                        (int) System.currentTimeMillis(),
+                        updateAccountCredentials,
+                        PendingIntent.FLAG_ONE_SHOT
                 ));
-                
-                mUploadClient = null;   
-                    // grant that future retries on the same account will get the fresh credentials
+
+                mUploadClient = null;
+                // grant that future retries on the same account will get the fresh credentials
             } else {
                 mNotificationBuilder.setContentText(content);
-    
+
                 if (upload.isInstant()) {
                     DbHandler db = null;
                     try {
@@ -807,12 +881,12 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                         if (uploadResult.getCode() == ResultCode.QUOTA_EXCEEDED) {
                             //message = getString(R.string.failed_upload_quota_exceeded_text);
                             if (db.updateFileState(
-                                    upload.getOriginalStoragePath(), 
+                                    upload.getOriginalStoragePath(),
                                     DbHandler.UPLOAD_STATUS_UPLOAD_FAILED,
                                     message) == 0) {
                                 db.putFileForLater(
-                                        upload.getOriginalStoragePath(), 
-                                        upload.getAccount().name, 
+                                        upload.getOriginalStoragePath(),
+                                        upload.getAccount().name,
                                         message
                                 );
                             }
@@ -824,22 +898,22 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                     }
                 }
             }
-            
+
             mNotificationBuilder.setContentText(content);
             mNotificationManager.notify(tickerId, mNotificationBuilder.build());
-            
+
             if (uploadResult.isSuccess()) {
-                
+
                 DbHandler db = new DbHandler(this.getBaseContext());
                 db.removeIUPendingFile(mCurrentUpload.getOriginalStoragePath());
                 db.close();
 
                 // remove success notification, with a delay of 2 seconds
                 NotificationDelayer.cancelWithDelay(
-                        mNotificationManager, 
-                        R.string.uploader_upload_succeeded_ticker, 
+                        mNotificationManager,
+                        R.string.uploader_upload_succeeded_ticker,
                         2000);
-                
+
             }
         }
     }
@@ -847,17 +921,17 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     /**
      * Sends a broadcast in order to the interested activities can update their
      * view
-     * 
+     *
      * @param upload Finished upload operation
      * @param uploadResult Result of the upload operation
      */
     private void sendFinalBroadcast(UploadFileOperation upload, RemoteOperationResult uploadResult) {
         Intent end = new Intent(getUploadFinishMessage());
         end.putExtra(EXTRA_REMOTE_PATH, upload.getRemotePath()); // real remote
-                                                                 // path, after
-                                                                 // possible
-                                                                 // automatic
-                                                                 // renaming
+        // path, after
+        // possible
+        // automatic
+        // renaming
         if (upload.wasRenamed()) {
             end.putExtra(EXTRA_OLD_REMOTE_PATH, upload.getOldFile().getRemotePath());
         }
@@ -875,9 +949,27 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
      * @return true if is needed to add the pdf file extension to the file
      */
     private boolean isPdfFileFromContentProviderWithoutExtension(String localPath, String mimeType) {
-        return localPath.startsWith(UriUtils.URI_CONTENT_SCHEME) && 
-                mimeType.equals(MIME_TYPE_PDF) && 
+        return localPath.startsWith(UriUtils.URI_CONTENT_SCHEME) &&
+                mimeType.equals(MIME_TYPE_PDF) &&
                 !localPath.endsWith(FILE_EXTENSION_PDF);
     }
 
+    /**
+     * Remove uploads of an account
+     * @param accountName
+     */
+    private void cancelUploadForAccount(String accountName){
+        // this can be slow if there are many uploads :(
+        Iterator<String> it = mPendingUploads.keySet().iterator();
+        Log_OC.d(TAG, "Number of pending updloads= "  + mPendingUploads.size());
+        while (it.hasNext()) {
+            String key = it.next();
+            Log_OC.d(TAG, "mPendingUploads CANCELLED " + key);
+            if (key.startsWith(accountName)) {
+                synchronized (mPendingUploads) {
+                    mPendingUploads.remove(key);
+                }
+            }
+        }
+    }
 }
diff --git a/src/com/owncloud/android/files/services/IndexedForest.java b/src/com/owncloud/android/files/services/IndexedForest.java
new file mode 100644 (file)
index 0000000..4c1ac7b
--- /dev/null
@@ -0,0 +1,240 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.files.services;
+
+import android.accounts.Account;
+import android.util.Pair;
+
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.common.utils.Log_OC;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *  Helper structure to keep the trees of folders containing any file downloading or synchronizing.
+ *
+ *  A map provides the indexation based in hashing.
+ *
+ *  A tree is created per account.
+ */
+public class IndexedForest<V> {
+
+    private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<String, Node<V>>();
+
+    private class Node<V> {
+        String mKey = null;
+        Node<V> mParent = null;
+        Set<Node<V>> mChildren = new HashSet<Node<V>>();    // TODO be careful with hash()
+        V mPayload = null;
+
+        // payload is optional
+        public Node(String key, V payload) {
+            if (key == null) {
+                throw new IllegalArgumentException("Argument key MUST NOT be null");
+            }
+            mKey = key;
+            mPayload = payload;
+        }
+
+        public Node<V> getParent() {
+            return mParent;
+        };
+
+        public Set<Node<V>> getChildren() {
+            return mChildren;
+        }
+
+        public String getKey() {
+            return mKey;
+        }
+
+        public V getPayload() {
+            return mPayload;
+        }
+
+        public void addChild(Node<V> child) {
+            mChildren.add(child);
+            child.setParent(this);
+        }
+
+        private void setParent(Node<V> parent) {
+            mParent = parent;
+        }
+
+        public boolean hasChildren() {
+            return mChildren.size() > 0;
+        }
+
+        public void removeChild(Node<V> removed) {
+            mChildren.remove(removed);
+        }
+
+        public void clearPayload() {
+            mPayload = null;
+        }
+    }
+
+
+    public /* synchronized */ Pair<String, String> putIfAbsent(Account account, String remotePath, V value) {
+        String targetKey = buildKey(account, remotePath);
+        Node<V> valuedNode = new Node(targetKey, value);
+        mMap.putIfAbsent(
+                targetKey,
+                valuedNode
+        );
+
+        String currentPath = remotePath, parentPath = null, parentKey = null;
+        Node<V> currentNode = valuedNode, parentNode = null;
+        boolean linked = false;
+        while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) {
+            parentPath = new File(currentPath).getParent();
+            if (!parentPath.endsWith(OCFile.PATH_SEPARATOR)) {
+                parentPath += OCFile.PATH_SEPARATOR;
+            }
+            parentKey = buildKey(account, parentPath);
+            parentNode = mMap.get(parentKey);
+            if (parentNode == null) {
+                parentNode = new Node(parentKey, null);
+                parentNode.addChild(currentNode);
+                mMap.put(parentKey, parentNode);
+            } else {
+                parentNode.addChild(currentNode);
+                linked = true;
+            }
+            currentPath = parentPath;
+            currentNode = parentNode;
+        }
+
+        String linkedTo = OCFile.ROOT_PATH;
+        if (linked) {
+            linkedTo = parentNode.getKey().substring(account.name.length());
+        }
+        return new Pair<String, String>(targetKey, linkedTo);
+    };
+
+
+    public Pair<V, String> removePayload(Account account, String remotePath) {
+        String targetKey = buildKey(account, remotePath);
+        Node<V> target = mMap.get(targetKey);
+        if (target != null) {
+            target.clearPayload();
+            if (!target.hasChildren()) {
+                return remove(account, remotePath);
+            }
+        }
+        return new Pair<V, String>(null, null);
+    }
+
+
+    public /* synchronized */ Pair<V, String> remove(Account account, String remotePath) {
+        String targetKey = buildKey(account, remotePath);
+        Node<V> firstRemoved = mMap.remove(targetKey);
+        String unlinkedFrom = null;
+
+        if (firstRemoved != null) {
+            /// remove children
+            removeDescendants(firstRemoved);
+
+            /// remove ancestors if only here due to firstRemoved
+            Node<V> removed = firstRemoved;
+            Node<V> parent = removed.getParent();
+            boolean unlinked = false;
+            while (parent != null) {
+                parent.removeChild(removed);
+                if (!parent.hasChildren()) {
+                    removed = mMap.remove(parent.getKey());
+                    parent = removed.getParent();
+                } else {
+                    break;
+                }
+            }
+
+            if (parent != null) {
+                unlinkedFrom = parent.getKey().substring(account.name.length());
+            }
+
+            return new Pair<V, String>(firstRemoved.getPayload(), unlinkedFrom);
+        }
+
+        return new Pair<V, String>(null, null);
+    }
+
+    private void removeDescendants(Node<V> removed) {
+        Iterator<Node<V>> childrenIt = removed.getChildren().iterator();
+        Node<V> child = null;
+        while (childrenIt.hasNext()) {
+            child = childrenIt.next();
+            mMap.remove(child.getKey());
+            removeDescendants(child);
+        }
+    }
+
+    public boolean contains(Account account, String remotePath) {
+        String targetKey = buildKey(account, remotePath);
+        return mMap.containsKey(targetKey);
+    }
+
+    public /* synchronized */ V get(String key) {
+        Node<V> node = mMap.get(key);
+        if (node != null) {
+            return node.getPayload();
+        } else {
+            return null;
+        }
+    }
+
+    public V get(Account account, String remotePath) {
+        String key = buildKey(account, remotePath);
+        return get(key);
+    }
+
+
+    /**
+     * Remove the elements that contains account as a part of its key
+     * @param account
+     */
+    public void remove(Account account){
+        Iterator<String> it = mMap.keySet().iterator();
+        while (it.hasNext()) {
+            String key = it.next();
+            Log_OC.d("IndexedForest", "Number of pending downloads= "  + mMap.size());
+            if (key.startsWith(account.name)) {
+                mMap.remove(key);
+            }
+        }
+    }
+
+    /**
+     * Builds a key to index files
+     *
+     * @param account       Account where the file to download is stored
+     * @param remotePath    Path of the file in the server
+     */
+    private String buildKey(Account account, String remotePath) {
+        return account.name + remotePath;
+    }
+
+}
index b6ee1ac..f2ed3bb 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index b257bd3..653943b 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
- * 
- *   Copyright (C) 2012-2013  ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -51,8 +53,6 @@ import com.owncloud.android.R;
  * 
  * It synchronizes itself with the state of the 
  * {@link MediaPlayer}.
- * 
- * @author David A. Velasco
  */
 
 public class MediaControlView extends FrameLayout /* implements OnLayoutChangeListener, OnTouchListener */ implements OnClickListener, OnSeekBarChangeListener {
index 52daa04..e53c635 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -49,8 +52,6 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
  * 
  * Waits for Intents which signal the service to perform specific operations: Play, Pause,
  * Rewind, etc.
- * 
- * @author David A. Velasco
  */
 public class MediaService extends Service implements OnCompletionListener, OnPreparedListener,
                 OnErrorListener, AudioManager.OnAudioFocusChangeListener {
index 1b56ec0..95bf520 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -34,8 +37,6 @@ import android.widget.MediaController;
  * 
  *  Provides the operations of {@link MediaController.MediaPlayerControl}, and an extra method to check if
  *  an {@link OCFile} instance is handled by the MediaService.
- *  
- *  @author David A. Velasco
  */
 public class MediaServiceBinder extends Binder implements MediaController.MediaPlayerControl {
 
index 63ddf63..c71b35f 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,8 +34,6 @@ import android.widget.RemoteViews;
  * a progress bar is available in every Android version, because 
  * {@link NotificationCompat.Builder#setProgress(int, int, boolean)} has no
  * real effect for Android < 4.0
- * 
- * @author David A. Velasco
  */
 public class NotificationBuilderWithProgressBar extends NotificationCompat.Builder {
 
index aeefe12..ab1399f 100644 (file)
@@ -1,3 +1,22 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 package com.owncloud.android.notifications;
 
 import java.util.Random;
index 4df8b3d..b3c17f1 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,9 +35,6 @@ import com.owncloud.android.utils.FileStorageUtils;
 /**
  * Access to remote operation performing the creation of a new folder in the ownCloud server.
  * Save the new folder in Database
- * 
- * @author David A. Velasco 
- * @author masensio
  */
 public class CreateFolderOperation extends SyncOperation implements OnRemoteOperationListener{
     
index b563790..01059c9 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -19,13 +22,12 @@ package com.owncloud.android.operations;
 
 /**
  * Creates a new share from a given file
- * 
- * @author masensio
- *
  */
 
+import android.content.Context;
 import android.content.Intent;
 
+import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
@@ -46,6 +48,7 @@ public class CreateShareOperation extends SyncOperation {
 
     protected FileDataStorageManager mStorageManager;
 
+    private Context mContext;
     private String mPath;
     private ShareType mShareType;
     private String mShareWith;
@@ -56,6 +59,7 @@ public class CreateShareOperation extends SyncOperation {
 
     /**
      * Constructor
+     * @param context       The context that the share is coming from.
      * @param path          Full path of the file/folder being shared. Mandatory argument
      * @param shareType     0 = user, 1 = group, 3 = Public link. Mandatory argument
      * @param shareWith     User/group ID with who the file should be shared.  This is mandatory for shareType of 0 or 1
@@ -72,9 +76,10 @@ public class CreateShareOperation extends SyncOperation {
      *                      To obtain combinations, add the desired values together.  
      *                      For instance, for Re-Share, delete, read, update, add 16+8+2+1 = 27.
      */
-    public CreateShareOperation(String path, ShareType shareType, String shareWith, boolean publicUpload, 
+    public CreateShareOperation(Context context, String path, ShareType shareType, String shareWith, boolean publicUpload,
             String password, int permissions, Intent sendIntent) {
 
+        mContext = context;
         mPath = path;
         mShareType = shareType;
         mShareWith = shareWith;
@@ -128,6 +133,8 @@ public class CreateShareOperation extends SyncOperation {
         OCFile file = getStorageManager().getFileByPath(mPath);
         if (file!=null) {
             mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
+            mSendIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(mContext.getString(R.string.subject_token),
+                    getClient().getCredentials().getUsername(), file.getFileName()));
             file.setPublicLink(share.getShareLink());
             file.setShareByLink(true);
             getStorageManager().saveFile(file);
index 5afc421..9f2827f 100644 (file)
@@ -1,24 +1,20 @@
-/* ownCloud Android Library is available under MIT license
- *   Copyright (C) 2014 ownCloud Inc.
- *   
- *   Permission is hereby granted, free of charge, to any person obtaining a copy
- *   of this software and associated documentation files (the "Software"), to deal
- *   in the Software without restriction, including without limitation the rights
- *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- *   copies of the Software, and to permit persons to whom the Software is
- *   furnished to do so, subject to the following conditions:
- *   
- *   The above copyright notice and this permission notice shall be included in
- *   all copies or substantial portions of the Software.
- *   
- *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
- *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
- *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
- *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
- *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
- *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- *   THE SOFTWARE.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -47,9 +43,7 @@ import android.net.Uri;
  * When successful, the instance of {@link RemoteOperationResult} passed
  * through {@link OnRemoteOperationListener#onRemoteOperationFinish(RemoteOperation, 
  * RemoteOperationResult)} returns in {@link RemoteOperationResult#getData()}
- * a value of {@link AuthenticationMethod}. 
- * 
- * @author David A. Velasco
+ * a value of {@link AuthenticationMethod}.
  */
 public class DetectAuthenticationMethodOperation extends RemoteOperation {
     
index 0a5ff94..78811f8 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -38,9 +42,6 @@ import android.webkit.MimeTypeMap;
 
 /**
  * Remote mDownloadOperation performing the download of a file to an ownCloud server
- * 
- * @author David A. Velasco
- * @author masensio
  */
 public class DownloadFileOperation extends RemoteOperation {
     
@@ -177,5 +178,4 @@ public class DownloadFileOperation extends RemoteOperation {
             mDataTransferListeners.remove(listener);
         }
     }
-    
 }
index 9b7cf87..e081d4e 100644 (file)
@@ -1,24 +1,21 @@
-/* ownCloud Android Library is available under MIT license
- *   Copyright (C) 2014 ownCloud Inc.
- *   
- *   Permission is hereby granted, free of charge, to any person obtaining a copy
- *   of this software and associated documentation files (the "Software"), to deal
- *   in the Software without restriction, including without limitation the rights
- *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- *   copies of the Software, and to permit persons to whom the Software is
- *   furnished to do so, subject to the following conditions:
- *   
- *   The above copyright notice and this permission notice shall be included in
- *   all copies or substantial portions of the Software.
- *   
- *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
- *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
- *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
- *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
- *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
- *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- *   THE SOFTWARE.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -43,9 +40,6 @@ import android.content.Context;
  * 
  * Checks the existence of a configured ownCloud server in the URL, gets its version 
  * and finds out what authentication method is needed to access files in it.
- * 
- * @author David A. Velasco
- * @author masensio
  */
 
 public class GetServerInfoOperation extends RemoteOperation {
index 649437d..06e399e 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -28,10 +31,7 @@ import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation
 import com.owncloud.android.operations.common.SyncOperation;
 
 /**
- * Provide a list shares for a specific file.  
- * 
- * @author masensio
- *
+ * Provide a list shares for a specific file.
  */
 public class GetSharesForFileOperation extends SyncOperation {
     
index d096788..fb838b4 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -29,9 +33,6 @@ import com.owncloud.android.operations.common.SyncOperation;
 /**
  * Access to remote operation to get the share files/folders
  * Save the data in Database
- * 
- * @author masensio
- * @author David A. Velasco
  */
 
 public class GetSharesOperation extends SyncOperation {
index 63856c3..3a1103b 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -29,8 +32,6 @@ import android.accounts.Account;
 
 /**
  * Operation mmoving an {@link OCFile} to a different folder.
- * 
- * @author David A. Velasco
  */
 public class MoveFileOperation extends SyncOperation {
     
index 6f4ff74..918c57b 100644 (file)
@@ -1,3 +1,22 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 package com.owncloud.android.operations;
 
 import java.util.ArrayList;
diff --git a/src/com/owncloud/android/operations/RefreshFolderOperation.java b/src/com/owncloud/android/operations/RefreshFolderOperation.java
new file mode 100644 (file)
index 0000000..8d6cfbb
--- /dev/null
@@ -0,0 +1,611 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.operations;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.http.HttpStatus;
+import android.accounts.Account;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+//import android.support.v4.content.LocalBroadcastManager;
+
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.datamodel.OCFile;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.resources.shares.OCShare;
+import com.owncloud.android.lib.common.operations.RemoteOperation;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
+import com.owncloud.android.lib.resources.files.FileUtils;
+import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
+import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
+import com.owncloud.android.lib.resources.files.RemoteFile;
+
+import com.owncloud.android.syncadapter.FileSyncAdapter;
+import com.owncloud.android.utils.FileStorageUtils;
+
+
+
+/**
+ *  Remote operation performing the synchronization of the list of files contained 
+ *  in a folder identified with its remote path.
+ *  
+ *  Fetches the list and properties of the files contained in the given folder, including their 
+ *  properties, and updates the local database with them.
+ *  
+ *  Does NOT enter in the child folders to synchronize their contents also.
+ */
+public class RefreshFolderOperation extends RemoteOperation {
+
+    private static final String TAG = RefreshFolderOperation.class.getSimpleName();
+
+    public static final String EVENT_SINGLE_FOLDER_CONTENTS_SYNCED  = 
+            RefreshFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_CONTENTS_SYNCED";
+    public static final String EVENT_SINGLE_FOLDER_SHARES_SYNCED    = 
+            RefreshFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_SHARES_SYNCED";
+    
+    /** Time stamp for the synchronization process in progress */
+    private long mCurrentSyncTime;
+    
+    /** Remote folder to synchronize */
+    private OCFile mLocalFolder;
+    
+    /** Access to the local database */
+    private FileDataStorageManager mStorageManager;
+    
+    /** Account where the file to synchronize belongs */
+    private Account mAccount;
+    
+    /** Android context; necessary to send requests to the download service */
+    private Context mContext;
+    
+    /** Files and folders contained in the synchronized folder after a successful operation */
+    private List<OCFile> mChildren;
+
+    /** Counter of conflicts found between local and remote files */
+    private int mConflictsFound;
+
+    /** Counter of failed operations in synchronization of kept-in-sync files */
+    private int mFailsInFavouritesFound;
+
+    /**
+     * Map of remote and local paths to files that where locally stored in a location 
+     * out of the ownCloud folder and couldn't be copied automatically into it 
+     **/
+    private Map<String, String> mForgottenLocalFiles;
+
+    /** 'True' means that this operation is part of a full account synchronization */ 
+    private boolean mSyncFullAccount;
+
+    /** 'True' means that Share resources bound to the files into should be refreshed also */
+    private boolean mIsShareSupported;
+    
+    /** 'True' means that the remote folder changed and should be fetched */
+    private boolean mRemoteFolderChanged;
+
+    /** 'True' means that Etag will be ignored */
+    private boolean mIgnoreETag;
+
+    
+    /**
+     * Creates a new instance of {@link RefreshFolderOperation}.
+     * 
+     * @param   folder                  Folder to synchronize.
+     * @param   currentSyncTime         Time stamp for the synchronization process in progress.
+     * @param   syncFullAccount         'True' means that this operation is part of a full account 
+     *                                  synchronization.
+     * @param   isShareSupported        'True' means that the server supports the sharing API.           
+     * @param   ignoreEtag              'True' means that the content of the remote folder should
+     *                                  be fetched and updated even though the 'eTag' did not 
+     *                                  change.  
+     * @param   dataStorageManager      Interface with the local database.
+     * @param   account                 ownCloud account where the folder is located. 
+     * @param   context                 Application context.
+     */
+    public RefreshFolderOperation(OCFile folder,
+                                  long currentSyncTime,
+                                  boolean syncFullAccount,
+                                  boolean isShareSupported,
+                                  boolean ignoreETag,
+                                  FileDataStorageManager dataStorageManager,
+                                  Account account,
+                                  Context context) {
+        mLocalFolder = folder;
+        mCurrentSyncTime = currentSyncTime;
+        mSyncFullAccount = syncFullAccount;
+        mIsShareSupported = isShareSupported;
+        mStorageManager = dataStorageManager;
+        mAccount = account;
+        mContext = context;
+        mForgottenLocalFiles = new HashMap<String, String>();
+        mRemoteFolderChanged = false;
+        mIgnoreETag = ignoreETag;
+    }
+    
+    
+    public int getConflictsFound() {
+        return mConflictsFound;
+    }
+    
+    public int getFailsInFavouritesFound() {
+        return mFailsInFavouritesFound;
+    }
+    
+    public Map<String, String> getForgottenLocalFiles() {
+        return mForgottenLocalFiles;
+    }
+    
+    /**
+     * Returns the list of files and folders contained in the synchronized folder, 
+     * if called after synchronization is complete.
+     * 
+     * @return  List of files and folders contained in the synchronized folder.
+     */
+    public List<OCFile> getChildren() {
+        return mChildren;
+    }
+    
+    /**
+     * Performs the synchronization.
+     * 
+     * {@inheritDoc}
+     */
+    @Override
+    protected RemoteOperationResult run(OwnCloudClient client) {
+        RemoteOperationResult result = null;
+        mFailsInFavouritesFound = 0;
+        mConflictsFound = 0;
+        mForgottenLocalFiles.clear();
+        
+        if (FileUtils.PATH_SEPARATOR.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) {
+            updateOCVersion(client);
+        }
+        
+        result = checkForChanges(client);
+        
+        if (result.isSuccess()) {
+            if (mRemoteFolderChanged) {
+                result = fetchAndSyncRemoteFolder(client);
+            } else {
+                mChildren = mStorageManager.getFolderContent(mLocalFolder);
+            }
+        }
+        
+        if (!mSyncFullAccount) {            
+            sendLocalBroadcast(
+                    EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result
+            );
+        }
+        
+        if (result.isSuccess() && mIsShareSupported && !mSyncFullAccount) {
+            refreshSharesForFolder(client); // share result is ignored 
+        }
+        
+        if (!mSyncFullAccount) {            
+            sendLocalBroadcast(
+                    EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), result
+            );
+        }
+        
+        return result;
+        
+    }
+
+
+    private void updateOCVersion(OwnCloudClient client) {
+        UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
+        RemoteOperationResult result = update.execute(client);
+        if (result.isSuccess()) {
+            mIsShareSupported = update.getOCVersion().isSharedSupported();
+        }
+    }
+
+    
+    private RemoteOperationResult checkForChanges(OwnCloudClient client) {
+        mRemoteFolderChanged = true;
+        RemoteOperationResult result = null;
+        String remotePath = null;
+
+        remotePath = mLocalFolder.getRemotePath();
+        Log_OC.d(TAG, "Checking changes in " + mAccount.name + remotePath);
+        
+        // remote request 
+        ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
+        result = operation.execute(client);
+        if (result.isSuccess()){
+            OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
+
+            if (!mIgnoreETag) {
+                // check if remote and local folder are different
+                mRemoteFolderChanged = 
+                        !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
+            }
+
+            result = new RemoteOperationResult(ResultCode.OK);
+        
+            Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " + 
+                    (mRemoteFolderChanged ? "changed" : "not changed"));
+            
+        } else {
+            // check failed
+            if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
+                removeLocalFolder();
+            }
+            if (result.isException()) {
+                Log_OC.e(TAG, "Checked " + mAccount.name + remotePath  + " : " + 
+                        result.getLogMessage(), result.getException());
+            } else {
+                Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + " : " + 
+                        result.getLogMessage());
+            }
+        }
+        
+        return result;
+    }
+
+
+    private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) {
+        String remotePath = mLocalFolder.getRemotePath();
+        ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath);
+        RemoteOperationResult result = operation.execute(client);
+        Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath);
+        
+        if (result.isSuccess()) {
+            synchronizeData(result.getData(), client);
+            if (mConflictsFound > 0  || mFailsInFavouritesFound > 0) { 
+                result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);   
+                    // should be a different result code, but will do the job
+            }
+        } else {
+            if (result.getCode() == ResultCode.FILE_NOT_FOUND)
+                removeLocalFolder();
+        }
+        
+        return result;
+    }
+
+    
+    private void removeLocalFolder() {
+        if (mStorageManager.fileExists(mLocalFolder.getFileId())) {
+            String currentSavePath = FileStorageUtils.getSavePath(mAccount.name);
+            mStorageManager.removeFolder(
+                    mLocalFolder, 
+                    true, 
+                    (   mLocalFolder.isDown() && 
+                            mLocalFolder.getStoragePath().startsWith(currentSavePath)
+                    )
+            );
+        }
+    }
+
+
+    /**
+     *  Synchronizes the data retrieved from the server about the contents of the target folder 
+     *  with the current data in the local database.
+     *  
+     *  Grants that mChildren is updated with fresh data after execution.
+     *  
+     *  @param folderAndFiles   Remote folder and children files in Folder 
+     *  
+     *  @param client           Client instance to the remote server where the data were 
+     *                          retrieved.  
+     *  @return                 'True' when any change was made in the local data, 'false' otherwise
+     */
+    private void synchronizeData(ArrayList<Object> folderAndFiles, OwnCloudClient client) {
+        // get 'fresh data' from the database
+        mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath());
+
+        // parse data from remote folder 
+        OCFile remoteFolder = fillOCFile((RemoteFile)folderAndFiles.get(0));
+        remoteFolder.setParentId(mLocalFolder.getParentId());
+        remoteFolder.setFileId(mLocalFolder.getFileId());
+        
+        Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath() 
+                + " changed - starting update of local data ");
+        
+        List<OCFile> updatedFiles = new Vector<OCFile>(folderAndFiles.size() - 1);
+        List<SynchronizeFileOperation> filesToSyncContents = new Vector<SynchronizeFileOperation>();
+
+        // get current data about local contents of the folder to synchronize
+        List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder);
+        Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
+        for (OCFile file : localFiles) {
+            localFilesMap.put(file.getRemotePath(), file);
+        }
+        
+        // loop to update every child
+        OCFile remoteFile = null, localFile = null;
+        for (int i=1; i<folderAndFiles.size(); i++) {
+            /// new OCFile instance with the data from the server
+            remoteFile = fillOCFile((RemoteFile)folderAndFiles.get(i));
+            remoteFile.setParentId(mLocalFolder.getFileId());
+
+            /// retrieve local data for the read file 
+            //  localFile = mStorageManager.getFileByPath(remoteFile.getRemotePath());
+            localFile = localFilesMap.remove(remoteFile.getRemotePath());
+            
+            /// add to the remoteFile (the new one) data about LOCAL STATE (not existing in server)
+            remoteFile.setLastSyncDateForProperties(mCurrentSyncTime);
+            if (localFile != null) {
+                // some properties of local state are kept unmodified
+                remoteFile.setFileId(localFile.getFileId());
+                remoteFile.setKeepInSync(localFile.keepInSync());
+                remoteFile.setLastSyncDateForData(localFile.getLastSyncDateForData());
+                remoteFile.setModificationTimestampAtLastSyncForData(
+                        localFile.getModificationTimestampAtLastSyncForData()
+                );
+                remoteFile.setStoragePath(localFile.getStoragePath());
+                // eTag will not be updated unless contents are synchronized 
+                //  (Synchronize[File|Folder]Operation with remoteFile as parameter)
+                remoteFile.setEtag(localFile.getEtag());    
+                if (remoteFile.isFolder()) {
+                    remoteFile.setFileLength(localFile.getFileLength()); 
+                        // TODO move operations about size of folders to FileContentProvider
+                } else if (mRemoteFolderChanged && remoteFile.isImage() &&
+                        remoteFile.getModificationTimestamp() != localFile.getModificationTimestamp()) {
+                    remoteFile.setNeedsUpdateThumbnail(true);
+                    Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
+                }
+                remoteFile.setPublicLink(localFile.getPublicLink());
+                remoteFile.setShareByLink(localFile.isShareByLink());
+            } else {
+                // remote eTag will not be updated unless contents are synchronized 
+                //  (Synchronize[File|Folder]Operation with remoteFile as parameter)
+                remoteFile.setEtag(""); 
+            }
+
+            /// check and fix, if needed, local storage path
+            checkAndFixForeignStoragePath(remoteFile);      // policy - local files are COPIED 
+                                                            // into the ownCloud local folder;
+            searchForLocalFileInDefaultPath(remoteFile);    // legacy   
+
+            /// prepare content synchronization for kept-in-sync files
+            if (remoteFile.keepInSync()) {
+                SynchronizeFileOperation operation = new SynchronizeFileOperation(  localFile,        
+                                                                                    remoteFile, 
+                                                                                    mAccount, 
+                                                                                    true, 
+                                                                                    mContext
+                                                                                    );
+                
+                filesToSyncContents.add(operation);
+            }
+            
+            updatedFiles.add(remoteFile);
+        }
+
+        // save updated contents in local database
+        mStorageManager.saveFolder(remoteFolder, updatedFiles, localFilesMap.values());
+
+        // request for the synchronization of file contents AFTER saving current remote properties
+        startContentSynchronizations(filesToSyncContents, client);
+
+        mChildren = updatedFiles;
+    }
+
+    /**
+     * Performs a list of synchronization operations, determining if a download or upload is needed
+     * or if exists conflict due to changes both in local and remote contents of the each file.
+     * 
+     * If download or upload is needed, request the operation to the corresponding service and goes 
+     * on.
+     * 
+     * @param filesToSyncContents       Synchronization operations to execute.
+     * @param client                    Interface to the remote ownCloud server.
+     */
+    private void startContentSynchronizations(
+            List<SynchronizeFileOperation> filesToSyncContents, OwnCloudClient client
+        ) {
+        RemoteOperationResult contentsResult = null;
+        for (SynchronizeFileOperation op: filesToSyncContents) {
+            contentsResult = op.execute(mStorageManager, mContext);   // async
+            if (!contentsResult.isSuccess()) {
+                if (contentsResult.getCode() == ResultCode.SYNC_CONFLICT) {
+                    mConflictsFound++;
+                } else {
+                    mFailsInFavouritesFound++;
+                    if (contentsResult.getException() != null) {
+                        Log_OC.e(TAG, "Error while synchronizing favourites : " 
+                                +  contentsResult.getLogMessage(), contentsResult.getException());
+                    } else {
+                        Log_OC.e(TAG, "Error while synchronizing favourites : " 
+                                + contentsResult.getLogMessage());
+                    }
+                }
+            }   // won't let these fails break the synchronization process
+        }
+    }
+
+
+    public boolean isMultiStatus(int status) {
+        return (status == HttpStatus.SC_MULTI_STATUS); 
+    }
+
+    /**
+     * Creates and populates a new {@link OCFile} object with the data read from the server.
+     * 
+     * @param remote    remote file read from the server (remote file or folder).
+     * @return          New OCFile instance representing the remote resource described by we.
+     */
+    private OCFile fillOCFile(RemoteFile remote) {
+        OCFile file = new OCFile(remote.getRemotePath());
+        file.setCreationTimestamp(remote.getCreationTimestamp());
+        file.setFileLength(remote.getLength());
+        file.setMimetype(remote.getMimeType());
+        file.setModificationTimestamp(remote.getModifiedTimestamp());
+        file.setEtag(remote.getEtag());
+        file.setPermissions(remote.getPermissions());
+        file.setRemoteId(remote.getRemoteId());
+        return file;
+    }
+    
+
+    /**
+     * Checks the storage path of the OCFile received as parameter. 
+     * If it's out of the local ownCloud folder, tries to copy the file inside it. 
+     * 
+     * If the copy fails, the link to the local file is nullified. The account of forgotten 
+     * files is kept in {@link #mForgottenLocalFiles}
+     *) 
+     * @param file      File to check and fix.
+     */
+    private void checkAndFixForeignStoragePath(OCFile file) {
+        String storagePath = file.getStoragePath();
+        String expectedPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
+        if (storagePath != null && !storagePath.equals(expectedPath)) {
+            /// fix storagePaths out of the local ownCloud folder
+            File originalFile = new File(storagePath);
+            if (FileStorageUtils.getUsableSpace(mAccount.name) < originalFile.length()) {
+                mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
+                file.setStoragePath(null);
+                    
+            } else {
+                InputStream in = null;
+                OutputStream out = null;
+                try {
+                    File expectedFile = new File(expectedPath);
+                    File expectedParent = expectedFile.getParentFile();
+                    expectedParent.mkdirs();
+                    if (!expectedParent.isDirectory()) {
+                        throw new IOException(
+                                "Unexpected error: parent directory could not be created"
+                        );
+                    }
+                    expectedFile.createNewFile();
+                    if (!expectedFile.isFile()) {
+                        throw new IOException("Unexpected error: target file could not be created");
+                    }                    
+                    in = new FileInputStream(originalFile);
+                    out = new FileOutputStream(expectedFile);
+                    byte[] buf = new byte[1024];
+                    int len;
+                    while ((len = in.read(buf)) > 0){
+                        out.write(buf, 0, len);
+                    }
+                    file.setStoragePath(expectedPath);
+                    
+                } catch (Exception e) {
+                    Log_OC.e(TAG, "Exception while copying foreign file " + expectedPath, e);
+                    mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
+                    file.setStoragePath(null);
+                    
+                } finally {
+                    try {
+                        if (in != null) in.close();
+                    } catch (Exception e) {
+                        Log_OC.d(TAG, "Weird exception while closing input stream for " 
+                                + storagePath + " (ignoring)", e);
+                    }
+                    try {
+                        if (out != null) out.close();
+                    } catch (Exception e) {
+                        Log_OC.d(TAG, "Weird exception while closing output stream for " 
+                                + expectedPath + " (ignoring)", e);
+                    }
+                }
+            }
+        }
+    }
+    
+    
+    private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
+        RemoteOperationResult result = null;
+        
+        // remote request 
+        GetRemoteSharesForFileOperation operation = 
+                new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true);
+        result = operation.execute(client);
+        
+        if (result.isSuccess()) {
+            // update local database
+            ArrayList<OCShare> shares = new ArrayList<OCShare>();
+            for(Object obj: result.getData()) {
+                shares.add((OCShare) obj);
+            }
+            mStorageManager.saveSharesInFolder(shares, mLocalFolder);
+        }
+
+        return result;
+    }
+    
+
+    /**
+     * Scans the default location for saving local copies of files searching for
+     * a 'lost' file with the same full name as the {@link OCFile} received as 
+     * parameter.
+     *  
+     * @param file      File to associate a possible 'lost' local file.
+     */
+    private void searchForLocalFileInDefaultPath(OCFile file) {
+        if (file.getStoragePath() == null && !file.isFolder()) {
+            File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
+            if (f.exists()) {
+                file.setStoragePath(f.getAbsolutePath());
+                file.setLastSyncDateForData(f.lastModified());
+            }
+        }
+    }
+
+    
+    /**
+     * Sends a message to any application component interested in the progress 
+     * of the synchronization.
+     * 
+     * @param event
+     * @param dirRemotePath     Remote path of a folder that was just synchronized 
+     *                          (with or without success)
+     * @param result
+     */
+    private void sendLocalBroadcast(
+            String event, String dirRemotePath, RemoteOperationResult result
+        ) {
+        Log_OC.d(TAG, "Send broadcast " + event);
+        Intent intent = new Intent(event);
+        intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, mAccount.name);
+        if (dirRemotePath != null) {
+            intent.putExtra(FileSyncAdapter.EXTRA_FOLDER_PATH, dirRemotePath);
+        }
+        intent.putExtra(FileSyncAdapter.EXTRA_RESULT, result);
+        mContext.sendStickyBroadcast(intent);
+        //LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
+    }
+
+
+    public boolean getRemoteFolderChanged() {
+        return mRemoteFolderChanged;
+    }
+
+}
index 6bd4e8a..8f7067d 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -27,9 +31,6 @@ import com.owncloud.android.operations.common.SyncOperation;
 
 /**
  * Remote operation performing the removal of a remote file or folder in the ownCloud server.
- * 
- * @author David A. Velasco
- * @author masensio
  */
 public class RemoveFileOperation extends SyncOperation {
     
index bd60e1f..9726395 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -32,9 +36,6 @@ import com.owncloud.android.utils.FileStorageUtils;
 
 /**
  * Remote operation performing the rename of a remote file (or folder?) in the ownCloud server.
- * 
- * @author David A. Velasco
- * @author masensio
  */
 public class RenameFileOperation extends SyncOperation {
     
@@ -51,7 +52,6 @@ public class RenameFileOperation extends SyncOperation {
      * Constructor
      * 
      * @param remotePath            RemotePath of the OCFile instance describing the remote file or folder to rename
-     * @param account               OwnCloud account containing the remote file 
      * @param newName               New name to set as the name of file.
      */
     public RenameFileOperation(String remotePath, String newName) {
@@ -117,7 +117,7 @@ public class RenameFileOperation extends SyncOperation {
 
     private void saveLocalFile() {
         mFile.setFileName(mNewName);
-        
+
         // try to rename the local copy of the file
         if (mFile.isDown()) {
             String oldPath = mFile.getStoragePath();
@@ -129,8 +129,8 @@ public class RenameFileOperation extends SyncOperation {
                 String newPath = parentStoragePath + mNewName;
                 mFile.setStoragePath(newPath);
 
-                // notify MediaScanner about removed file - TODO really works?
-                getStorageManager().triggerMediaScan(oldPath);
+                // notify MediaScanner about removed file
+                getStorageManager().deleteFileInMediaScan(oldPath);
                 // notify to scan about new file
                 getStorageManager().triggerMediaScan(newPath);
             }
@@ -158,7 +158,7 @@ public class RenameFileOperation extends SyncOperation {
      */
     private boolean isValidNewName() throws IOException {
         // check tricky names
-        if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator) || mNewName.contains("%")) { 
+        if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator)) {
             return false;
         }
         // create a test file
index 45a7305..6f1730e 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   @author masensio
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -36,9 +40,6 @@ import android.content.Intent;
 
 /**
  * Remote operation performing the read of remote file in the ownCloud server.
- * 
- * @author David A. Velasco
- * @author masensio
  */
 
 public class SynchronizeFileOperation extends SyncOperation {
@@ -54,13 +55,22 @@ public class SynchronizeFileOperation extends SyncOperation {
     
     private boolean mTransferWasRequested = false;
 
+    /** 
+     * When 'false', uploads to the server are not done; only downloads or conflict detection.  
+     * This is a temporal field. 
+     * TODO Remove when 'folder synchronization' replaces 'folder download'.
+     */    
+    private boolean mAllowUploads;
+
     
     /**
-     * Constructor.
+     * Constructor for "full synchronization mode".
      * 
-     * Uses remotePath to retrieve all the data in local cache and remote server when the operation
+     * Uses remotePath to retrieve all the data both in local cache and in the remote OC server when the operation
      * is executed, instead of reusing {@link OCFile} instances.
      * 
+     * Useful for direct synchronization of a single file.
+     * 
      * @param 
      * @param account               ownCloud account holding the file.
      * @param syncFileContents      When 'true', transference of data will be started by the 
@@ -79,16 +89,21 @@ public class SynchronizeFileOperation extends SyncOperation {
         mAccount = account;
         mSyncFileContents = syncFileContents;
         mContext = context;
+        mAllowUploads = true;
     }
 
     
     /**
-     * Constructor allowing to reuse {@link OCFile} instances just queried from cache or network.
+     * Constructor allowing to reuse {@link OCFile} instances just queried from local cache or from remote OC server.
      * 
-     * Useful for folder / account synchronizations.
+     * Useful to include this operation as part of the synchronization of a folder (or a full account), avoiding the
+     * repetition of fetch operations (both in local database or remote server).
      * 
-     * @param localFile             Data of file currently hold in device cache. MUSTN't be null.
-     * @param serverFile            Data of file just retrieved from network. If null, will be
+     * At least one of localFile or serverFile MUST NOT BE NULL. If you don't have none of them, use the other 
+     * constructor.
+     * 
+     * @param localFile             Data of file (just) retrieved from local cache/database.
+     * @param serverFile            Data of file (just) retrieved from a remote server. If null, will be
      *                              retrieved from network by the operation when executed.
      * @param account               ownCloud account holding the file.
      * @param syncFileContents      When 'true', transference of data will be started by the 
@@ -104,10 +119,53 @@ public class SynchronizeFileOperation extends SyncOperation {
         
         mLocalFile = localFile;
         mServerFile = serverFile;
-        mRemotePath = localFile.getRemotePath();
+        if (mLocalFile != null) {
+            mRemotePath = mLocalFile.getRemotePath();
+            if (mServerFile != null && !mServerFile.getRemotePath().equals(mRemotePath)) {
+                throw new IllegalArgumentException("serverFile and localFile do not correspond to the same OC file");
+            }
+        } else if (mServerFile != null) {
+            mRemotePath = mServerFile.getRemotePath();
+        } else {
+            throw new IllegalArgumentException("Both serverFile and localFile are NULL");
+        }
         mAccount = account;
         mSyncFileContents = syncFileContents;
         mContext = context;
+        mAllowUploads = true;
+    }
+    
+
+    /**
+     * Temporal constructor.
+     * 
+     * Extends the previous one to allow constrained synchronizations where uploads are never performed - only
+     * downloads or conflict detection.
+     * 
+     * Do not use unless you are involved in 'folder synchronization' or 'folder download' work in progress.
+     * 
+     * TODO Remove when 'folder synchronization' replaces 'folder download'.
+     * 
+     * @param localFile             Data of file (just) retrieved from local cache/database. MUSTN't be null.
+     * @param serverFile            Data of file (just) retrieved from a remote server. If null, will be
+     *                              retrieved from network by the operation when executed.
+     * @param account               ownCloud account holding the file.
+     * @param syncFileContents      When 'true', transference of data will be started by the 
+     *                              operation if needed and no conflict is detected.
+     * @param allowUploads          When 'false', uploads to the server are not done; only downloads or conflict
+     *                              detection. 
+     * @param context               Android context; needed to start transfers.
+     */
+    public SynchronizeFileOperation(
+            OCFile localFile,
+            OCFile serverFile, 
+            Account account, 
+            boolean syncFileContents,
+            boolean allowUploads, 
+            Context context) {
+        
+        this(localFile, serverFile, account, syncFileContents, context);
+        mAllowUploads = allowUploads;
     }
     
 
@@ -145,13 +203,15 @@ public class SynchronizeFileOperation extends SyncOperation {
                 boolean serverChanged = false;
                 /* time for eTag is coming, but not yet
                     if (mServerFile.getEtag() != null) {
-                        serverChanged = (!mServerFile.getEtag().equals(mLocalFile.getEtag()));   // TODO could this be dangerous when the user upgrades the server from non-tagged to tagged?
+                        serverChanged = (!mServerFile.getEtag().equals(mLocalFile.getEtag()));
                     } else { */
-                // server without etags
-                serverChanged = (mServerFile.getModificationTimestamp() != mLocalFile.getModificationTimestampAtLastSyncForData());
+                serverChanged = (
+                    mServerFile.getModificationTimestamp() != mLocalFile.getModificationTimestampAtLastSyncForData()
+                );
                 //}
-                boolean localChanged = (mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
-                // TODO this will be always true after the app is upgraded to database version 2; will result in unnecessary uploads
+                boolean localChanged = (
+                    mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData()
+                );
 
                 /// decide action to perform depending upon changes
                 //if (!mLocalFile.getEtag().isEmpty() && localChanged && serverChanged) {
@@ -159,7 +219,7 @@ public class SynchronizeFileOperation extends SyncOperation {
                     result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
 
                 } else if (localChanged) {
-                    if (mSyncFileContents) {
+                    if (mSyncFileContents && mAllowUploads) {
                         requestForUpload(mLocalFile);
                         // the local update of file properties will be done by the FileUploader service when the upload finishes
                     } else {
@@ -195,7 +255,8 @@ public class SynchronizeFileOperation extends SyncOperation {
 
         }
 
-        Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", file " + mLocalFile.getRemotePath() + ": " + result.getLogMessage());
+        Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", file " + mLocalFile.getRemotePath() + ": " 
+                + result.getLogMessage());
 
         return result;
     }
index d61e678..e80b42f 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
 
 package com.owncloud.android.operations;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.apache.http.HttpStatus;
 import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
 import android.util.Log;
-//import android.support.v4.content.LocalBroadcastManager;
 
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
-
+import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.resources.shares.OCShare;
-import com.owncloud.android.lib.common.operations.RemoteOperation;
+import com.owncloud.android.lib.common.operations.OperationCancelledException;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
-import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
 import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
 import com.owncloud.android.lib.resources.files.RemoteFile;
-
-import com.owncloud.android.syncadapter.FileSyncAdapter;
+import com.owncloud.android.operations.common.SyncOperation;
+import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.utils.FileStorageUtils;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+//import android.support.v4.content.LocalBroadcastManager;
 
 
 /**
@@ -64,228 +59,178 @@ import com.owncloud.android.utils.FileStorageUtils;
  *  properties, and updates the local database with them.
  *  
  *  Does NOT enter in the child folders to synchronize their contents also.
- * 
- *  @author David A. Velasco
  */
-public class SynchronizeFolderOperation extends RemoteOperation {
+public class SynchronizeFolderOperation extends SyncOperation {
 
     private static final String TAG = SynchronizeFolderOperation.class.getSimpleName();
 
-    public static final String EVENT_SINGLE_FOLDER_CONTENTS_SYNCED  = 
-            SynchronizeFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_CONTENTS_SYNCED";
-    public static final String EVENT_SINGLE_FOLDER_SHARES_SYNCED    = 
-            SynchronizeFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_SHARES_SYNCED";
-    
     /** Time stamp for the synchronization process in progress */
     private long mCurrentSyncTime;
-    
-    /** Remote folder to synchronize */
-    private OCFile mLocalFolder;
-    
-    /** Access to the local database */
-    private FileDataStorageManager mStorageManager;
+
+    /** Remote path of the folder to synchronize */
+    private String mRemotePath;
     
     /** Account where the file to synchronize belongs */
     private Account mAccount;
-    
+
     /** Android context; necessary to send requests to the download service */
     private Context mContext;
-    
+
+    /** Locally cached information about folder to synchronize */
+    private OCFile mLocalFolder;
+
     /** Files and folders contained in the synchronized folder after a successful operation */
-    private List<OCFile> mChildren;
+    //private List<OCFile> mChildren;
 
     /** Counter of conflicts found between local and remote files */
     private int mConflictsFound;
 
     /** Counter of failed operations in synchronization of kept-in-sync files */
-    private int mFailsInFavouritesFound;
-
-    /**
-     * Map of remote and local paths to files that where locally stored in a location 
-     * out of the ownCloud folder and couldn't be copied automatically into it 
-     **/
-    private Map<String, String> mForgottenLocalFiles;
-
-    /** 'True' means that this operation is part of a full account synchronization */ 
-    private boolean mSyncFullAccount;
+    private int mFailsInFileSyncsFound;
 
-    /** 'True' means that Share resources bound to the files into should be refreshed also */
-    private boolean mIsShareSupported;
-    
     /** 'True' means that the remote folder changed and should be fetched */
     private boolean mRemoteFolderChanged;
 
-    /** 'True' means that Etag will be ignored */
-    private boolean mIgnoreETag;
-
+    private List<OCFile> mFilesForDirectDownload;
+        // to avoid extra PROPFINDs when there was no change in the folder
     
+    private List<SyncOperation> mFilesToSyncContentsWithoutUpload;
+        // this will go out when 'folder synchronization' replaces 'folder download'; step by step  
+
+    private List<SyncOperation> mFavouriteFilesToSyncContents;
+        // this will be used for every file when 'folder synchronization' replaces 'folder download' 
+
+    private final AtomicBoolean mCancellationRequested;
+
     /**
      * Creates a new instance of {@link SynchronizeFolderOperation}.
-     * 
-     * @param   folder                  Folder to synchronize.
-     * @param   currentSyncTime         Time stamp for the synchronization process in progress.
-     * @param   syncFullAccount         'True' means that this operation is part of a full account 
-     *                                  synchronization.
-     * @param   isShareSupported        'True' means that the server supports the sharing API.           
-     * @param   ignoreEtag              'True' means that the content of the remote folder should
-     *                                  be fetched and updated even though the 'eTag' did not 
-     *                                  change.  
-     * @param   dataStorageManager      Interface with the local database.
-     * @param   account                 ownCloud account where the folder is located. 
+     *
      * @param   context                 Application context.
+     * @param   remotePath              Path to synchronize.
+     * @param   account                 ownCloud account where the folder is located.
+     * @param   currentSyncTime         Time stamp for the synchronization process in progress.
      */
-    public SynchronizeFolderOperation(  OCFile folder, 
-                                        long currentSyncTime, 
-                                        boolean syncFullAccount,
-                                        boolean isShareSupported,
-                                        boolean ignoreETag,
-                                        FileDataStorageManager dataStorageManager, 
-                                        Account account, 
-                                        Context context ) {
-        mLocalFolder = folder;
+    public SynchronizeFolderOperation(Context context, String remotePath, Account account, long currentSyncTime){
+        mRemotePath = remotePath;
         mCurrentSyncTime = currentSyncTime;
-        mSyncFullAccount = syncFullAccount;
-        mIsShareSupported = isShareSupported;
-        mStorageManager = dataStorageManager;
         mAccount = account;
         mContext = context;
-        mForgottenLocalFiles = new HashMap<String, String>();
         mRemoteFolderChanged = false;
-        mIgnoreETag = ignoreETag;
+        mFilesForDirectDownload = new Vector<OCFile>();
+        mFilesToSyncContentsWithoutUpload = new Vector<SyncOperation>();
+        mFavouriteFilesToSyncContents = new Vector<SyncOperation>();
+        mCancellationRequested = new AtomicBoolean(false);
     }
-    
-    
+
+
     public int getConflictsFound() {
         return mConflictsFound;
     }
-    
-    public int getFailsInFavouritesFound() {
-        return mFailsInFavouritesFound;
-    }
-    
-    public Map<String, String> getForgottenLocalFiles() {
-        return mForgottenLocalFiles;
-    }
-    
-    /**
-     * Returns the list of files and folders contained in the synchronized folder, 
-     * if called after synchronization is complete.
-     * 
-     * @return  List of files and folders contained in the synchronized folder.
-     */
-    public List<OCFile> getChildren() {
-        return mChildren;
+
+    public int getFailsInFileSyncsFound() {
+        return mFailsInFileSyncsFound;
     }
-    
+
     /**
      * Performs the synchronization.
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
     protected RemoteOperationResult run(OwnCloudClient client) {
         RemoteOperationResult result = null;
-        mFailsInFavouritesFound = 0;
+        mFailsInFileSyncsFound = 0;
         mConflictsFound = 0;
-        mForgottenLocalFiles.clear();
-        
-        if (FileUtils.PATH_SEPARATOR.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) {
-            updateOCVersion(client);
-        }
-        
-        result = checkForChanges(client);
         
-        if (result.isSuccess()) {
-            if (mRemoteFolderChanged) {
-                result = fetchAndSyncRemoteFolder(client);
-            } else {
-                mChildren = mStorageManager.getFolderContent(mLocalFolder);
+        try {
+            // get locally cached information about folder 
+            mLocalFolder = getStorageManager().getFileByPath(mRemotePath);   
+            
+            result = checkForChanges(client);
+    
+            if (result.isSuccess()) {
+                if (mRemoteFolderChanged) {
+                    result = fetchAndSyncRemoteFolder(client);
+                    
+                } else {
+                    prepareOpsFromLocalKnowledge();
+                }
+                
+                if (result.isSuccess()) {
+                    syncContents(client);
+                }
+
             }
+            
+            if (mCancellationRequested.get()) {
+                throw new OperationCancelledException();
+            }
+            
+        } catch (OperationCancelledException e) {
+            result = new RemoteOperationResult(e);
         }
-        
-        if (!mSyncFullAccount) {            
-            sendLocalBroadcast(
-                    EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result
-            );
-        }
-        
-        if (result.isSuccess() && mIsShareSupported && !mSyncFullAccount) {
-            refreshSharesForFolder(client); // share result is ignored 
-        }
-        
-        if (!mSyncFullAccount) {            
-            sendLocalBroadcast(
-                    EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), result
-            );
-        }
-        
-        return result;
-        
-    }
 
+        return result;
 
-    private void updateOCVersion(OwnCloudClient client) {
-        UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
-        RemoteOperationResult result = update.execute(client);
-        if (result.isSuccess()) {
-            mIsShareSupported = update.getOCVersion().isSharedSupported();
-        }
     }
 
-    
-    private RemoteOperationResult checkForChanges(OwnCloudClient client) {
+    private RemoteOperationResult checkForChanges(OwnCloudClient client) throws OperationCancelledException {
+        Log_OC.d(TAG, "Checking changes in " + mAccount.name + mRemotePath);
+
         mRemoteFolderChanged = true;
         RemoteOperationResult result = null;
-        String remotePath = null;
-
-        remotePath = mLocalFolder.getRemotePath();
-        Log_OC.d(TAG, "Checking changes in " + mAccount.name + remotePath);
         
-        // remote request 
-        ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
+        if (mCancellationRequested.get()) {
+            throw new OperationCancelledException();
+        }
+        
+        // remote request
+        ReadRemoteFileOperation operation = new ReadRemoteFileOperation(mRemotePath);
         result = operation.execute(client);
         if (result.isSuccess()){
             OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
 
-            if (!mIgnoreETag) {
-                // check if remote and local folder are different
-                mRemoteFolderChanged = 
+            // check if remote and local folder are different
+            mRemoteFolderChanged =
                         !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
-            }
 
             result = new RemoteOperationResult(ResultCode.OK);
-        
-            Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " + 
+
+            Log_OC.i(TAG, "Checked " + mAccount.name + mRemotePath + " : " +
                     (mRemoteFolderChanged ? "changed" : "not changed"));
-            
+
         } else {
             // check failed
             if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
                 removeLocalFolder();
             }
             if (result.isException()) {
-                Log_OC.e(TAG, "Checked " + mAccount.name + remotePath  + " : " + 
+                Log_OC.e(TAG, "Checked " + mAccount.name + mRemotePath  + " : " +
                         result.getLogMessage(), result.getException());
             } else {
-                Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + " : " + 
+                Log_OC.e(TAG, "Checked " + mAccount.name + mRemotePath + " : " +
                         result.getLogMessage());
             }
+
         }
-        
+
         return result;
     }
 
 
-    private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) {
-        String remotePath = mLocalFolder.getRemotePath();
-        ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath);
-        RemoteOperationResult result = operation.execute(client);
-        Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath);
+    private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) throws OperationCancelledException {
+        if (mCancellationRequested.get()) {
+            throw new OperationCancelledException();
+        }
         
+        ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(mRemotePath);
+        RemoteOperationResult result = operation.execute(client);
+        Log_OC.d(TAG, "Synchronizing " + mAccount.name + mRemotePath);
+
         if (result.isSuccess()) {
             synchronizeData(result.getData(), client);
-            if (mConflictsFound > 0  || mFailsInFavouritesFound > 0) { 
-                result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);   
+            if (mConflictsFound > 0  || mFailsInFileSyncsFound > 0) {
+                result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
                     // should be a different result code, but will do the job
             }
         } else {
@@ -293,17 +238,19 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                 removeLocalFolder();
         }
         
+
         return result;
     }
 
-    
+
     private void removeLocalFolder() {
-        if (mStorageManager.fileExists(mLocalFolder.getFileId())) {
+        FileDataStorageManager storageManager = getStorageManager();
+        if (storageManager.fileExists(mLocalFolder.getFileId())) {
             String currentSavePath = FileStorageUtils.getSavePath(mAccount.name);
-            mStorageManager.removeFolder(
-                    mLocalFolder, 
-                    true, 
-                    (   mLocalFolder.isDown() && 
+            storageManager.removeFolder(
+                    mLocalFolder,
+                    true,
+                    (   mLocalFolder.isDown() &&        // TODO: debug, I think this is always false for folders
                             mLocalFolder.getStoragePath().startsWith(currentSavePath)
                     )
             );
@@ -312,50 +259,56 @@ public class SynchronizeFolderOperation extends RemoteOperation {
 
 
     /**
-     *  Synchronizes the data retrieved from the server about the contents of the target folder 
+     *  Synchronizes the data retrieved from the server about the contents of the target folder
      *  with the current data in the local database.
-     *  
+     *
      *  Grants that mChildren is updated with fresh data after execution.
-     *  
-     *  @param folderAndFiles   Remote folder and children files in Folder 
-     *  
-     *  @param client           Client instance to the remote server where the data were 
-     *                          retrieved.  
+     *
+     *  @param folderAndFiles   Remote folder and children files in Folder
+     *
+     *  @param client           Client instance to the remote server where the data were
+     *                          retrieved.
      *  @return                 'True' when any change was made in the local data, 'false' otherwise
      */
-    private void synchronizeData(ArrayList<Object> folderAndFiles, OwnCloudClient client) {
-        // get 'fresh data' from the database
-        mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath());
-
-        // parse data from remote folder 
+    private void synchronizeData(ArrayList<Object> folderAndFiles, OwnCloudClient client)
+            throws OperationCancelledException {
+        FileDataStorageManager storageManager = getStorageManager();
+        
+        // parse data from remote folder
         OCFile remoteFolder = fillOCFile((RemoteFile)folderAndFiles.get(0));
         remoteFolder.setParentId(mLocalFolder.getParentId());
         remoteFolder.setFileId(mLocalFolder.getFileId());
-        
-        Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath() 
+
+        Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath()
                 + " changed - starting update of local data ");
-        
+
         List<OCFile> updatedFiles = new Vector<OCFile>(folderAndFiles.size() - 1);
-        List<SynchronizeFileOperation> filesToSyncContents = new Vector<SynchronizeFileOperation>();
+        mFilesForDirectDownload.clear();
+        mFilesToSyncContentsWithoutUpload.clear();
+        mFavouriteFilesToSyncContents.clear();
+
+        if (mCancellationRequested.get()) {
+            throw new OperationCancelledException();
+        }
 
         // get current data about local contents of the folder to synchronize
-        List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder);
+        List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder);
         Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
         for (OCFile file : localFiles) {
             localFilesMap.put(file.getRemotePath(), file);
         }
-        
-        // loop to update every child
+
+        // loop to synchronize every child
         OCFile remoteFile = null, localFile = null;
         for (int i=1; i<folderAndFiles.size(); i++) {
             /// new OCFile instance with the data from the server
             remoteFile = fillOCFile((RemoteFile)folderAndFiles.get(i));
             remoteFile.setParentId(mLocalFolder.getFileId());
 
-            /// retrieve local data for the read file 
+            /// retrieve local data for the read file
             //  localFile = mStorageManager.getFileByPath(remoteFile.getRemotePath());
             localFile = localFilesMap.remove(remoteFile.getRemotePath());
-            
+
             /// add to the remoteFile (the new one) data about LOCAL STATE (not existing in server)
             remoteFile.setLastSyncDateForProperties(mCurrentSyncTime);
             if (localFile != null) {
@@ -367,11 +320,11 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                         localFile.getModificationTimestampAtLastSyncForData()
                 );
                 remoteFile.setStoragePath(localFile.getStoragePath());
-                // eTag will not be updated unless contents are synchronized 
+                // eTag will not be updated unless contents are synchronized
                 //  (Synchronize[File|Folder]Operation with remoteFile as parameter)
-                remoteFile.setEtag(localFile.getEtag());    
+                remoteFile.setEtag(localFile.getEtag());
                 if (remoteFile.isFolder()) {
-                    remoteFile.setFileLength(localFile.getFileLength()); 
+                    remoteFile.setFileLength(localFile.getFileLength());
                         // TODO move operations about size of folders to FileContentProvider
                 } else if (mRemoteFolderChanged && remoteFile.isImage() &&
                         remoteFile.getModificationTimestamp() != localFile.getModificationTimestamp()) {
@@ -381,81 +334,143 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                 remoteFile.setPublicLink(localFile.getPublicLink());
                 remoteFile.setShareByLink(localFile.isShareByLink());
             } else {
-                // remote eTag will not be updated unless contents are synchronized 
+                // remote eTag will not be updated unless contents are synchronized
                 //  (Synchronize[File|Folder]Operation with remoteFile as parameter)
-                remoteFile.setEtag(""); 
+                remoteFile.setEtag("");
             }
 
             /// check and fix, if needed, local storage path
-            checkAndFixForeignStoragePath(remoteFile);      // policy - local files are COPIED 
-                                                            // into the ownCloud local folder;
-            searchForLocalFileInDefaultPath(remoteFile);    // legacy   
-
-            /// prepare content synchronization for kept-in-sync files
-            if (remoteFile.keepInSync()) {
-                SynchronizeFileOperation operation = new SynchronizeFileOperation(  localFile,        
-                                                                                    remoteFile, 
-                                                                                    mAccount, 
-                                                                                    true, 
-                                                                                    mContext
-                                                                                    );
+            searchForLocalFileInDefaultPath(remoteFile);
+            
+            /// classify file to sync/download contents later
+            if (remoteFile.isFolder()) {
+                /// to download children files recursively
+                synchronized(mCancellationRequested) {
+                    if (mCancellationRequested.get()) {
+                        throw new OperationCancelledException();
+                    }
+                    startSyncFolderOperation(remoteFile.getRemotePath());
+                }
+
+            } else if (remoteFile.keepInSync()) {
+                /// prepare content synchronization for kept-in-sync files
+                SynchronizeFileOperation operation = new SynchronizeFileOperation(
+                        localFile,
+                        remoteFile,
+                        mAccount,
+                        true,
+                        mContext
+                    );
+                mFavouriteFilesToSyncContents.add(operation);
                 
-                filesToSyncContents.add(operation);
+            } else {
+                /// prepare limited synchronization for regular files
+                SynchronizeFileOperation operation = new SynchronizeFileOperation(
+                        localFile,
+                        remoteFile,
+                        mAccount,
+                        true,
+                        false,
+                        mContext
+                    );
+                mFilesToSyncContentsWithoutUpload.add(operation);
             }
-            
+
             updatedFiles.add(remoteFile);
         }
 
         // save updated contents in local database
-        mStorageManager.saveFolder(remoteFolder, updatedFiles, localFilesMap.values());
+        storageManager.saveFolder(remoteFolder, updatedFiles, localFilesMap.values());
+
+    }
+    
+    
+    private void prepareOpsFromLocalKnowledge() throws OperationCancelledException {
+        List<OCFile> children = getStorageManager().getFolderContent(mLocalFolder);
+        for (OCFile child : children) {
+            /// classify file to sync/download contents later
+            if (child.isFolder()) {
+                /// to download children files recursively
+                synchronized(mCancellationRequested) {
+                    if (mCancellationRequested.get()) {
+                        throw new OperationCancelledException();
+                    }
+                    startSyncFolderOperation(child.getRemotePath());
+                }
+
+            } else {
+                /// prepare limited synchronization for regular files
+                if (!child.isDown()) {
+                    mFilesForDirectDownload.add(child);
+                }
+            }
+        }
+    }
+
 
-        // request for the synchronization of file contents AFTER saving current remote properties
-        startContentSynchronizations(filesToSyncContents, client);
+    private void syncContents(OwnCloudClient client) throws OperationCancelledException {
+        startDirectDownloads();
+        startContentSynchronizations(mFilesToSyncContentsWithoutUpload, client);
+        startContentSynchronizations(mFavouriteFilesToSyncContents, client);
+    }
 
-        mChildren = updatedFiles;
+    
+    private void startDirectDownloads() throws OperationCancelledException {
+        for (OCFile file : mFilesForDirectDownload) {
+            synchronized(mCancellationRequested) {
+                if (mCancellationRequested.get()) {
+                    throw new OperationCancelledException();
+                }
+                Intent i = new Intent(mContext, FileDownloader.class);
+                i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
+                i.putExtra(FileDownloader.EXTRA_FILE, file);
+                mContext.startService(i);
+            }
+        }
     }
 
     /**
      * Performs a list of synchronization operations, determining if a download or upload is needed
      * or if exists conflict due to changes both in local and remote contents of the each file.
-     * 
-     * If download or upload is needed, request the operation to the corresponding service and goes 
+     *
+     * If download or upload is needed, request the operation to the corresponding service and goes
      * on.
-     * 
+     *
      * @param filesToSyncContents       Synchronization operations to execute.
      * @param client                    Interface to the remote ownCloud server.
      */
-    private void startContentSynchronizations(
-            List<SynchronizeFileOperation> filesToSyncContents, OwnCloudClient client
-        ) {
+    private void startContentSynchronizations(List<SyncOperation> filesToSyncContents, OwnCloudClient client) 
+            throws OperationCancelledException {
+
+        Log_OC.v(TAG, "Starting content synchronization... ");
         RemoteOperationResult contentsResult = null;
-        for (SynchronizeFileOperation op: filesToSyncContents) {
-            contentsResult = op.execute(mStorageManager, mContext);   // async
+        for (SyncOperation op: filesToSyncContents) {
+            if (mCancellationRequested.get()) {
+                throw new OperationCancelledException();
+            }
+            contentsResult = op.execute(getStorageManager(), mContext);
             if (!contentsResult.isSuccess()) {
                 if (contentsResult.getCode() == ResultCode.SYNC_CONFLICT) {
                     mConflictsFound++;
                 } else {
-                    mFailsInFavouritesFound++;
+                    mFailsInFileSyncsFound++;
                     if (contentsResult.getException() != null) {
-                        Log_OC.e(TAG, "Error while synchronizing favourites : " 
+                        Log_OC.e(TAG, "Error while synchronizing file : "
                                 +  contentsResult.getLogMessage(), contentsResult.getException());
                     } else {
-                        Log_OC.e(TAG, "Error while synchronizing favourites : " 
+                        Log_OC.e(TAG, "Error while synchronizing file : "
                                 + contentsResult.getLogMessage());
                     }
                 }
+                // TODO - use the errors count in notifications
             }   // won't let these fails break the synchronization process
         }
     }
 
-
-    public boolean isMultiStatus(int status) {
-        return (status == HttpStatus.SC_MULTI_STATUS); 
-    }
-
+    
     /**
-     * Creates and populates a new {@link OCFile} object with the data read from the server.
-     * 
+     * Creates and populates a new {@link com.owncloud.android.datamodel.OCFile} object with the data read from the server.
+     *
      * @param remote    remote file read from the server (remote file or folder).
      * @return          New OCFile instance representing the remote resource described by we.
      */
@@ -470,100 +485,11 @@ public class SynchronizeFolderOperation extends RemoteOperation {
         file.setRemoteId(remote.getRemoteId());
         return file;
     }
-    
-
-    /**
-     * Checks the storage path of the OCFile received as parameter. 
-     * If it's out of the local ownCloud folder, tries to copy the file inside it. 
-     * 
-     * If the copy fails, the link to the local file is nullified. The account of forgotten 
-     * files is kept in {@link #mForgottenLocalFiles}
-     *) 
-     * @param file      File to check and fix.
-     */
-    private void checkAndFixForeignStoragePath(OCFile file) {
-        String storagePath = file.getStoragePath();
-        String expectedPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
-        if (storagePath != null && !storagePath.equals(expectedPath)) {
-            /// fix storagePaths out of the local ownCloud folder
-            File originalFile = new File(storagePath);
-            if (FileStorageUtils.getUsableSpace(mAccount.name) < originalFile.length()) {
-                mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
-                file.setStoragePath(null);
-                    
-            } else {
-                InputStream in = null;
-                OutputStream out = null;
-                try {
-                    File expectedFile = new File(expectedPath);
-                    File expectedParent = expectedFile.getParentFile();
-                    expectedParent.mkdirs();
-                    if (!expectedParent.isDirectory()) {
-                        throw new IOException(
-                                "Unexpected error: parent directory could not be created"
-                        );
-                    }
-                    expectedFile.createNewFile();
-                    if (!expectedFile.isFile()) {
-                        throw new IOException("Unexpected error: target file could not be created");
-                    }                    
-                    in = new FileInputStream(originalFile);
-                    out = new FileOutputStream(expectedFile);
-                    byte[] buf = new byte[1024];
-                    int len;
-                    while ((len = in.read(buf)) > 0){
-                        out.write(buf, 0, len);
-                    }
-                    file.setStoragePath(expectedPath);
-                    
-                } catch (Exception e) {
-                    Log_OC.e(TAG, "Exception while copying foreign file " + expectedPath, e);
-                    mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
-                    file.setStoragePath(null);
-                    
-                } finally {
-                    try {
-                        if (in != null) in.close();
-                    } catch (Exception e) {
-                        Log_OC.d(TAG, "Weird exception while closing input stream for " 
-                                + storagePath + " (ignoring)", e);
-                    }
-                    try {
-                        if (out != null) out.close();
-                    } catch (Exception e) {
-                        Log_OC.d(TAG, "Weird exception while closing output stream for " 
-                                + expectedPath + " (ignoring)", e);
-                    }
-                }
-            }
-        }
-    }
-    
-    
-    private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
-        RemoteOperationResult result = null;
-        
-        // remote request 
-        GetRemoteSharesForFileOperation operation = 
-                new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true);
-        result = operation.execute(client);
-        
-        if (result.isSuccess()) {
-            // update local database
-            ArrayList<OCShare> shares = new ArrayList<OCShare>();
-            for(Object obj: result.getData()) {
-                shares.add((OCShare) obj);
-            }
-            mStorageManager.saveSharesInFolder(shares, mLocalFolder);
-        }
 
-        return result;
-    }
-    
 
     /**
      * Scans the default location for saving local copies of files searching for
-     * a 'lost' file with the same full name as the {@link OCFile} received as 
+     * a 'lost' file with the same full name as the {@link com.owncloud.android.datamodel.OCFile} received as
      * parameter.
      *  
      * @param file      File to associate a possible 'lost' local file.
@@ -580,31 +506,29 @@ public class SynchronizeFolderOperation extends RemoteOperation {
 
     
     /**
-     * Sends a message to any application component interested in the progress 
-     * of the synchronization.
-     * 
-     * @param event
-     * @param dirRemotePath     Remote path of a folder that was just synchronized 
-     *                          (with or without success)
-     * @param result
+     * Cancel operation
      */
-    private void sendLocalBroadcast(
-            String event, String dirRemotePath, RemoteOperationResult result
-        ) {
-        Log_OC.d(TAG, "Send broadcast " + event);
-        Intent intent = new Intent(event);
-        intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, mAccount.name);
-        if (dirRemotePath != null) {
-            intent.putExtra(FileSyncAdapter.EXTRA_FOLDER_PATH, dirRemotePath);
-        }
-        intent.putExtra(FileSyncAdapter.EXTRA_RESULT, result);
-        mContext.sendStickyBroadcast(intent);
-        //LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
+    public void cancel() {
+        mCancellationRequested.set(true);
     }
 
+    public String getFolderPath() {
+        String path = mLocalFolder.getStoragePath();
+        if (path != null && path.length() > 0) {
+            return path;
+        }
+        return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mLocalFolder);
+    }
 
-    public boolean getRemoteFolderChanged() {
-        return mRemoteFolderChanged;
+    private void startSyncFolderOperation(String path){
+        Intent intent = new Intent(mContext, OperationsService.class);
+        intent.setAction(OperationsService.ACTION_SYNC_FOLDER);
+        intent.putExtra(OperationsService.EXTRA_ACCOUNT, mAccount);
+        intent.putExtra(OperationsService.EXTRA_REMOTE_PATH, path);
+        mContext.startService(intent);
     }
 
+    public String getRemotePath() {
+        return mRemotePath;
+    }
 }
index c08c8e5..79370b7 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -35,8 +38,6 @@ import com.owncloud.android.operations.common.SyncOperation;
 /**
  * Unshare file/folder
  * Save the data in Database
- * 
- * @author masensio
  */
 public class UnshareLinkOperation extends SyncOperation {
 
index ac73d96..d2bf5f3 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -38,8 +41,6 @@ import android.content.Context;
 
 /**
  * Remote operation that checks the version of an ownCloud server and stores it locally
- * 
- * @author David A. Velasco
  */
 public class UpdateOCVersionOperation extends RemoteOperation {
 
index 1536a60..cd5f8a1 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -26,6 +29,7 @@ import java.io.OutputStream;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.httpclient.methods.PutMethod;
@@ -55,8 +59,6 @@ import com.owncloud.android.utils.UriUtils;
 
 /**
  * Remote operation performing the upload of a file to an ownCloud server
- * 
- * @author David A. Velasco
  */
 public class UploadFileOperation extends RemoteOperation {
 
@@ -76,7 +78,7 @@ public class UploadFileOperation extends RemoteOperation {
     private String mOriginalStoragePath = null;
     PutMethod mPutMethod = null;
     private Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>();
-    private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
+    private AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
     private Context mContext;
     
     private UploadRemoteFileOperation mUploadOperation;
@@ -212,7 +214,8 @@ public class UploadFileOperation extends RemoteOperation {
 
             // check location of local file; if not the expected, copy to a
             // temporal file before upload (if COPY is the expected behaviour)
-            if (!mOriginalStoragePath.equals(expectedPath) && mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY) {
+            if (!mOriginalStoragePath.equals(expectedPath) &&
+                    mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY) {
 
                 if (FileStorageUtils.getUsableSpace(mAccount.name) < originalFile.length()) {
                     result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_FULL);
@@ -221,7 +224,8 @@ public class UploadFileOperation extends RemoteOperation {
 
                 } else {
 
-                    String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
+                    String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) +
+                            mFile.getRemotePath();
                     mFile.setStoragePath(temporalPath);
                     temporalFile = new File(temporalPath);
 
@@ -251,10 +255,10 @@ public class UploadFileOperation extends RemoteOperation {
                             int nRead;
                             byte[] data = new byte[16384];
 
-                            while ((nRead = in.read(data, 0, data.length)) != -1) {
+                            while (!mCancellationRequested.get() &&
+                                    (nRead = in.read(data, 0, data.length)) != -1) {
                                 out.write(data, 0, nRead);
                             }
-
                             out.flush();
 
                         } else {
@@ -268,12 +272,17 @@ public class UploadFileOperation extends RemoteOperation {
                                 out = new FileOutputStream(temporalFile);
                                 byte[] buf = new byte[1024];
                                 int len;
-                                while ((len = in.read(buf)) > 0) {
+                                while (!mCancellationRequested.get() && (len = in.read(buf)) > 0) {
                                     out.write(buf, 0, len);
                                 }
                             }
                         }
 
+                        if (mCancellationRequested.get()) {
+                            result = new RemoteOperationResult(new OperationCancelledException());
+                        }
+
+
                     } catch (Exception e) {
                         result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED);
                         return result;
@@ -283,63 +292,69 @@ public class UploadFileOperation extends RemoteOperation {
                             if (in != null)
                                 in.close();
                         } catch (Exception e) {
-                            Log_OC.d(TAG, "Weird exception while closing input stream for " + mOriginalStoragePath + " (ignoring)", e);
+                            Log_OC.d(TAG, "Weird exception while closing input stream for " +
+                                    mOriginalStoragePath + " (ignoring)", e);
                         }
                         try {
                             if (out != null)
                                 out.close();
                         } catch (Exception e) {
-                            Log_OC.d(TAG, "Weird exception while closing output stream for " + expectedPath + " (ignoring)", e);
+                            Log_OC.d(TAG, "Weird exception while closing output stream for " +
+                                    expectedPath + " (ignoring)", e);
                         }
                     }
                 }
             }
-            localCopyPassed = true;
+            localCopyPassed = (result == null);
 
             /// perform the upload
-            if ( mChunked && (new File(mFile.getStoragePath())).length() > ChunkedUploadRemoteFileOperation.CHUNK_SIZE ) {
-                mUploadOperation = new ChunkedUploadRemoteFileOperation(mFile.getStoragePath(), mFile.getRemotePath(), 
-                        mFile.getMimetype());
+            if ( mChunked &&
+                    (new File(mFile.getStoragePath())).length() >
+                            ChunkedUploadRemoteFileOperation.CHUNK_SIZE ) {
+                mUploadOperation = new ChunkedUploadRemoteFileOperation(mFile.getStoragePath(),
+                        mFile.getRemotePath(), mFile.getMimetype());
             } else {
-                mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(), mFile.getRemotePath(), 
-                        mFile.getMimetype());
+                mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(),
+                        mFile.getRemotePath(), mFile.getMimetype());
             }
             Iterator <OnDatatransferProgressListener> listener = mDataTransferListeners.iterator();
             while (listener.hasNext()) {
                 mUploadOperation.addDatatransferProgressListener(listener.next());
             }
-            result = mUploadOperation.execute(client);
-
-            /// move local temporal file or original file to its corresponding
-            // location in the ownCloud local folder
-            if (result.isSuccess()) {
-                if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_FORGET) {
-                    mFile.setStoragePath(null);
-
-                } else {
-                    mFile.setStoragePath(expectedPath);
-                    File fileToMove = null;
-                    if (temporalFile != null) { // FileUploader.LOCAL_BEHAVIOUR_COPY
-                                                // ; see where temporalFile was
-                                                // set
-                        fileToMove = temporalFile;
-                    } else { // FileUploader.LOCAL_BEHAVIOUR_MOVE
-                        fileToMove = originalFile;
-                    }
-                    if (!expectedFile.equals(fileToMove)) {
-                        File expectedFolder = expectedFile.getParentFile();
-                        expectedFolder.mkdirs();
-                        if (!expectedFolder.isDirectory() || !fileToMove.renameTo(expectedFile)) {
-                            mFile.setStoragePath(null); // forget the local file
-                            // by now, treat this as a success; the file was
-                            // uploaded; the user won't like that the local file
-                            // is not linked, but this should be a very rare
-                            // fail;
-                            // the best option could be show a warning message
-                            // (but not a fail)
-                            // result = new
-                            // RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_MOVED);
-                            // return result;
+            if (!mCancellationRequested.get()) {
+                result = mUploadOperation.execute(client);
+
+                /// move local temporal file or original file to its corresponding
+                // location in the ownCloud local folder
+                if (result.isSuccess()) {
+                    if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_FORGET) {
+                        mFile.setStoragePath(null);
+
+                    } else {
+                        mFile.setStoragePath(expectedPath);
+                        File fileToMove = null;
+                        if (temporalFile != null) { // FileUploader.LOCAL_BEHAVIOUR_COPY
+                            // ; see where temporalFile was
+                            // set
+                            fileToMove = temporalFile;
+                        } else { // FileUploader.LOCAL_BEHAVIOUR_MOVE
+                            fileToMove = originalFile;
+                        }
+                        if (!expectedFile.equals(fileToMove)) {
+                            File expectedFolder = expectedFile.getParentFile();
+                            expectedFolder.mkdirs();
+                            if (!expectedFolder.isDirectory() || !fileToMove.renameTo(expectedFile)) {
+                                mFile.setStoragePath(null); // forget the local file
+                                // by now, treat this as a success; the file was
+                                // uploaded; the user won't like that the local file
+                                // is not linked, but this should be a very rare
+                                // fail;
+                                // the best option could be show a warning message
+                                // (but not a fail)
+                                // result = new
+                                // RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_MOVED);
+                                // return result;
+                            }
                         }
                     }
                 }
@@ -358,19 +373,23 @@ public class UploadFileOperation extends RemoteOperation {
                 temporalFile.delete();
             }
             if (result.isSuccess()) {
-                Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage());
+                Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " +
+                        result.getLogMessage());
             } else {
                 if (result.getException() != null) {
                     String complement = "";
                     if (!nameCheckPassed) {
                         complement = " (while checking file existence in server)";
                     } else if (!localCopyPassed) {
-                        complement = " (while copying local file to " + FileStorageUtils.getSavePath(mAccount.name)
+                        complement = " (while copying local file to " +
+                                FileStorageUtils.getSavePath(mAccount.name)
                                 + ")";
                     }
-                    Log_OC.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage() + complement, result.getException());
+                    Log_OC.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath +
+                            ": " + result.getLogMessage() + complement, result.getException());
                 } else {
-                    Log_OC.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage());
+                    Log_OC.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath +
+                            ": " + result.getLogMessage());
                 }
             }
         }
@@ -385,7 +404,8 @@ public class UploadFileOperation extends RemoteOperation {
         newFile.setFileLength(mFile.getFileLength());
         newFile.setMimetype(mFile.getMimetype());
         newFile.setModificationTimestamp(mFile.getModificationTimestamp());
-        newFile.setModificationTimestampAtLastSyncForData(mFile.getModificationTimestampAtLastSyncForData());
+        newFile.setModificationTimestampAtLastSyncForData(
+                mFile.getModificationTimestampAtLastSyncForData());
         // newFile.setEtag(mFile.getEtag())
         newFile.setKeepInSync(mFile.keepInSync());
         newFile.setLastSyncDateForProperties(mFile.getLastSyncDateForProperties());
@@ -400,7 +420,8 @@ public class UploadFileOperation extends RemoteOperation {
      * Checks if remotePath does not exist in the server and returns it, or adds
      * a suffix to it in order to avoid the server file is overwritten.
      * 
-     * @param string
+     * @param wc
+     * @param remotePath
      * @return
      */
     private String getAvailableRemotePath(OwnCloudClient wc, String remotePath) throws Exception {
@@ -436,12 +457,16 @@ public class UploadFileOperation extends RemoteOperation {
     }
 
     private boolean existsFile(OwnCloudClient client, String remotePath){
-        ExistenceCheckRemoteOperation existsOperation = new ExistenceCheckRemoteOperation(remotePath, mContext, false);
+        ExistenceCheckRemoteOperation existsOperation =
+                new ExistenceCheckRemoteOperation(remotePath, mContext, false);
         RemoteOperationResult result = existsOperation.execute(client);
         return result.isSuccess();
     }
     
     public void cancel() {
-        mUploadOperation.cancel();
+        mCancellationRequested = new AtomicBoolean(true);
+        if (mUploadOperation != null) {
+            mUploadOperation.cancel();
+        }
     }
 }
index 8c5678b..512be4e 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -32,8 +35,6 @@ import android.os.Handler;
  * with local data in the device.
  * 
  * Provides methods to execute the operation both synchronously or asynchronously.
- * 
- * @author David A. Velasco 
  */
 public abstract class SyncOperation extends RemoteOperation {
        
index 21a8e2c..737c664 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -45,10 +49,6 @@ import android.text.TextUtils;
 
 /**
  * The ContentProvider for the ownCloud App.
- * 
- * @author Bartek Przybylski
- * @author David A. Velasco
- * 
  */
 public class FileContentProvider extends ContentProvider {
 
@@ -97,6 +97,8 @@ public class FileContentProvider extends ContentProvider {
                 ProviderTableMeta.FILE_REMOTE_ID);
         mFileProjectionMap.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL,
                 ProviderTableMeta.FILE_UPDATE_THUMBNAIL);
+        mFileProjectionMap.put(ProviderTableMeta.FILE_IS_DOWNLOADING,
+                ProviderTableMeta.FILE_IS_DOWNLOADING);
     }
 
     private static final int SINGLE_FILE = 1;
@@ -624,7 +626,8 @@ public class FileContentProvider extends ContentProvider {
                     + ProviderTableMeta.FILE_PUBLIC_LINK  + " TEXT, "
                     + ProviderTableMeta.FILE_PERMISSIONS  + " TEXT null,"
                     + ProviderTableMeta.FILE_REMOTE_ID  + " TEXT null,"
-                    + ProviderTableMeta.FILE_UPDATE_THUMBNAIL  + " INTEGER);" //boolean
+                    + ProviderTableMeta.FILE_UPDATE_THUMBNAIL  + " INTEGER," //boolean
+                    + ProviderTableMeta.FILE_IS_DOWNLOADING  + " INTEGER);" //boolean
                     );
             
             // Create table ocshares
@@ -795,7 +798,25 @@ public class FileContentProvider extends ContentProvider {
                 }
             }
             if (!upgraded)
-                Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + 
+                Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion +
+                        ", newVersion == " + newVersion);
+
+            if (oldVersion < 9 && newVersion >= 9) {
+                Log_OC.i("SQL", "Entering in the #9 ADD in onUpgrade");
+                db.beginTransaction();
+                try {
+                    db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME +
+                            " ADD COLUMN " + ProviderTableMeta.FILE_IS_DOWNLOADING + " INTEGER " +
+                            " DEFAULT 0");
+
+                    upgraded = true;
+                    db.setTransactionSuccessful();
+                } finally {
+                    db.endTransaction();
+                }
+            }
+            if (!upgraded)
+                Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion +
                         ", newVersion == " + newVersion);
         }
     }
index 16c4dcc..a4bc8f6 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -26,6 +28,7 @@ import java.util.concurrent.ConcurrentMap;
 import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudAccount;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
@@ -36,7 +39,6 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
 import com.owncloud.android.operations.common.SyncOperation;
@@ -48,6 +50,7 @@ import com.owncloud.android.operations.OAuth2GetAccessToken;
 import com.owncloud.android.operations.RemoveFileOperation;
 import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
+import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
 
 import android.accounts.Account;
@@ -81,31 +84,25 @@ public class OperationsService extends Service {
     public static final String EXTRA_SYNC_FILE_CONTENTS = "SYNC_FILE_CONTENTS";
     public static final String EXTRA_RESULT = "RESULT";
     public static final String EXTRA_NEW_PARENT_PATH = "NEW_PARENT_PATH";
-    
-    // TODO review if ALL OF THEM are necessary
-    public static final String EXTRA_SUCCESS_IF_ABSENT = "SUCCESS_IF_ABSENT";
-    public static final String EXTRA_USERNAME = "USERNAME";
-    public static final String EXTRA_PASSWORD = "PASSWORD";
-    public static final String EXTRA_AUTH_TOKEN = "AUTH_TOKEN";
+    public static final String EXTRA_FILE = "FILE";
+
     public static final String EXTRA_COOKIE = "COOKIE";
     
     public static final String ACTION_CREATE_SHARE = "CREATE_SHARE";
     public static final String ACTION_UNSHARE = "UNSHARE";
     public static final String ACTION_GET_SERVER_INFO = "GET_SERVER_INFO";
     public static final String ACTION_OAUTH2_GET_ACCESS_TOKEN = "OAUTH2_GET_ACCESS_TOKEN";
-    public static final String ACTION_EXISTENCE_CHECK = "EXISTENCE_CHECK";
     public static final String ACTION_GET_USER_NAME = "GET_USER_NAME";
     public static final String ACTION_RENAME = "RENAME";
     public static final String ACTION_REMOVE = "REMOVE";
     public static final String ACTION_CREATE_FOLDER = "CREATE_FOLDER";
     public static final String ACTION_SYNC_FILE = "SYNC_FILE";
+    public static final String ACTION_SYNC_FOLDER = "SYNC_FOLDER";  // for the moment, just to download
     public static final String ACTION_MOVE_FILE = "MOVE_FILE";
     
     public static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() + ".OPERATION_ADDED";
     public static final String ACTION_OPERATION_FINISHED = OperationsService.class.getName() + ".OPERATION_FINISHED";
 
-    private ConcurrentLinkedQueue<Pair<Target, RemoteOperation>> mPendingOperations = 
-            new ConcurrentLinkedQueue<Pair<Target, RemoteOperation>>();
 
     private ConcurrentMap<Integer, Pair<RemoteOperation, RemoteOperationResult>> 
         mUndispatchedFinishedOperations =
@@ -114,30 +111,19 @@ public class OperationsService extends Service {
     private static class Target {
         public Uri mServerUrl = null;
         public Account mAccount = null;
-        public String mUsername = null;
-        public String mPassword = null;
-        public String mAuthToken = null;
         public String mCookie = null;
         
-        public Target(Account account, Uri serverUrl, String username, String password, String authToken,
-                String cookie) {
+        public Target(Account account, Uri serverUrl, String cookie) {
             mAccount = account;
             mServerUrl = serverUrl;
-            mUsername = username;
-            mPassword = password;
-            mAuthToken = authToken;
             mCookie = cookie;
         }
     }
 
-    private Looper mServiceLooper;
-    private ServiceHandler mServiceHandler;
-    private OperationsServiceBinder mBinder;
-    private OwnCloudClient mOwnCloudClient = null;
-    private Target mLastTarget = null;
-    private FileDataStorageManager mStorageManager;
-    private RemoteOperation mCurrentOperation = null;
+    private ServiceHandler mOperationsHandler;
+    private OperationsServiceBinder mOperationsBinder;
     
+    private SyncFolderHandler mSyncFolderHandler;
     
     /**
      * Service initialization
@@ -145,11 +131,18 @@ public class OperationsService extends Service {
     @Override
     public void onCreate() {
         super.onCreate();
-        HandlerThread thread = new HandlerThread("Operations service thread", Process.THREAD_PRIORITY_BACKGROUND);
+        Log_OC.d(TAG, "Creating service");
+
+        /// First worker thread for most of operations 
+        HandlerThread thread = new HandlerThread("Operations thread", Process.THREAD_PRIORITY_BACKGROUND);
+        thread.start();
+        mOperationsHandler = new ServiceHandler(thread.getLooper(), this);
+        mOperationsBinder = new OperationsServiceBinder(mOperationsHandler);
+        
+        /// Separated worker thread for download of folders (WIP)
+        thread = new HandlerThread("Syncfolder thread", Process.THREAD_PRIORITY_BACKGROUND);
         thread.start();
-        mServiceLooper = thread.getLooper();
-        mServiceHandler = new ServiceHandler(mServiceLooper, this);
-        mBinder = new OperationsServiceBinder();
+        mSyncFolderHandler = new SyncFolderHandler(thread.getLooper(), this);
     }
 
     
@@ -158,23 +151,45 @@ public class OperationsService extends Service {
      * 
      * New operations are added calling to startService(), resulting in a call to this method. 
      * This ensures the service will keep on working although the caller activity goes away.
-     * 
-     * IMPORTANT: the only operations performed here right now is {@link GetSharedFilesOperation}. The class
-     * is taking advantage of it due to time constraints.
      */
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
-        //Log_OC.wtf(TAG, "onStartCommand init" );
-        Message msg = mServiceHandler.obtainMessage();
-        msg.arg1 = startId;
-        mServiceHandler.sendMessage(msg);
-        //Log_OC.wtf(TAG, "onStartCommand end" );
+        Log_OC.d(TAG, "Starting command with id " + startId);
+
+        // WIP: for the moment, only SYNC_FOLDER is expected here;
+        // the rest of the operations are requested through the Binder
+        if (ACTION_SYNC_FOLDER.equals(intent.getAction())) {
+
+            if (!intent.hasExtra(EXTRA_ACCOUNT) || !intent.hasExtra(EXTRA_REMOTE_PATH)) {
+                Log_OC.e(TAG, "Not enough information provided in intent");
+                return START_NOT_STICKY;
+            }
+            Account account = intent.getParcelableExtra(EXTRA_ACCOUNT);
+            String remotePath = intent.getStringExtra(EXTRA_REMOTE_PATH);
+
+            Pair<Account, String> itemSyncKey =  new Pair<Account , String>(account, remotePath);
+
+            Pair<Target, RemoteOperation> itemToQueue = newOperation(intent);
+            if (itemToQueue != null) {
+                mSyncFolderHandler.add(account, remotePath, (SynchronizeFolderOperation)itemToQueue.second);
+                Message msg = mSyncFolderHandler.obtainMessage();
+                msg.arg1 = startId;
+                msg.obj = itemSyncKey;
+                mSyncFolderHandler.sendMessage(msg);
+            }
+
+        } else {
+            Message msg = mOperationsHandler.obtainMessage();
+            msg.arg1 = startId;
+            mOperationsHandler.sendMessage(msg);
+        }
+        
         return START_NOT_STICKY;
     }
 
     @Override
     public void onDestroy() {
-        //Log_OC.wtf(TAG, "onDestroy init" );
+        Log_OC.v(TAG, "Destroying service" );
         // Saving cookies
         try {
             OwnCloudClientManagerFactory.getDefaultSingleton().
@@ -191,14 +206,19 @@ public class OperationsService extends Service {
             e.printStackTrace();
         }
         
-        //Log_OC.wtf(TAG, "Clear mUndispatchedFinisiedOperations" );
         mUndispatchedFinishedOperations.clear();
-        
-        //Log_OC.wtf(TAG, "onDestroy end" );
+
+        mOperationsBinder = null;
+
+        mOperationsHandler.getLooper().quit();
+        mOperationsHandler = null;
+
+        mSyncFolderHandler.getLooper().quit();
+        mSyncFolderHandler = null;
+
         super.onDestroy();
     }
 
-
     /**
      * Provides a binder object that clients can use to perform actions on the queue of operations, 
      * except the addition of new operations. 
@@ -206,7 +226,7 @@ public class OperationsService extends Service {
     @Override
     public IBinder onBind(Intent intent) {
         //Log_OC.wtf(TAG, "onBind" );
-        return mBinder;
+        return mOperationsBinder;
     }
 
     
@@ -215,11 +235,11 @@ public class OperationsService extends Service {
      */
     @Override
     public boolean onUnbind(Intent intent) {
-        ((OperationsServiceBinder)mBinder).clearListeners();
+        mOperationsBinder.clearListeners();
         return false;   // not accepting rebinding (default behaviour)
     }
 
-    
+
     /**
      *  Binder to let client components to perform actions on the queue of operations.
      * 
@@ -233,16 +253,24 @@ public class OperationsService extends Service {
         private ConcurrentMap<OnRemoteOperationListener, Handler> mBoundListeners = 
                 new ConcurrentHashMap<OnRemoteOperationListener, Handler>();
         
+        private ServiceHandler mServiceHandler = null;   
+
+        public OperationsServiceBinder(ServiceHandler serviceHandler) {
+            mServiceHandler = serviceHandler;
+        }
+
+
         /**
-         * Cancels an operation
+         * Cancels a pending or current synchronization.
          *
-         * TODO
+         * @param account       ownCloud account where the remote folder is stored.
+         * @param file          A folder in the queue of pending synchronizations
          */
-        public void cancel() {
-            // TODO
+        public void cancel(Account account, OCFile file) {
+            mSyncFolderHandler.cancel(account, file);
         }
-        
-        
+
+
         public void clearListeners() {
             
             mBoundListeners.clear();
@@ -280,131 +308,31 @@ public class OperationsService extends Service {
          * @return  'True' when an operation that enforces the user to wait for completion is in process.
          */
         public boolean isPerformingBlockingOperation() {
-            return (!mPendingOperations.isEmpty());
+            return (!mServiceHandler.mPendingOperations.isEmpty());
         }
 
 
         /**
-         * Creates and adds to the queue a new operation, as described by operationIntent
+         * Creates and adds to the queue a new operation, as described by operationIntent.
+         * 
+         * Calls startService to make the operation is processed by the ServiceHandler.
          * 
          * @param operationIntent       Intent describing a new operation to queue and execute.
          * @return                      Identifier of the operation created, or null if failed.
          */
-        public long newOperation(Intent operationIntent) {
-            RemoteOperation operation = null;
-            Target target = null;
-            try {
-                if (!operationIntent.hasExtra(EXTRA_ACCOUNT) && 
-                        !operationIntent.hasExtra(EXTRA_SERVER_URL)) {
-                    Log_OC.e(TAG, "Not enough information provided in intent");
-                    
-                } else {
-                    Account account = operationIntent.getParcelableExtra(EXTRA_ACCOUNT);
-                    String serverUrl = operationIntent.getStringExtra(EXTRA_SERVER_URL);
-                    String username = operationIntent.getStringExtra(EXTRA_USERNAME);
-                    String password = operationIntent.getStringExtra(EXTRA_PASSWORD);
-                    String authToken = operationIntent.getStringExtra(EXTRA_AUTH_TOKEN);
-                    String cookie = operationIntent.getStringExtra(EXTRA_COOKIE);
-                    target = new Target(
-                            account, 
-                            (serverUrl == null) ? null : Uri.parse(serverUrl),
-                            username,
-                            password,
-                            authToken,
-                            cookie
-                    );
-                    
-                    String action = operationIntent.getAction();
-                    if (action.equals(ACTION_CREATE_SHARE)) {  // Create Share
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        Intent sendIntent = operationIntent.getParcelableExtra(EXTRA_SEND_INTENT);
-                        if (remotePath.length() > 0) {
-                            operation = new CreateShareOperation(remotePath, ShareType.PUBLIC_LINK, 
-                                    "", false, "", 1, sendIntent);
-                        }
-                        
-                    } else if (action.equals(ACTION_UNSHARE)) {  // Unshare file
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        if (remotePath.length() > 0) {
-                            operation = new UnshareLinkOperation(
-                                    remotePath, 
-                                    OperationsService.this);
-                        }
-                        
-                    } else if (action.equals(ACTION_GET_SERVER_INFO)) { 
-                        // check OC server and get basic information from it
-                        operation = new GetServerInfoOperation(serverUrl, OperationsService.this);
-                        
-                    } else if (action.equals(ACTION_OAUTH2_GET_ACCESS_TOKEN)) {
-                        /// GET ACCESS TOKEN to the OAuth server
-                        String oauth2QueryParameters =
-                                operationIntent.getStringExtra(EXTRA_OAUTH2_QUERY_PARAMETERS);
-                        operation = new OAuth2GetAccessToken(
-                                getString(R.string.oauth2_client_id), 
-                                getString(R.string.oauth2_redirect_uri),       
-                                getString(R.string.oauth2_grant_type),
-                                oauth2QueryParameters);
-                        
-                    } else if (action.equals(ACTION_EXISTENCE_CHECK)) {
-                        // Existence Check 
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        boolean successIfAbsent = operationIntent.getBooleanExtra(EXTRA_SUCCESS_IF_ABSENT, false);
-                        operation = new ExistenceCheckRemoteOperation(remotePath, OperationsService.this, successIfAbsent);
-                        
-                    } else if (action.equals(ACTION_GET_USER_NAME)) {
-                        // Get User Name
-                        operation = new GetRemoteUserNameOperation();
-                        
-                    } else if (action.equals(ACTION_RENAME)) {
-                        // Rename file or folder
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        String newName = operationIntent.getStringExtra(EXTRA_NEWNAME);
-                        operation = new RenameFileOperation(remotePath, newName);
-                        
-                    } else if (action.equals(ACTION_REMOVE)) {
-                        // Remove file or folder
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        boolean onlyLocalCopy = operationIntent.getBooleanExtra(EXTRA_REMOVE_ONLY_LOCAL, false);
-                        operation = new RemoveFileOperation(remotePath, onlyLocalCopy);
-                        
-                    } else if (action.equals(ACTION_CREATE_FOLDER)) {
-                        // Create Folder
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        boolean createFullPath = operationIntent.getBooleanExtra(EXTRA_CREATE_FULL_PATH, true);
-                        operation = new CreateFolderOperation(remotePath, createFullPath);
-                        
-                    } else if (action.equals(ACTION_SYNC_FILE)) {
-                        // Sync file
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        boolean syncFileContents = operationIntent.getBooleanExtra(EXTRA_SYNC_FILE_CONTENTS, true);
-                        operation = new SynchronizeFileOperation(remotePath, account, syncFileContents, getApplicationContext());
-                    } else if (action.equals(ACTION_MOVE_FILE)) {
-                        // Move file/folder
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        String newParentPath = operationIntent.getStringExtra(EXTRA_NEW_PARENT_PATH);
-                        operation = new MoveFileOperation(remotePath,newParentPath,account);
-                    }
-                    
-                }
-                    
-            } catch (IllegalArgumentException e) {
-                Log_OC.e(TAG, "Bad information provided in intent: " + e.getMessage());
-                operation = null;
-            }
-
-            if (operation != null) {
-                mPendingOperations.add(new Pair<Target , RemoteOperation>(target, operation));
+        public long queueNewOperation(Intent operationIntent) {
+            Pair<Target, RemoteOperation> itemToQueue = newOperation(operationIntent);
+            if (itemToQueue != null) {
+                mServiceHandler.mPendingOperations.add(itemToQueue);
                 startService(new Intent(OperationsService.this, OperationsService.class));
-                //Log_OC.wtf(TAG, "New operation added, opId: " + operation.hashCode());
-                // better id than hash? ; should be good enough by the time being
-                return operation.hashCode();
+                return itemToQueue.second.hashCode();
                 
             } else {
-                //Log_OC.wtf(TAG, "New operation failed, returned Long.MAX_VALUE");
                 return Long.MAX_VALUE;
             }
         }
-
+        
+        
         public boolean dispatchResultIfFinished(int operationId, OnRemoteOperationListener listener) {
             Pair<RemoteOperation, RemoteOperationResult> undispatched = 
                     mUndispatchedFinishedOperations.remove(operationId);
@@ -413,7 +341,7 @@ public class OperationsService extends Service {
                 return true;
                 //Log_OC.wtf(TAG, "Sending callback later");
             } else {
-                if (!mPendingOperations.isEmpty()) {
+                if (!mServiceHandler.mPendingOperations.isEmpty()) {
                     return true;
                 } else {
                     return false;
@@ -421,18 +349,46 @@ public class OperationsService extends Service {
                 //Log_OC.wtf(TAG, "Not finished yet");
             }
         }
+        
+        
+        /**
+         * Returns True when the file described by 'file' in the ownCloud account 'account' is downloading or waiting
+         * to download.
+         * 
+         * If 'file' is a directory, returns 'true' if some of its descendant files is downloading or waiting
+         * to download.
+         * 
+         * @param account       ownCloud account where the remote file is stored.
+         * @param remotePath    Path of the folder to check if something is synchronizing / downloading / uploading
+         *                      inside.
+         */
+        public boolean isSynchronizing(Account account, String remotePath) {
+            return mSyncFolderHandler.isSynchronizing(account, remotePath);
+        }
 
     }
-    
-    
-    /** 
+
+
+    /**
      * Operations worker. Performs the pending operations in the order they were requested. 
      * 
      * Created with the Looper of a new thread, started in {@link OperationsService#onCreate()}. 
      */
     private static class ServiceHandler extends Handler {
         // don't make it a final class, and don't remove the static ; lint will warn about a possible memory leak
+        
+        
         OperationsService mService;
+        
+        
+        private ConcurrentLinkedQueue<Pair<Target, RemoteOperation>> mPendingOperations =
+                new ConcurrentLinkedQueue<Pair<Target, RemoteOperation>>();
+        private RemoteOperation mCurrentOperation = null;
+        private Target mLastTarget = null;
+        private OwnCloudClient mOwnCloudClient = null;
+        private FileDataStorageManager mStorageManager;
+        
+        
         public ServiceHandler(Looper looper, OperationsService service) {
             super(looper);
             if (service == null) {
@@ -443,107 +399,221 @@ public class OperationsService extends Service {
 
         @Override
         public void handleMessage(Message msg) {
-            mService.nextOperation();
+            nextOperation();
+            Log_OC.d(TAG, "Stopping after command with id " + msg.arg1);
             mService.stopSelf(msg.arg1);
         }
-    }
-    
-
-    /**
-     * Performs the next operation in the queue
-     */
-    private void nextOperation() {
         
-        //Log_OC.wtf(TAG, "nextOperation init" );
         
-        Pair<Target, RemoteOperation> next = null;
-        synchronized(mPendingOperations) {
-            next = mPendingOperations.peek();
-        }
-
-        if (next != null) {
+        /**
+         * Performs the next operation in the queue
+         */
+        private void nextOperation() {
             
-            mCurrentOperation = next.second;
-            RemoteOperationResult result = null;
-            try {
-                /// prepare client object to send the request to the ownCloud server
-                if (mLastTarget == null || !mLastTarget.equals(next.first)) {
-                    mLastTarget = next.first;
-                    if (mLastTarget.mAccount != null) {
-                        OwnCloudAccount ocAccount = new OwnCloudAccount(mLastTarget.mAccount, this);
-                        mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                                getClientFor(ocAccount, this);
-                        mStorageManager = 
-                                new FileDataStorageManager(
-                                        mLastTarget.mAccount, 
-                                        getContentResolver());
-                    } else {
-                        OwnCloudCredentials credentials = null;
-                        if (mLastTarget.mUsername != null && 
-                                mLastTarget.mUsername.length() > 0) {
-                            credentials = OwnCloudCredentialsFactory.newBasicCredentials(
-                                    mLastTarget.mUsername, 
-                                    mLastTarget.mPassword);  // basic
-                            
-                        } else if (mLastTarget.mAuthToken != null && 
-                                mLastTarget.mAuthToken.length() > 0) {
-                            credentials = OwnCloudCredentialsFactory.newBearerCredentials(
-                                    mLastTarget.mAuthToken);  // bearer token
-                            
-                        } else if (mLastTarget.mCookie != null &&
-                                mLastTarget.mCookie.length() > 0) {
-                            credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials(
-                                    mLastTarget.mCookie); // SAML SSO
+            //Log_OC.wtf(TAG, "nextOperation init" );
+            
+            Pair<Target, RemoteOperation> next = null;
+            synchronized(mPendingOperations) {
+                next = mPendingOperations.peek();
+            }
+
+            if (next != null) {
+                
+                mCurrentOperation = next.second;
+                RemoteOperationResult result = null;
+                try {
+                    /// prepare client object to send the request to the ownCloud server
+                    if (mLastTarget == null || !mLastTarget.equals(next.first)) {
+                        mLastTarget = next.first;
+                        if (mLastTarget.mAccount != null) {
+                            OwnCloudAccount ocAccount = new OwnCloudAccount(mLastTarget.mAccount, mService);
+                            mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
+                                    getClientFor(ocAccount, mService);
+                            mStorageManager = new FileDataStorageManager(
+                                    mLastTarget.mAccount, 
+                                    mService.getContentResolver()
+                            );
+                        } else {
+                            OwnCloudCredentials credentials = null;
+                            if (mLastTarget.mCookie != null &&
+                                    mLastTarget.mCookie.length() > 0) {
+                                // just used for GetUserName
+                                // TODO refactor to run GetUserName as AsyncTask in the context of AuthenticatorActivity
+                                credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials(
+                                        mLastTarget.mCookie); // SAML SSO
+                            }
+                            OwnCloudAccount ocAccount = new OwnCloudAccount(
+                                    mLastTarget.mServerUrl, credentials);
+                            mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
+                                    getClientFor(ocAccount, mService);
+                            mStorageManager = null;
                         }
-                        OwnCloudAccount ocAccount = new OwnCloudAccount(
-                                mLastTarget.mServerUrl, credentials);
-                        mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
-                                getClientFor(ocAccount, this);
-                        mStorageManager = null;
                     }
-                }
 
-                /// perform the operation
-                if (mCurrentOperation instanceof SyncOperation) {
-                    result = ((SyncOperation)mCurrentOperation).execute(mOwnCloudClient, mStorageManager);
-                } else {
-                    result = mCurrentOperation.execute(mOwnCloudClient);
-                }
+                    /// perform the operation
+                    if (mCurrentOperation instanceof SyncOperation) {
+                        result = ((SyncOperation)mCurrentOperation).execute(mOwnCloudClient, mStorageManager);
+                    } else {
+                        result = mCurrentOperation.execute(mOwnCloudClient);
+                    }
+                    
+                } catch (AccountsException e) {
+                    if (mLastTarget.mAccount == null) {
+                        Log_OC.e(TAG, "Error while trying to get authorization for a NULL account", e);
+                    } else {
+                        Log_OC.e(TAG, "Error while trying to get authorization for " + mLastTarget.mAccount.name, e);
+                    }
+                    result = new RemoteOperationResult(e);
+                    
+                } catch (IOException e) {
+                    if (mLastTarget.mAccount == null) {
+                        Log_OC.e(TAG, "Error while trying to get authorization for a NULL account", e);
+                    } else {
+                        Log_OC.e(TAG, "Error while trying to get authorization for " + mLastTarget.mAccount.name, e);
+                    }
+                    result = new RemoteOperationResult(e);
+                } catch (Exception e) {
+                    if (mLastTarget.mAccount == null) {
+                        Log_OC.e(TAG, "Unexpected error for a NULL account", e);
+                    } else {
+                        Log_OC.e(TAG, "Unexpected error for " + mLastTarget.mAccount.name, e);
+                    }
+                    result = new RemoteOperationResult(e);
                 
-            } catch (AccountsException e) {
-                if (mLastTarget.mAccount == null) {
-                    Log_OC.e(TAG, "Error while trying to get authorization for a NULL account", e);
-                } else {
-                    Log_OC.e(TAG, "Error while trying to get authorization for " + mLastTarget.mAccount.name, e);
+                } finally {
+                    synchronized(mPendingOperations) {
+                        mPendingOperations.poll();
+                    }
                 }
-                result = new RemoteOperationResult(e);
                 
-            } catch (IOException e) {
-                if (mLastTarget.mAccount == null) {
-                    Log_OC.e(TAG, "Error while trying to get authorization for a NULL account", e);
-                } else {
-                    Log_OC.e(TAG, "Error while trying to get authorization for " + mLastTarget.mAccount.name, e);
-                }
-                result = new RemoteOperationResult(e);
-            } catch (Exception e) {
-                if (mLastTarget.mAccount == null) {
-                    Log_OC.e(TAG, "Unexpected error for a NULL account", e);
-                } else {
-                    Log_OC.e(TAG, "Unexpected error for " + mLastTarget.mAccount.name, e);
-                }
-                result = new RemoteOperationResult(e);
-            
-            } finally {
-                synchronized(mPendingOperations) {
-                    mPendingOperations.poll();
-                }
+                //sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
+                mService.dispatchResultToOperationListeners(mCurrentOperation, result);
             }
-            
-            //sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
-            dispatchResultToOperationListeners(mLastTarget, mCurrentOperation, result);
         }
+
+
+        
     }
+    
+
+    /**
+     * Creates a new operation, as described by operationIntent.
+     * 
+     * TODO - move to ServiceHandler (probably)
+     * 
+     * @param operationIntent       Intent describing a new operation to queue and execute.
+     * @return                      Pair with the new operation object and the information about its target server.
+     */
+    private Pair<Target , RemoteOperation> newOperation(Intent operationIntent) {
+        RemoteOperation operation = null;
+        Target target = null;
+        try {
+            if (!operationIntent.hasExtra(EXTRA_ACCOUNT) && 
+                    !operationIntent.hasExtra(EXTRA_SERVER_URL)) {
+                Log_OC.e(TAG, "Not enough information provided in intent");
+                
+            } else {
+                Account account = operationIntent.getParcelableExtra(EXTRA_ACCOUNT);
+                String serverUrl = operationIntent.getStringExtra(EXTRA_SERVER_URL);
+                String cookie = operationIntent.getStringExtra(EXTRA_COOKIE);
+                target = new Target(
+                        account, 
+                        (serverUrl == null) ? null : Uri.parse(serverUrl),
+                        cookie
+                );
+                
+                String action = operationIntent.getAction();
+                if (action.equals(ACTION_CREATE_SHARE)) {  // Create Share
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    Intent sendIntent = operationIntent.getParcelableExtra(EXTRA_SEND_INTENT);
+                    if (remotePath.length() > 0) {
+                        operation = new CreateShareOperation(OperationsService.this, remotePath, ShareType.PUBLIC_LINK,
+                                "", false, "", 1, sendIntent);
+                    }
+                    
+                } else if (action.equals(ACTION_UNSHARE)) {  // Unshare file
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    if (remotePath.length() > 0) {
+                        operation = new UnshareLinkOperation(
+                                remotePath, 
+                                OperationsService.this);
+                    }
+                    
+                } else if (action.equals(ACTION_GET_SERVER_INFO)) { 
+                    // check OC server and get basic information from it
+                    operation = new GetServerInfoOperation(serverUrl, OperationsService.this);
+                    
+                } else if (action.equals(ACTION_OAUTH2_GET_ACCESS_TOKEN)) {
+                    /// GET ACCESS TOKEN to the OAuth server
+                    String oauth2QueryParameters =
+                            operationIntent.getStringExtra(EXTRA_OAUTH2_QUERY_PARAMETERS);
+                    operation = new OAuth2GetAccessToken(
+                            getString(R.string.oauth2_client_id), 
+                            getString(R.string.oauth2_redirect_uri),       
+                            getString(R.string.oauth2_grant_type),
+                            oauth2QueryParameters);
+                    
+                } else if (action.equals(ACTION_GET_USER_NAME)) {
+                    // Get User Name
+                    operation = new GetRemoteUserNameOperation();
+                    
+                } else if (action.equals(ACTION_RENAME)) {
+                    // Rename file or folder
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    String newName = operationIntent.getStringExtra(EXTRA_NEWNAME);
+                    operation = new RenameFileOperation(remotePath, newName);
+                    
+                } else if (action.equals(ACTION_REMOVE)) {
+                    // Remove file or folder
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    boolean onlyLocalCopy = operationIntent.getBooleanExtra(EXTRA_REMOVE_ONLY_LOCAL, false);
+                    operation = new RemoveFileOperation(remotePath, onlyLocalCopy);
+                    
+                } else if (action.equals(ACTION_CREATE_FOLDER)) {
+                    // Create Folder
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    boolean createFullPath = operationIntent.getBooleanExtra(EXTRA_CREATE_FULL_PATH, true);
+                    operation = new CreateFolderOperation(remotePath, createFullPath);
+                    
+                } else if (action.equals(ACTION_SYNC_FILE)) {
+                    // Sync file
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    boolean syncFileContents = operationIntent.getBooleanExtra(EXTRA_SYNC_FILE_CONTENTS, true);
+                    operation = new SynchronizeFileOperation(
+                            remotePath, account, syncFileContents, getApplicationContext()
+                    );
+                    
+                } else if (action.equals(ACTION_SYNC_FOLDER)) {
+                    // Sync file
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    operation = new SynchronizeFolderOperation(
+                            this,                       // TODO remove this dependency from construction time 
+                            remotePath,
+                            account, 
+                            System.currentTimeMillis()  // TODO remove this dependency from construction time
+                    );
+                    
+                } else if (action.equals(ACTION_MOVE_FILE)) {
+                    // Move file/folder
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    String newParentPath = operationIntent.getStringExtra(EXTRA_NEW_PARENT_PATH);
+                    operation = new MoveFileOperation(remotePath,newParentPath,account);
+                }
+                
+            }
+                
+        } catch (IllegalArgumentException e) {
+            Log_OC.e(TAG, "Bad information provided in intent: " + e.getMessage());
+            operation = null;
+        }
 
+        if (operation != null) {
+            return new Pair<Target , RemoteOperation>(target, operation);  
+        } else {
+            return null;
+        }
+    }
+    
 
     /**
      * Sends a broadcast when a new operation is added to the queue.
@@ -593,18 +663,18 @@ public class OperationsService extends Service {
     
     /**
      * Notifies the currently subscribed listeners about the end of an operation.
-     * 
-     * @param target            Account or URL pointing to an OC server.
+     *
      * @param operation         Finished operation.
      * @param result            Result of the operation.
      */
-    private void dispatchResultToOperationListeners(
-            Target target, final RemoteOperation operation, final RemoteOperationResult result) {
+    protected void dispatchResultToOperationListeners(
+            final RemoteOperation operation, final RemoteOperationResult result
+    ) {
         int count = 0;
-        Iterator<OnRemoteOperationListener> listeners = mBinder.mBoundListeners.keySet().iterator();
+        Iterator<OnRemoteOperationListener> listeners = mOperationsBinder.mBoundListeners.keySet().iterator();
         while (listeners.hasNext()) {
             final OnRemoteOperationListener listener = listeners.next();
-            final Handler handler = mBinder.mBoundListeners.get(listener);
+            final Handler handler = mOperationsBinder.mBoundListeners.get(listener);
             if (handler != null) { 
                 handler.post(new Runnable() {
                     @Override
@@ -623,6 +693,4 @@ public class OperationsService extends Service {
         }
         Log_OC.d(TAG, "Called " + count + " listeners");
     }
-    
-
 }
diff --git a/src/com/owncloud/android/services/SyncFolderHandler.java b/src/com/owncloud/android/services/SyncFolderHandler.java
new file mode 100644 (file)
index 0000000..57271eb
--- /dev/null
@@ -0,0 +1,198 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.services;
+
+import android.accounts.Account;
+import android.accounts.AccountsException;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.util.Pair;
+
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.files.services.FileDownloader;
+import com.owncloud.android.files.services.IndexedForest;
+import com.owncloud.android.lib.common.OwnCloudAccount;
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.operations.SynchronizeFolderOperation;
+import com.owncloud.android.utils.FileStorageUtils;
+
+import java.io.IOException;
+
+/**
+ * SyncFolder worker. Performs the pending operations in the order they were requested.
+ *
+ * Created with the Looper of a new thread, started in
+ * {@link com.owncloud.android.services.OperationsService#onCreate()}.
+ */
+class SyncFolderHandler extends Handler {
+
+    private static final String TAG = SyncFolderHandler.class.getSimpleName();
+
+
+    OperationsService mService;
+
+    private IndexedForest<SynchronizeFolderOperation> mPendingOperations =
+            new IndexedForest<SynchronizeFolderOperation>();
+
+    private OwnCloudClient mOwnCloudClient = null;
+    private Account mCurrentAccount = null;
+    private FileDataStorageManager mStorageManager;
+    private SynchronizeFolderOperation mCurrentSyncOperation;
+
+
+    public SyncFolderHandler(Looper looper, OperationsService service) {
+        super(looper);
+        if (service == null) {
+            throw new IllegalArgumentException("Received invalid NULL in parameter 'service'");
+        }
+        mService = service;
+    }
+
+
+    /**
+     * Returns True when the folder located in 'remotePath' in the ownCloud account 'account', or any of its
+     * descendants, is being synchronized (or waiting for it).
+     *
+     * @param account       ownCloud account where the remote folder is stored.
+     * @param remotePath    The path to a folder that could be in the queue of synchronizations.
+     */
+    public boolean isSynchronizing(Account account, String remotePath) {
+        if (account == null || remotePath == null) return false;
+        return (mPendingOperations.contains(account, remotePath));
+    }
+
+
+    @Override
+    public void handleMessage(Message msg) {
+        Pair<Account, String> itemSyncKey = (Pair<Account, String>) msg.obj;
+        doOperation(itemSyncKey.first, itemSyncKey.second);
+        Log_OC.d(TAG, "Stopping after command with id " + msg.arg1);
+        mService.stopSelf(msg.arg1);
+    }
+
+
+    /**
+     * Performs the next operation in the queue
+     */
+    private void doOperation(Account account, String remotePath) {
+
+        mCurrentSyncOperation = mPendingOperations.get(account, remotePath);
+
+        if (mCurrentSyncOperation != null) {
+            RemoteOperationResult result = null;
+
+            try {
+
+                if (mCurrentAccount == null || !mCurrentAccount.equals(account)) {
+                    mCurrentAccount = account;
+                    mStorageManager = new FileDataStorageManager(
+                            account,
+                            mService.getContentResolver()
+                    );
+                }   // else, reuse storage manager from previous operation
+
+                // always get client from client manager, to get fresh credentials in case of update
+                OwnCloudAccount ocAccount = new OwnCloudAccount(account, mService);
+                mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
+                        getClientFor(ocAccount, mService);
+
+                result = mCurrentSyncOperation.execute(mOwnCloudClient, mStorageManager);
+
+            } catch (AccountsException e) {
+                Log_OC.e(TAG, "Error while trying to get authorization", e);
+            } catch (IOException e) {
+                Log_OC.e(TAG, "Error while trying to get authorization", e);
+            } finally {
+                mPendingOperations.removePayload(account, remotePath);
+
+                mService.dispatchResultToOperationListeners(mCurrentSyncOperation, result);
+
+                sendBroadcastFinishedSyncFolder(account, remotePath, result.isSuccess());
+            }
+        }
+    }
+
+    public void add(Account account, String remotePath, SynchronizeFolderOperation syncFolderOperation){
+        mPendingOperations.putIfAbsent(account, remotePath, syncFolderOperation);
+        sendBroadcastNewSyncFolder(account, remotePath);    // TODO upgrade!
+    }
+
+
+    /**
+     * Cancels a pending or current sync' operation.
+     *
+     * @param account       ownCloud account where the remote file is stored.
+     * @param file          A file in the queue of pending synchronizations
+     */
+    public void cancel(Account account, OCFile file){
+        if (account == null || file == null) {
+            Log_OC.e(TAG, "Cannot cancel with NULL parameters");
+            return;
+        }
+        Pair<SynchronizeFolderOperation, String> removeResult =
+                mPendingOperations.remove(account, file.getRemotePath());
+        SynchronizeFolderOperation synchronization = removeResult.first;
+        if (synchronization != null) {
+            synchronization.cancel();
+        } else {
+            // TODO synchronize?
+            if (mCurrentSyncOperation != null && mCurrentAccount != null &&
+                    mCurrentSyncOperation.getRemotePath().startsWith(file.getRemotePath()) &&
+                    account.name.equals(mCurrentAccount.name)) {
+                mCurrentSyncOperation.cancel();
+            }
+        }
+
+        //sendBroadcastFinishedSyncFolder(account, file.getRemotePath());
+    }
+
+    /**
+     * TODO review this method when "folder synchronization" replaces "folder download"; this is a fast and ugly
+     * patch.
+     */
+    private void sendBroadcastNewSyncFolder(Account account, String remotePath) {
+        Intent added = new Intent(FileDownloader.getDownloadAddedMessage());
+        added.putExtra(FileDownloader.ACCOUNT_NAME, account.name);
+        added.putExtra(FileDownloader.EXTRA_REMOTE_PATH, remotePath);
+        added.putExtra(FileDownloader.EXTRA_FILE_PATH, FileStorageUtils.getSavePath(account.name) + remotePath);
+        mService.sendStickyBroadcast(added);
+    }
+
+    /**
+     * TODO review this method when "folder synchronization" replaces "folder download"; this is a fast and ugly
+     * patch.
+     */
+    private void sendBroadcastFinishedSyncFolder(Account account, String remotePath, boolean success) {
+        Intent finished = new Intent(FileDownloader.getDownloadFinishMessage());
+        finished.putExtra(FileDownloader.ACCOUNT_NAME, account.name);
+        finished.putExtra(FileDownloader.EXTRA_REMOTE_PATH, remotePath);
+        finished.putExtra(FileDownloader.EXTRA_FILE_PATH, FileStorageUtils.getSavePath(account.name) + remotePath);
+        finished.putExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, success);
+        mService.sendStickyBroadcast(finished);
+    }
+
+
+}
index 114f0e4..83de450 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -54,8 +57,6 @@ import com.owncloud.android.utils.FileStorageUtils;
  * memory. To minimize the impact of this, the service always returns
  * Service.START_STICKY, and the later restart of the service is explicitly
  * considered in {@link FileObserverService#onStartCommand(Intent, int, int)}.
- * 
- * @author David A. Velasco
  */
 public class FileObserverService extends Service {
 
index 67b41a1..5329b52 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -46,8 +49,6 @@ import com.owncloud.android.ui.activity.ConflictsResolveActivity;
  *  The second case requires to monitor the folder parent of the files, since a direct 
  *  {@link FileObserver} on it will not receive more events after the file is deleted to
  *  be replaced.
- * 
- * @author David A. Velasco
  */
 public class FolderObserver extends FileObserver {
 
index 28cfa54..7ccbc11 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author sassman\r
+ *   @author David A. Velasco\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -44,9 +48,6 @@ import android.content.Context;
  * resource types, like FileSync, ConcatsSync, CalendarSync, etc..\r
  * \r
  * Implements the standard {@link AbstractThreadedSyncAdapter}.\r
- * \r
- * @author sassman\r
- * @author David A. Velasco\r
  */\r
 public abstract class AbstractOwnCloudSyncAdapter extends\r
         AbstractThreadedSyncAdapter {\r
index 3ba1676..d3ab06c 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 6d7c46c..d907bb4 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 33e2400..07e68c6 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,7 +35,7 @@ import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.operations.SynchronizeFolderOperation;
+import com.owncloud.android.operations.RefreshFolderOperation;
 import com.owncloud.android.operations.UpdateOCVersionOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -55,9 +59,6 @@ import android.support.v4.app.NotificationCompat;
  * ownCloud files.
  * 
  * Performs a full synchronization of the account recieved in {@link #onPerformSync(Account, Bundle, String, ContentProviderClient, SyncResult)}.
- * 
- * @author Bartek Przybylski
- * @author David A. Velasco
  */
 public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
 
@@ -260,7 +261,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
         }
         */
         // folder synchronization
-        SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation(  folder, 
+        RefreshFolderOperation synchFolderOp = new RefreshFolderOperation(  folder,
                                                                                     mCurrentSyncTime, 
                                                                                     true,
                                                                                     mIsShareSupported,
index 5da8c24..e48f91f 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
+ *   @author David A. Velasco\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -24,10 +28,7 @@ import android.os.IBinder;
 /**\r
  * Background service for synchronizing remote files with their local state.\r
  * \r
- * Serves as a connector to an instance of {@link FileSyncAdapter}, as required by standard Android APIs. \r
- * \r
- * @author Bartek Przybylski\r
- * @author David A. Velasco\r
+ * Serves as a connector to an instance of {@link FileSyncAdapter}, as required by standard Android APIs.\r
  */\r
 public class FileSyncService extends Service {\r
     \r
index a65f3ad..e1fa805 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -22,9 +25,6 @@ import android.view.View.OnClickListener;
 \r
 /**\r
  * Represents an Item on the ActionBar.\r
- * \r
- * @author Bartek Przybylski\r
- * \r
  */\r
 public class ActionItem {\r
     private Drawable mIcon;\r
index dac083a..b451fca 100644 (file)
@@ -1,4 +1,6 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2014 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
index fccf56d..44f8976 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Lorensius. W. T\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -32,9 +35,6 @@ import android.widget.PopupWindow;
 \r
 /**\r
  * Represents a custom PopupWindows\r
- * \r
- * @author Lorensius. W. T\r
- * \r
  */\r
 public class CustomPopup {\r
     protected final View mAnchor;\r
index 9fe885b..2258764 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2012-2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -23,16 +26,18 @@ import android.graphics.Canvas;
 import android.util.AttributeSet;
 import android.widget.ListView;
 
+import com.owncloud.android.lib.common.utils.Log_OC;
+
 /**
  * ListView allowing to specify the position of an item that should be centered in the visible area, if possible.
- * 
- * The cleanest way I found to overcome the problem due to getHeight() returns 0 until the view is really drawn. 
- *  
- * @author David A. Velasco
+ *
+ * The cleanest way I found to overcome the problem due to getHeight() returns 0 until the view is really drawn.
  */
 public class ExtendedListView extends ListView {
 
-    private int mPositionToSetAndCenter;
+    private static final String TAG = ExtendedListView.class.getSimpleName();
+
+    private int mPositionToSetAndCenter = 0;
 
     public ExtendedListView(Context context) {
         super(context);
@@ -48,26 +53,28 @@ public class ExtendedListView extends ListView {
 
     /**
      * {@inheritDoc}
-     * 
-     * 
+     *
+     *
      */
     @Override
     protected void onDraw (Canvas canvas) {
         super.onDraw(canvas);
         if (mPositionToSetAndCenter > 0) {
+            Log_OC.v(TAG, "Centering around position " + mPositionToSetAndCenter);
             this.setSelectionFromTop(mPositionToSetAndCenter, getHeight() / 2);
             mPositionToSetAndCenter = 0;
         }
     }
-    
+
     /**
      * Public method to set the position of the item that should be centered in the visible area of the view.
-     * 
+     *
      * The position is saved here and checked in onDraw().
-     *  
+     *
      * @param position         Position (in the list of items) of the item to center in the visible area.     
      */
     public void setAndCenterSelection(int position) {
         mPositionToSetAndCenter = position;
     }
-}
+
+}
\ No newline at end of file
index e38d29a..946a41e 100644 (file)
@@ -1,4 +1,6 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2014 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
index 86fe3fe..db27951 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Lorensius. W. T\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -42,8 +45,6 @@ import com.owncloud.android.R;
 /**\r
  * Popup window, shows action list as icon and text like the one in Gallery3D\r
  * app.\r
- * \r
- * @author Lorensius. W. T\r
  */\r
 public class QuickAction extends CustomPopup {\r
     private final View root;\r
index 8f562b3..4437cce 100644 (file)
@@ -1,3 +1,22 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 package com.owncloud.android.ui;
 
 import android.content.Context;
diff --git a/src/com/owncloud/android/ui/SquareImageView.java b/src/com/owncloud/android/ui/SquareImageView.java
new file mode 100644 (file)
index 0000000..b1613fd
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+
+public class SquareImageView extends ImageView {
+
+    public SquareImageView(Context context) {
+        super(context);
+    }
+
+    public SquareImageView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public SquareImageView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, widthMeasureSpec);
+    }
+}
diff --git a/src/com/owncloud/android/ui/SquareLinearLayout.java b/src/com/owncloud/android/ui/SquareLinearLayout.java
new file mode 100644 (file)
index 0000000..c65c51f
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+
+public class SquareLinearLayout extends LinearLayout {
+
+    public SquareLinearLayout(Context context) {
+        super(context);
+    }
+
+    public SquareLinearLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public SquareLinearLayout(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, widthMeasureSpec);
+    }
+}
index 076a6cb..043f67e 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -22,28 +24,31 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.files.FileOperationsHelper;
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
+import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
 
 public interface ComponentsGetter {
 
     /**
-     * Callback method invoked when the parent activity is fully created to get a reference to the FileDownloader service API.
-     * 
-     * @return  Directory to list firstly. Can be NULL.
+     * To be invoked when the parent activity is fully created to get a reference  to the FileDownloader service API.
      */
     public FileDownloaderBinder getFileDownloaderBinder();
 
     
     /**
-     * Callback method invoked when the parent activity is fully created to get a reference to the FileUploader service API.
-     * 
-     * @return  Directory to list firstly. Can be NULL.
+     * To be invoked when the parent activity is fully created to get a reference to the FileUploader service API.
      */
     public FileUploaderBinder getFileUploaderBinder();
 
     
+    /**
+     * To be invoked when the parent activity is fully created to get a reference to the OperationsSerivce service API.
+     */
+    public OperationsServiceBinder getOperationsServiceBinder();
+
     
     public FileDataStorageManager getStorageManager();
     
     public FileOperationsHelper getFileOperationsHelper();
 
+
 }
index 509e5c7..c3db9a4 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author David A. Velasco
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -32,10 +36,7 @@ import android.os.Bundle;
 
 /**
  * Wrapper activity which will be launched if keep-in-sync file will be modified by external
- * application. 
- * 
- * @author Bartek Przybylski
- * @author David A. Velasco
+ * application.
  */
 public class ConflictsResolveActivity extends FileActivity implements OnConflictDecisionMadeListener {
 
index b503c37..de5b3c3 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -28,8 +31,6 @@ import android.widget.Toast;
 
 /**
  * Activity copying the text of the received Intent into the system clibpoard.
- * 
- * @author David A. Velasco
  */
 @SuppressWarnings("deprecation")
 public class CopyToClipboardActivity extends Activity {
index bffec8b..9405ca7 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -57,8 +60,6 @@ import com.owncloud.android.utils.FileStorageUtils;
  * files.
  * 
  * Shown when the error notification summarizing the list of errors is clicked by the user.
- * 
- * @author David A. Velasco
  */
 public class ErrorsWhileCopyingHandlerActivity  extends SherlockFragmentActivity implements OnClickListener {
 
@@ -129,9 +130,7 @@ public class ErrorsWhileCopyingHandlerActivity  extends SherlockFragmentActivity
     
     /**
      * Customized adapter, showing the local files as main text in two-lines list item and the remote files
-     * as the secondary text. 
-     * 
-     * @author David A. Velasco
+     * as the secondary text.
      */
     public class ErrorsWhileCopyingListAdapter extends ArrayAdapter<String> {
         
@@ -200,8 +199,6 @@ public class ErrorsWhileCopyingHandlerActivity  extends SherlockFragmentActivity
     
     /**
      * Asynchronous task performing the move of all the local files to the ownCloud folder.
-     * 
-     * @author David A. Velasco
      */
     private class MoveFilesTask extends AsyncTask<Void, Void, Boolean> {
 
index 136bdb5..e92474b 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -54,8 +57,8 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CreateShareOperation;
+import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
-
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
 import com.owncloud.android.ui.dialog.LoadingDialog;
@@ -64,11 +67,9 @@ import com.owncloud.android.utils.ErrorMessageAdapter;
 
 /**
  * Activity with common behaviour for activities handling {@link OCFile}s in ownCloud {@link Account}s .
- * 
- * @author David A. Velasco
  */
-public class FileActivity extends SherlockFragmentActivity 
-implements OnRemoteOperationListener, ComponentsGetter {
+public class FileActivity extends SherlockFragmentActivity
+        implements OnRemoteOperationListener, ComponentsGetter {
 
     public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
     public static final String EXTRA_ACCOUNT = "com.owncloud.android.ui.activity.ACCOUNT";
@@ -78,7 +79,7 @@ implements OnRemoteOperationListener, ComponentsGetter {
     public static final String TAG = FileActivity.class.getSimpleName();
     
     private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
-    private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID";;
+    private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID";
     
     protected static final long DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS = 200;
     
@@ -157,7 +158,7 @@ implements OnRemoteOperationListener, ComponentsGetter {
         if (mUploadServiceConnection != null) {
             bindService(new Intent(this, FileUploader.class), mUploadServiceConnection, Context.BIND_AUTO_CREATE);
         }
-        
+
     }
 
     
@@ -220,6 +221,7 @@ implements OnRemoteOperationListener, ComponentsGetter {
             unbindService(mUploadServiceConnection);
             mUploadServiceConnection = null;
         }
+
         super.onDestroy();
     }
     
@@ -255,8 +257,6 @@ implements OnRemoteOperationListener, ComponentsGetter {
      *  to create a new ownCloud {@link Account}.
      *  
      *  POSTCONDITION: updates {@link #mAccountWasSet} and {@link #mAccountWasRestored}.
-     *   
-     *  @return     'True' if the checked {@link Account} was valid.
      */
     private void swapToDefaultAccount() {
         // default to the most recently used account
@@ -355,15 +355,12 @@ implements OnRemoteOperationListener, ComponentsGetter {
     protected ServiceConnection newTransferenceServiceConnection() {
         return null;
     }
-    
 
     /**
      * Helper class handling a callback from the {@link AccountManager} after the creation of
      * a new ownCloud {@link Account} finished, successfully or not.
      * 
      * At this moment, only called after the creation of the first account.
-     * 
-     * @author David A. Velasco
      */
     public class AccountCreationCallback implements AccountManagerCallback<Bundle> {
 
@@ -464,7 +461,10 @@ implements OnRemoteOperationListener, ComponentsGetter {
         } else if (operation instanceof UnshareLinkOperation) {
             onUnshareLinkOperationFinish((UnshareLinkOperation)operation, result);
         
-        } 
+        } else if (operation instanceof SynchronizeFolderOperation) {
+            onSynchronizeFolderOperationFinish((SynchronizeFolderOperation)operation, result);
+
+        }
     }
 
     protected void requestCredentialsUpdate() {
@@ -506,7 +506,14 @@ implements OnRemoteOperationListener, ComponentsGetter {
             t.show();
         } 
     }
-    
+
+    private void onSynchronizeFolderOperationFinish(SynchronizeFolderOperation operation, RemoteOperationResult result) {
+        if (!result.isSuccess() && result.getCode() != ResultCode.CANCELLED){
+            Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
+                    Toast.LENGTH_LONG);
+            t.show();
+        }
+    }
     
     protected void updateFileFromDB(){
         OCFile file = getFile();
@@ -594,7 +601,7 @@ implements OnRemoteOperationListener, ComponentsGetter {
     @Override
     public FileUploaderBinder getFileUploaderBinder() {
         return mUploaderBinder;
-    };    
+    }
     
     
 }
index ea65d31..58e7ec5 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -25,6 +29,8 @@ import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AuthenticatorException;
 import android.accounts.OperationCanceledException;
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.ProgressDialog;
@@ -90,11 +96,10 @@ import com.owncloud.android.operations.MoveFileOperation;
 import com.owncloud.android.operations.RemoveFileOperation;
 import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
-import com.owncloud.android.operations.SynchronizeFolderOperation;
+import com.owncloud.android.operations.RefreshFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
 import com.owncloud.android.services.observer.FileObserverService;
 import com.owncloud.android.syncadapter.FileSyncAdapter;
-import com.owncloud.android.ui.adapter.FileListListAdapter;
 import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
@@ -107,14 +112,12 @@ import com.owncloud.android.ui.preview.PreviewMediaFragment;
 import com.owncloud.android.ui.preview.PreviewVideoActivity;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
+import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.UriUtils;
 
 
 /**
  * Displays, what files the user has available in his ownCloud.
- * 
- * @author Bartek Przybylski
- * @author David A. Velasco
  */
 
 public class FileDisplayActivity extends HookActivity implements
@@ -253,7 +256,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
             setNavigationListWithFolder(file);
             
             if (!stateWasRecovered) {
-                Log_OC.e(TAG, "Initializing Fragments in onAccountChanged..");
+                Log_OC.d(TAG, "Initializing Fragments in onAccountChanged..");
                 initFragmentsWithFile();
                 if (file.isFolder()) {
                     startSyncFolderOperation(file, false);
@@ -517,7 +520,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
             
             // Read sorting order, default to sort by name ascending
             Integer sortOrder = appPreferences
-                    .getInt("sortOrder", FileListListAdapter.SORT_NAME);
+                    .getInt("sortOrder", FileStorageUtils.SORT_NAME);
             
             AlertDialog.Builder builder = new AlertDialog.Builder(this);
             builder.setTitle(R.string.actionbar_sort_title)
@@ -552,19 +555,19 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     }
 
     private void startSynchronization() {
-        Log_OC.e(TAG, "Got to start sync");
+        Log_OC.d(TAG, "Got to start sync");
         if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
-            Log_OC.e(TAG, "Canceling all syncs for " + MainApp.getAuthority());
+            Log_OC.d(TAG, "Canceling all syncs for " + MainApp.getAuthority());
             ContentResolver.cancelSync(null, MainApp.getAuthority());   // cancel the current synchronizations of any ownCloud account
             Bundle bundle = new Bundle();
             bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
             bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
-            Log_OC.e(TAG, "Requesting sync for " + getAccount().name + " at " + MainApp.getAuthority());
+            Log_OC.d(TAG, "Requesting sync for " + getAccount().name + " at " + MainApp.getAuthority());
             ContentResolver.requestSync(
                     getAccount(),
                     MainApp.getAuthority(), bundle);
         } else {
-            Log_OC.e(TAG, "Requesting sync for " + getAccount().name + " at " + MainApp.getAuthority() + " with new API");
+            Log_OC.d(TAG, "Requesting sync for " + getAccount().name + " at " + MainApp.getAuthority() + " with new API");
             SyncRequest.Builder builder = new SyncRequest.Builder();
             builder.setSyncAdapter(getAccount(), MainApp.getAuthority());
             builder.setExpedited(true);
@@ -605,13 +608,23 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
     /**
      * Called, when the user selected something for uploading
+     *
      */
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
 
         if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
-            requestSimpleUpload(data, resultCode);
-
+            //getClipData is only supported on api level 16+, Jelly Bean
+            if (data.getData() == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
+                for( int i = 0; i < data.getClipData().getItemCount(); i++){
+                    Intent intent = new Intent();
+                    intent.setData(data.getClipData().getItemAt(i).getUri());
+                    requestSimpleUpload(intent, resultCode);
+                }
+            }else {
+                requestSimpleUpload(data, resultCode);
+            }
         } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
             requestMultipleUpload(data, resultCode);
 
@@ -636,6 +649,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         if (filePaths != null) {
             String[] remotePaths = new String[filePaths.length];
             String remotePathBase = "";
+
             for (int j = mDirectories.getCount() - 2; j >= 0; --j) {
                 remotePathBase += OCFile.PATH_SEPARATOR + mDirectories.getItem(j);
             }
@@ -686,7 +700,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
         } finally {
             if (filepath == null) {
-                Log_OC.e(TAG, "Couldnt resolve path to file");
+                Log_OC.e(TAG, "Couldn't resolve path to file");
                 Toast t = Toast.makeText(this, getString(R.string.filedisplay_unexpected_bad_get_content), Toast.LENGTH_LONG);
                 t.show();
                 return;
@@ -773,7 +787,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     @Override
     protected void onSaveInstanceState(Bundle outState) {
         // responsibility of restore is preferred in onCreate() before than in onRestoreInstanceState when there are Fragments involved
-        Log_OC.e(TAG, "onSaveInstanceState() start");
+        Log_OC.d(TAG, "onSaveInstanceState() start");
         super.onSaveInstanceState(outState);
         outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW, mWaitingToPreview);
         outState.putBoolean(FileDisplayActivity.KEY_SYNC_IN_PROGRESS, mSyncInProgress);
@@ -788,7 +802,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     @Override
     protected void onResume() {
         super.onResume();
-        Log_OC.e(TAG, "onResume() start");
+        Log_OC.d(TAG, "onResume() start");
         
         // refresh list of files
         refreshListOfFilesFragment();
@@ -797,8 +811,8 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START);
         syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END);
         syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED);
-        syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
-        syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
+        syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
+        syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
         mSyncBroadcastReceiver = new SyncBroadcastReceiver();
         registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
         //LocalBroadcastManager.getInstance(this).registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
@@ -820,7 +834,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
     @Override
     protected void onPause() {
-        Log_OC.e(TAG, "onPause() start");
+        Log_OC.d(TAG, "onPause() start");
         if (mSyncBroadcastReceiver != null) {
             unregisterReceiver(mSyncBroadcastReceiver);
             //LocalBroadcastManager.getInstance(this).unregisterReceiver(mSyncBroadcastReceiver);
@@ -877,6 +891,10 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                     } else if (item == 1) {
                         Intent action = new Intent(Intent.ACTION_GET_CONTENT);
                         action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
+                        //Intent.EXTRA_ALLOW_MULTIPLE is only supported on api level 18+, Jelly Bean
+                        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+                            action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
+                        }
                         startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)),
                                 ACTION_SELECT_CONTENT_FROM_APPS);
                     }
@@ -1082,9 +1100,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                             setFile(currentFile);
                         }
                         
-                        mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && !SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
+                        mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
                                 
-                        if (SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
+                        if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
                                     equals(event) &&
                                 /// TODO refactor and make common
                                 synchResult != null && !synchResult.isSuccess() &&  
@@ -1093,40 +1111,34 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                                     (synchResult.isException() && synchResult.getException() 
                                             instanceof AuthenticatorException))) {
 
-                            OwnCloudClient client = null;
+
                             try {
-                                OwnCloudAccount ocAccount = 
+                                OwnCloudClient client;
+                                OwnCloudAccount ocAccount =
                                         new OwnCloudAccount(getAccount(), context);
                                 client = (OwnCloudClientManagerFactory.getDefaultSingleton().
                                         removeClientFor(ocAccount));
-                                // TODO get rid of these exceptions
-                            } catch (AccountNotFoundException e) {
-                                e.printStackTrace();
-                            } catch (AuthenticatorException e) {
-                                e.printStackTrace();
-                            } catch (OperationCanceledException e) {
-                                e.printStackTrace();
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
-                            
-                            if (client != null) {
-                                OwnCloudCredentials cred = client.getCredentials();
-                                if (cred != null) {
-                                    AccountManager am = AccountManager.get(context);
-                                    if (cred.authTokenExpires()) {
-                                        am.invalidateAuthToken(
-                                                getAccount().type, 
-                                                cred.getAuthToken()
-                                        );
-                                    } else {
-                                        am.clearPassword(getAccount());
+
+                                if (client != null) {
+                                    OwnCloudCredentials cred = client.getCredentials();
+                                    if (cred != null) {
+                                        AccountManager am = AccountManager.get(context);
+                                        if (cred.authTokenExpires()) {
+                                            am.invalidateAuthToken(
+                                                    getAccount().type,
+                                                    cred.getAuthToken()
+                                            );
+                                        } else {
+                                            am.clearPassword(getAccount());
+                                        }
                                     }
                                 }
+                                requestCredentialsUpdate();
+
+                            } catch (AccountNotFoundException e) {
+                                Log_OC.e(TAG, "Account " + getAccount() + " was removed!", e);
                             }
-                            
-                            requestCredentialsUpdate();
-                            
+
                         }
                     }
                     removeStickyBroadcast(intent);
@@ -1238,26 +1250,36 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
 
     /**
-     * Class waiting for broadcast events from the {@link FielDownloader} service.
+     * Class waiting for broadcast events from the {@link FileDownloader} service.
      * 
      * Updates the UI when a download is started or finished, provided that it is relevant for the
      * current folder.
      */
     private class DownloadFinishReceiver extends BroadcastReceiver {
+
+        //int refreshCounter = 0;
         @Override
         public void onReceive(Context context, Intent intent) {
             try {
                 boolean sameAccount = isSameAccount(context, intent);
                 String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
                 boolean isDescendant = isDescendant(downloadedRemotePath);
-    
+
                 if (sameAccount && isDescendant) {
-                    refreshListOfFilesFragment();
-                    refreshSecondFragment(intent.getAction(), downloadedRemotePath, intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false));
+                    String linkedToRemotePath = intent.getStringExtra(FileDownloader.EXTRA_LINKED_TO_PATH);
+                    if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) {
+                        //Log_OC.v(TAG, "refresh #" + ++refreshCounter);
+                        refreshListOfFilesFragment();
+                    }
+                    refreshSecondFragment(
+                            intent.getAction(),
+                            downloadedRemotePath,
+                            intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false)
+                    );
                 }
     
                 if (mWaitingToSend != null) {
-                    mWaitingToSend = getStorageManager().getFileByPath(mWaitingToSend.getRemotePath()); // Update the file to send
+                    mWaitingToSend = getStorageManager().getFileByPath(mWaitingToSend.getRemotePath());
                     if (mWaitingToSend.isDown()) { 
                         sendDownloadedFile();
                     }
@@ -1272,7 +1294,19 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
         private boolean isDescendant(String downloadedRemotePath) {
             OCFile currentDir = getCurrentDir();
-            return (currentDir != null && downloadedRemotePath != null && downloadedRemotePath.startsWith(currentDir.getRemotePath()));
+            return (
+                currentDir != null &&
+                downloadedRemotePath != null &&
+                downloadedRemotePath.startsWith(currentDir.getRemotePath())
+            );
+        }
+
+        private boolean isAscendant(String linkedToRemotePath) {
+            OCFile currentDir = getCurrentDir();
+            return (
+                currentDir != null &&
+                currentDir.getRemotePath().startsWith(linkedToRemotePath)
+            );
         }
 
         private boolean isSameAccount(Context context, Intent intent) {
@@ -1714,6 +1748,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
     private void requestForDownload() {
         Account account = getAccount();
+        //if (!mWaitingToPreview.isDownloading()) {
         if (!mDownloaderBinder.isDownloading(account, mWaitingToPreview)) {
             Intent i = new Intent(this, FileDownloader.class);
             i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
@@ -1742,7 +1777,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         mSyncInProgress = true;
                 
         // perform folder synchronization
-        RemoteOperation synchFolderOp = new SynchronizeFolderOperation( folder,  
+        RemoteOperation synchFolderOp = new RefreshFolderOperation( folder,
                                                                         currentSyncTime, 
                                                                         false,
                                                                         getFileOperationsHelper().isSharedSupported(),
@@ -1771,7 +1806,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     
     private void requestForDownload(OCFile file) {
         Account account = getAccount();
-        if (!mDownloaderBinder.isDownloading(account, file)) {
+        if (!mDownloaderBinder.isDownloading(account, mWaitingToPreview)) {
             Intent i = new Intent(this, FileDownloader.class);
             i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
             i.putExtra(FileDownloader.EXTRA_FILE, file);
index 07c9213..3a61eb0 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -55,7 +57,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CreateFolderOperation;
-import com.owncloud.android.operations.SynchronizeFolderOperation;
+import com.owncloud.android.operations.RefreshFolderOperation;
 import com.owncloud.android.syncadapter.FileSyncAdapter;
 import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
@@ -208,7 +210,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         mSyncInProgress = true;
                 
         // perform folder synchronization
-        RemoteOperation synchFolderOp = new SynchronizeFolderOperation( folder,  
+        RemoteOperation synchFolderOp = new RefreshFolderOperation( folder,
                                                                         currentSyncTime, 
                                                                         false,
                                                                         getFileOperationsHelper().isSharedSupported(),
@@ -236,8 +238,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START);
         syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END);
         syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED);
-        syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
-        syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
+        syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
+        syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
         mSyncBroadcastReceiver = new SyncBroadcastReceiver();
         registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
         
@@ -478,9 +480,9 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
                         }
                         
                         mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && 
-                                !SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
+                                !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
                                 
-                        if (SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
+                        if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
                                     equals(event) &&
                                 /// TODO refactor and make common
                                 synchResult != null && !synchResult.isSuccess() &&  
@@ -489,40 +491,33 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
                                     (synchResult.isException() && synchResult.getException() 
                                             instanceof AuthenticatorException))) {
 
-                            OwnCloudClient client = null;
                             try {
-                                OwnCloudAccount ocAccount = 
+                                OwnCloudClient client;
+                                OwnCloudAccount ocAccount =
                                         new OwnCloudAccount(getAccount(), context);
                                 client = (OwnCloudClientManagerFactory.getDefaultSingleton().
                                         removeClientFor(ocAccount));
-                                // TODO get rid of these exceptions
-                            } catch (AccountNotFoundException e) {
-                                e.printStackTrace();
-                            } catch (AuthenticatorException e) {
-                                e.printStackTrace();
-                            } catch (OperationCanceledException e) {
-                                e.printStackTrace();
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
-                            
-                            if (client != null) {
-                                OwnCloudCredentials cred = client.getCredentials();
-                                if (cred != null) {
-                                    AccountManager am = AccountManager.get(context);
-                                    if (cred.authTokenExpires()) {
-                                        am.invalidateAuthToken(
-                                                getAccount().type, 
-                                                cred.getAuthToken()
-                                        );
-                                    } else {
-                                        am.clearPassword(getAccount());
+
+                                if (client != null) {
+                                    OwnCloudCredentials cred = client.getCredentials();
+                                    if (cred != null) {
+                                        AccountManager am = AccountManager.get(context);
+                                        if (cred.authTokenExpires()) {
+                                            am.invalidateAuthToken(
+                                                    getAccount().type,
+                                                    cred.getAuthToken()
+                                            );
+                                        } else {
+                                            am.clearPassword(getAccount());
+                                        }
                                     }
                                 }
+                                requestCredentialsUpdate();
+
+                            } catch (AccountNotFoundException e) {
+                                Log_OC.e(TAG, "Account " + getAccount() + " was removed!", e);
                             }
-                            
-                            requestCredentialsUpdate();
-                            
+
                         }
                     }
                     removeStickyBroadcast(intent);
index 901434e..0d4ab01 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -41,8 +44,6 @@ import com.owncloud.android.utils.DisplayUtils;
  * 
  * Added to show explanations for notifications when the user clicks on them, and there no place
  * better to show them.
- * 
- * @author David A. Velasco
  */
 public class GenericExplanationActivity  extends SherlockFragmentActivity {
 
index 54d65b1..daca8ad 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 793b3d9..5640404 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 22bdb18..d82f33b 100644 (file)
@@ -1,3 +1,24 @@
+
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 package com.owncloud.android.ui.activity;
 
 import android.support.v4.widget.SwipeRefreshLayout;
index 39b973d..76ece93 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2011 Bartek Przybylski
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 7942a73..2eb48fa 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -21,13 +25,17 @@ import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AccountManagerCallback;
 import android.accounts.AccountManagerFuture;
+import android.content.ComponentName;
+import android.content.Context;
 import android.content.Intent;
+import android.content.ServiceConnection;
 import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.IBinder;
 import android.preference.CheckBoxPreference;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
@@ -50,20 +58,25 @@ import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.AuthenticatorActivity;
+import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.db.DbHandler;
+import com.owncloud.android.files.FileOperationsHelper;
+import com.owncloud.android.files.services.FileDownloader;
+import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.ui.RadioButtonPreference;
 import com.owncloud.android.utils.DisplayUtils;
 
+import java.io.File;
+
 
 /**
  * An Activity that allows the user to change the application's settings.
- * 
- * @author Bartek Przybylski
- * @author David A. Velasco
  */
-public class Preferences extends SherlockPreferenceActivity implements AccountManagerCallback<Boolean> {
+public class Preferences extends SherlockPreferenceActivity
+        implements AccountManagerCallback<Boolean>, ComponentsGetter {
     
     private static final String TAG = "OwnCloudPreferences";
 
@@ -79,10 +92,18 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
     private String mAccountName;
     private boolean mShowContextMenu = false;
     private String mUploadPath;
+    private PreferenceCategory mPrefInstantUploadCategory;
+    private Preference mPrefInstantUpload;
     private Preference mPrefInstantUploadPath;
+    private Preference mPrefInstantUploadPathWiFi;
+    private Preference mPrefInstantVideoUpload;
     private Preference mPrefInstantVideoUploadPath;
+    private Preference mPrefInstantVideoUploadPathWiFi;
     private String mUploadVideoPath;
 
+    protected FileDownloader.FileDownloaderBinder mDownloaderBinder = null;
+    protected FileUploader.FileUploaderBinder mUploaderBinder = null;
+    private ServiceConnection mDownloadServiceConnection, mUploadServiceConnection = null;
 
     @SuppressWarnings("deprecation")
     @Override
@@ -198,13 +219,13 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
                         String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@'));
                         
                         String recommendSubject = String.format(getString(R.string.recommend_subject), appName);
-                        String recommendText = String.format(getString(R.string.recommend_text), appName, downloadUrl, username);
+                        String recommendText = String.format(getString(R.string.recommend_text),
+                                appName, downloadUrl, username);
                         
                         intent.putExtra(Intent.EXTRA_SUBJECT, recommendSubject);
                         intent.putExtra(Intent.EXTRA_TEXT, recommendText);
                         startActivity(intent);
 
-
                         return(true);
 
                     }
@@ -279,7 +300,23 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
                     }
                 });
         }
-
+        
+        mPrefInstantUploadCategory = (PreferenceCategory) findPreference("instant_uploading_category");
+        
+        mPrefInstantUploadPathWiFi =  findPreference("instant_upload_on_wifi");
+        mPrefInstantUpload = findPreference("instant_uploading");
+        
+        toggleInstantPictureOptions(((CheckBoxPreference) mPrefInstantUpload).isChecked());
+        
+        mPrefInstantUpload.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+            
+            @Override
+            public boolean onPreferenceChange(Preference preference, Object newValue) {
+                toggleInstantPictureOptions((Boolean) newValue);
+                return true;
+            }
+        });
+       
         mPrefInstantVideoUploadPath =  findPreference("instant_video_upload_path");
         if (mPrefInstantVideoUploadPath != null){
 
@@ -296,6 +333,19 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
                     }
                 });
         }
+        
+        mPrefInstantVideoUploadPathWiFi =  findPreference("instant_video_upload_on_wifi");
+        mPrefInstantVideoUpload = findPreference("instant_video_uploading");
+        toggleInstantVideoOptions(((CheckBoxPreference) mPrefInstantVideoUpload).isChecked());
+        
+        mPrefInstantVideoUpload.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+            
+            @Override
+            public boolean onPreferenceChange(Preference preference, Object newValue) {
+                toggleInstantVideoOptions((Boolean) newValue);
+                return true;
+            }
+        });
             
         /* About App */
        pAboutApp = (Preference) findPreference("about_app");
@@ -307,6 +357,38 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
        loadInstantUploadPath();
        loadInstantUploadVideoPath();
 
+        /* ComponentsGetter */
+        mDownloadServiceConnection = newTransferenceServiceConnection();
+        if (mDownloadServiceConnection != null) {
+            bindService(new Intent(this, FileDownloader.class), mDownloadServiceConnection,
+                    Context.BIND_AUTO_CREATE);
+        }
+        mUploadServiceConnection = newTransferenceServiceConnection();
+        if (mUploadServiceConnection != null) {
+            bindService(new Intent(this, FileUploader.class), mUploadServiceConnection,
+                    Context.BIND_AUTO_CREATE);
+        }
+
+    }
+    
+    private void toggleInstantPictureOptions(Boolean value){
+        if (value){
+            mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPathWiFi);
+            mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPath);
+        } else {
+            mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPathWiFi);
+            mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPath);
+        }
+    }
+    
+    private void toggleInstantVideoOptions(Boolean value){
+        if (value){
+            mPrefInstantUploadCategory.addPreference(mPrefInstantVideoUploadPathWiFi);
+            mPrefInstantUploadCategory.addPreference(mPrefInstantVideoUploadPath);
+        } else {
+            mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPathWiFi);
+            mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPath);
+        }
     }
 
     @Override
@@ -352,6 +434,7 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
 
                     // Remove account
                     am.removeAccount(a, this, mHandler);
+                    Log_OC.d(TAG, "Remove an account " + a.name);
                 }
             }
         }
@@ -362,6 +445,18 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
     @Override
     public void run(AccountManagerFuture<Boolean> future) {
         if (future.isDone()) {
+            // after remove account
+            Account account = new Account(mAccountName, MainApp.getAccountType());
+            if (!AccountUtils.exists(account, MainApp.getAppContext())) {
+                // Cancel tranfers
+                if (mUploaderBinder != null) {
+                    mUploaderBinder.cancel(account);
+                }
+                if (mDownloaderBinder != null) {
+                    mDownloaderBinder.cancel(account);
+                }
+            }
+
             Account a = AccountUtils.getCurrentOwnCloudAccount(this);
             String accountName = "";
             if (a == null) {
@@ -444,6 +539,16 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
     @Override
     protected void onDestroy() {
         mDbHandler.close();
+
+        if (mDownloadServiceConnection != null) {
+            unbindService(mDownloadServiceConnection);
+            mDownloadServiceConnection = null;
+        }
+        if (mUploadServiceConnection != null) {
+            unbindService(mUploadServiceConnection);
+            mUploadServiceConnection = null;
+        }
+
         super.onDestroy();
     }
 
@@ -587,4 +692,65 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
         editor.putString("instant_video_upload_path", mUploadVideoPath);
         editor.commit();
     }
+
+    // Methods for ComponetsGetter
+    @Override
+    public FileDownloader.FileDownloaderBinder getFileDownloaderBinder() {
+        return mDownloaderBinder;
+    }
+
+
+    @Override
+    public FileUploader.FileUploaderBinder getFileUploaderBinder() {
+        return mUploaderBinder;
+    }
+
+    @Override
+    public OperationsService.OperationsServiceBinder getOperationsServiceBinder() {
+        return null;
+    }
+
+    @Override
+    public FileDataStorageManager getStorageManager() {
+        return null;
+    }
+
+    @Override
+    public FileOperationsHelper getFileOperationsHelper() {
+        return null;
+    }
+
+    protected ServiceConnection newTransferenceServiceConnection() {
+        return new PreferencesServiceConnection();
+    }
+
+    /** Defines callbacks for service binding, passed to bindService() */
+    private class PreferencesServiceConnection implements ServiceConnection {
+
+        @Override
+        public void onServiceConnected(ComponentName component, IBinder service) {
+
+            if (component.equals(new ComponentName(Preferences.this, FileDownloader.class))) {
+                mDownloaderBinder = (FileDownloader.FileDownloaderBinder) service;
+
+            } else if (component.equals(new ComponentName(Preferences.this, FileUploader.class))) {
+                Log_OC.d(TAG, "Upload service connected");
+                mUploaderBinder = (FileUploader.FileUploaderBinder) service;
+            } else {
+                return;
+            }
+
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName component) {
+            if (component.equals(new ComponentName(Preferences.this, FileDownloader.class))) {
+                Log_OC.d(TAG, "Download service suddenly disconnected");
+                mDownloaderBinder = null;
+            } else if (component.equals(new ComponentName(Preferences.this, FileUploader.class))) {
+                Log_OC.d(TAG, "Upload service suddenly disconnected");
+                mUploaderBinder = null;
+            }
+        }
+    };
 }
index 0918572..7563ea6 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -48,9 +51,6 @@ import com.owncloud.android.utils.FileStorageUtils;
 /**
  * Displays local files and let the user choose what of them wants to upload
  * to the current ownCloud account
- * 
- * @author David A. Velasco
- * 
  */
 
 public class UploadFilesActivity extends FileActivity implements
@@ -289,8 +289,6 @@ public class UploadFilesActivity extends FileActivity implements
      * to upload into the ownCloud local folder.
      * 
      * Maybe an AsyncTask is not strictly necessary, but who really knows.
-     * 
-     * @author David A. Velasco
      */
     private class CheckAvailableSpaceTask extends AsyncTask<Void, Void, Boolean> {
 
index aa3b8aa..d1509f9 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 6c8a132..d8b1225 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -69,9 +72,6 @@ import com.owncloud.android.utils.DisplayUtils;
 
 /**
  * This can be used to upload things to an ownCloud instance.
- * 
- * @author Bartek Przybylski
- * 
  */
 public class Uploader extends SherlockListActivity implements OnItemClickListener, android.view.View.OnClickListener {
     private static final String TAG = "ownCloudUploader";
index b1c3263..2528cb2 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -25,9 +29,6 @@ import android.widget.TextView;
 
 /**
  * TODO
- * 
- * @author masensio
- * @author David A. Velasco
  *
  */
 public class CertificateCombinedExceptionViewAdapter implements SslUntrustedCertDialog.ErrorViewAdapter {
index 93efdf1..0f2536f 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 15f6a8b..fbdf69d 100644 (file)
@@ -1,6 +1,11 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
+ *   @author Tobias Kaminsky\r
+ *   @author David A. Velasco\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2014 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -19,11 +24,8 @@ package com.owncloud.android.ui.adapter;
 \r
 \r
 import java.io.File;\r
-import java.util.Collections;\r
-import java.util.Comparator;\r
 import java.util.Vector;\r
 \r
-import third_parties.daveKoeller.AlphanumComparator;\r
 import android.accounts.Account;\r
 import android.content.Context;\r
 import android.content.SharedPreferences;\r
@@ -33,11 +35,12 @@ import android.text.format.DateUtils;
 import android.view.LayoutInflater;\r
 import android.view.View;\r
 import android.view.ViewGroup;\r
+import android.widget.AbsListView;\r
 import android.widget.BaseAdapter;\r
+import android.widget.GridView;\r
 import android.widget.ImageView;\r
 import android.widget.LinearLayout;\r
 import android.widget.ListAdapter;\r
-import android.widget.ListView;\r
 import android.widget.TextView;\r
 \r
 import com.owncloud.android.R;\r
@@ -45,9 +48,9 @@ import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.datamodel.FileDataStorageManager;\r
 import com.owncloud.android.datamodel.OCFile;\r
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;\r
-import com.owncloud.android.datamodel.ThumbnailsCacheManager.AsyncDrawable;\r
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;\r
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;\r
+import com.owncloud.android.services.OperationsService.OperationsServiceBinder;\r
 import com.owncloud.android.ui.activity.ComponentsGetter;\r
 import com.owncloud.android.utils.DisplayUtils;\r
 import com.owncloud.android.utils.FileStorageUtils;\r
@@ -56,52 +59,47 @@ import com.owncloud.android.utils.FileStorageUtils;
 /**\r
  * This Adapter populates a ListView with all files and folders in an ownCloud\r
  * instance.\r
- * \r
- * @author Bartek Przybylski\r
- * @author Tobias Kaminsky\r
- * @author David A. Velasco\r
  */\r
 public class FileListListAdapter extends BaseAdapter implements ListAdapter {\r
     private final static String PERMISSION_SHARED_WITH_ME = "S";\r
-    \r
+\r
     private Context mContext;\r
     private OCFile mFile = null;\r
     private Vector<OCFile> mFiles = null;\r
+    private Vector<OCFile> mFilesOrig = new Vector<OCFile>();\r
     private boolean mJustFolders;\r
 \r
     private FileDataStorageManager mStorageManager;\r
     private Account mAccount;\r
     private ComponentsGetter mTransferServiceGetter;\r
-    private Integer mSortOrder;\r
-    public static final Integer SORT_NAME = 0;\r
-    public static final Integer SORT_DATE = 1;\r
-    public static final Integer SORT_SIZE = 2;\r
-    private Boolean mSortAscending;\r
+    private boolean mGridMode;\r
+\r
+    private enum ViewType {LIST_ITEM, GRID_IMAGE, GRID_ITEM };\r
+\r
     private SharedPreferences mAppPreferences;\r
     \r
     public FileListListAdapter(\r
             boolean justFolders, \r
-            Context context, \r
+            Context context,\r
             ComponentsGetter transferServiceGetter\r
             ) {\r
-\r
+        \r
         mJustFolders = justFolders;\r
         mContext = context;\r
         mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);\r
-\r
         mTransferServiceGetter = transferServiceGetter;\r
-        \r
+\r
         mAppPreferences = PreferenceManager\r
                 .getDefaultSharedPreferences(mContext);\r
         \r
         // Read sorting order, default to sort by name ascending\r
-        mSortOrder = mAppPreferences\r
-                .getInt("sortOrder", 0);\r
-        mSortAscending = mAppPreferences.getBoolean("sortAscending", true);\r
+        FileStorageUtils.mSortOrder = mAppPreferences.getInt("sortOrder", 0);\r
+        FileStorageUtils.mSortAscending = mAppPreferences.getBoolean("sortAscending", true);\r
         \r
         // initialise thumbnails cache on background thread\r
         new ThumbnailsCacheManager.InitDiskCacheTask().execute();\r
 \r
+        mGridMode = false;\r
     }\r
     \r
     @Override\r
@@ -140,146 +138,190 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
 \r
     @Override\r
     public View getView(int position, View convertView, ViewGroup parent) {\r
+\r
         View view = convertView;\r
-        if (view == null) {\r
-            LayoutInflater inflator = (LayoutInflater) mContext\r
-                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r
-            view = inflator.inflate(R.layout.list_item, null);\r
-        }\r
-         \r
+        OCFile file = null;\r
+        LayoutInflater inflator = (LayoutInflater) mContext\r
+                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r
+\r
         if (mFiles != null && mFiles.size() > position) {\r
-            OCFile file = mFiles.get(position);\r
-            TextView fileName = (TextView) view.findViewById(R.id.Filename);           \r
+            file = mFiles.get(position);\r
+        }\r
+\r
+        // Find out which layout should be displayed\r
+        ViewType viewType;\r
+        if (!mGridMode){\r
+            viewType = ViewType.LIST_ITEM;\r
+        } else if (file.isImage()){\r
+            viewType = ViewType.GRID_IMAGE;\r
+        } else {\r
+            viewType = ViewType.GRID_ITEM;\r
+        }\r
+\r
+        // Create View\r
+        switch (viewType){\r
+            case GRID_IMAGE:\r
+                view = inflator.inflate(R.layout.grid_image, null);\r
+                break;\r
+            case GRID_ITEM:\r
+                view = inflator.inflate(R.layout.grid_item, null);\r
+                break;\r
+            case LIST_ITEM:\r
+                view = inflator.inflate(R.layout.list_item, null);\r
+                break;\r
+        }\r
+\r
+        view.invalidate();\r
+\r
+        if (file != null){\r
+\r
+            ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);\r
+\r
+            fileIcon.setTag(file.getFileId());\r
+            TextView fileName;\r
             String name = file.getFileName();\r
 \r
             LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ListItemLayout);\r
             linearLayout.setContentDescription("LinearLayout-" + name);\r
 \r
-            fileName.setText(name);\r
-            ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);\r
-            fileIcon.setTag(file.getFileId());\r
-            ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);\r
-            ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon);\r
-            sharedWithMeIconV.setVisibility(View.GONE);\r
-\r
-            ImageView localStateView = (ImageView) view.findViewById(R.id.imageView2);\r
-            localStateView.bringToFront();\r
-            FileDownloaderBinder downloaderBinder = \r
-                    mTransferServiceGetter.getFileDownloaderBinder();\r
-            FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();\r
-            if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) {\r
-                localStateView.setImageResource(R.drawable.downloading_file_indicator);\r
-                localStateView.setVisibility(View.VISIBLE);\r
-            } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) {\r
-                localStateView.setImageResource(R.drawable.uploading_file_indicator);\r
-                localStateView.setVisibility(View.VISIBLE);\r
-            } else if (file.isDown()) {\r
-                localStateView.setImageResource(R.drawable.local_file_indicator);\r
-                localStateView.setVisibility(View.VISIBLE);\r
-            } else {\r
-                localStateView.setVisibility(View.INVISIBLE);\r
+            switch (viewType){\r
+                case LIST_ITEM:\r
+                    TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);\r
+                    TextView lastModV = (TextView) view.findViewById(R.id.last_mod);\r
+                    ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);\r
+\r
+                    lastModV.setVisibility(View.VISIBLE);\r
+                    lastModV.setText(showRelativeTimestamp(file));\r
+\r
+                    checkBoxV.setVisibility(View.GONE);\r
+\r
+                    fileSizeV.setVisibility(View.VISIBLE);\r
+                    fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));\r
+\r
+                    if (!file.isFolder()) {\r
+                        AbsListView parentList = (AbsListView)parent;\r
+                        if (parentList.getChoiceMode() == AbsListView.CHOICE_MODE_NONE) {\r
+                            checkBoxV.setVisibility(View.GONE);\r
+                        } else {\r
+                            if (parentList.isItemChecked(position)) {\r
+                                checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);\r
+                            } else {\r
+                                checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);\r
+                            }\r
+                            checkBoxV.setVisibility(View.VISIBLE);\r
+                        }\r
+\r
+                    } else { //Folder\r
+                        fileSizeV.setVisibility(View.INVISIBLE);\r
+                    }\r
+\r
+                case GRID_ITEM:\r
+                    // filename\r
+                    fileName = (TextView) view.findViewById(R.id.Filename);\r
+                    name = file.getFileName();\r
+                    fileName.setText(name);\r
+\r
+                case GRID_IMAGE:\r
+                    // sharedIcon\r
+                    ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);\r
+                    if (file.isShareByLink()) {\r
+                        sharedIconV.setVisibility(View.VISIBLE);\r
+                        sharedIconV.bringToFront();\r
+                    } else {\r
+                        sharedIconV.setVisibility(View.GONE);\r
+                    }\r
+\r
+                    // local state\r
+                    ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator);\r
+                    localStateView.bringToFront();\r
+                    FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder();\r
+                    FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();\r
+                    boolean downloading = (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file));\r
+                    OperationsServiceBinder opsBinder = mTransferServiceGetter.getOperationsServiceBinder();\r
+                    downloading |= (opsBinder != null && opsBinder.isSynchronizing(mAccount, file.getRemotePath()));\r
+                    if (downloading) {\r
+                        localStateView.setImageResource(R.drawable.downloading_file_indicator);\r
+                        localStateView.setVisibility(View.VISIBLE);\r
+                    } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) {\r
+                        localStateView.setImageResource(R.drawable.uploading_file_indicator);\r
+                        localStateView.setVisibility(View.VISIBLE);\r
+                    } else if (file.isDown()) {\r
+                        localStateView.setImageResource(R.drawable.local_file_indicator);\r
+                        localStateView.setVisibility(View.VISIBLE);\r
+                    } else {\r
+                        localStateView.setVisibility(View.INVISIBLE);\r
+                    }\r
+\r
+                    // share with me icon\r
+                    if (!file.isFolder()) {\r
+                        ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon);\r
+                        sharedWithMeIconV.bringToFront();\r
+                        if (checkIfFileIsSharedWithMe(file)) {\r
+                            sharedWithMeIconV.setVisibility(View.VISIBLE);\r
+                        } else {\r
+                            sharedWithMeIconV.setVisibility(View.GONE);\r
+                        }\r
+                    }\r
+\r
+                    break;\r
             }\r
             \r
-            TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);\r
-            TextView lastModV = (TextView) view.findViewById(R.id.last_mod);\r
-            ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);\r
+            // For all Views\r
             \r
+            // this if-else is needed even though favorite icon is visible by default\r
+            // because android reuses views in listview\r
+            if (!file.keepInSync()) {\r
+                view.findViewById(R.id.favoriteIcon).setVisibility(View.GONE);\r
+            } else {\r
+                view.findViewById(R.id.favoriteIcon).setVisibility(View.VISIBLE);\r
+            }\r
+            \r
+            // No Folder\r
             if (!file.isFolder()) {\r
-                fileSizeV.setVisibility(View.VISIBLE);\r
-                fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));\r
-                lastModV.setVisibility(View.VISIBLE);\r
-                lastModV.setText(showRelativeTimestamp(file));\r
-                // this if-else is needed even thoe fav icon is visible by default\r
-                // because android reuses views in listview\r
-                if (!file.keepInSync()) {\r
-                    view.findViewById(R.id.imageView3).setVisibility(View.GONE);\r
-                } else {\r
-                    view.findViewById(R.id.imageView3).setVisibility(View.VISIBLE);\r
-                }\r
-                \r
-                ListView parentList = (ListView)parent;\r
-                if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { \r
-                    checkBoxV.setVisibility(View.GONE);\r
-                } else {\r
-                    if (parentList.isItemChecked(position)) {\r
-                        checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);\r
-                    } else {\r
-                        checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);\r
-                    }\r
-                    checkBoxV.setVisibility(View.VISIBLE);\r
-                }               \r
-                \r
-                // get Thumbnail if file is image\r
                 if (file.isImage() && file.getRemoteId() != null){\r
-                     // Thumbnail in Cache?\r
+                    // Thumbnail in Cache?\r
                     Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(\r
                             String.valueOf(file.getRemoteId())\r
-                    );\r
+                            );\r
                     if (thumbnail != null && !file.needsUpdateThumbnail()){\r
                         fileIcon.setImageBitmap(thumbnail);\r
                     } else {\r
                         // generate new Thumbnail\r
                         if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) {\r
-                            final ThumbnailsCacheManager.ThumbnailGenerationTask task = \r
+                            final ThumbnailsCacheManager.ThumbnailGenerationTask task =\r
                                     new ThumbnailsCacheManager.ThumbnailGenerationTask(\r
                                             fileIcon, mStorageManager, mAccount\r
-                                    );\r
+                                            );\r
                             if (thumbnail == null) {\r
                                 thumbnail = ThumbnailsCacheManager.mDefaultImg;\r
                             }\r
-                            final AsyncDrawable asyncDrawable = new AsyncDrawable(\r
+                            final ThumbnailsCacheManager.AsyncDrawable asyncDrawable =\r
+                                    new ThumbnailsCacheManager.AsyncDrawable(\r
                                     mContext.getResources(), \r
                                     thumbnail, \r
                                     task\r
-                            );\r
+                                    );\r
                             fileIcon.setImageDrawable(asyncDrawable);\r
                             task.execute(file);\r
                         }\r
                     }\r
                 } else {\r
-                    fileIcon.setImageResource(\r
-                            DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())\r
-                    );\r
-                }\r
-\r
-                if (checkIfFileIsSharedWithMe(file)) {\r
-                    sharedWithMeIconV.setVisibility(View.VISIBLE);\r
+                    fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName()));\r
                 }\r
-            } \r
-            else {\r
-                  // TODO Re-enable when server supports folder-size calculation\r
-//                if (FileStorageUtils.getDefaultSavePathFor(mAccount.name, file) != null){\r
-//                    fileSizeV.setVisibility(View.VISIBLE);\r
-//                    fileSizeV.setText(getFolderSizeHuman(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file)));\r
-//                } else {\r
-                    fileSizeV.setVisibility(View.INVISIBLE);\r
-//                }\r
-\r
-                lastModV.setVisibility(View.VISIBLE);\r
-                lastModV.setText(showRelativeTimestamp(file));\r
-                checkBoxV.setVisibility(View.GONE);\r
-                view.findViewById(R.id.imageView3).setVisibility(View.GONE);\r
 \r
+            } else {\r
+                // Folder\r
                 if (checkIfFileIsSharedWithMe(file)) {\r
                     fileIcon.setImageResource(R.drawable.shared_with_me_folder);\r
-                    sharedWithMeIconV.setVisibility(View.VISIBLE);\r
+                } else if (file.isShareByLink()) {\r
+                    // If folder is sharedByLink, icon folder must be changed to\r
+                    // folder-public one\r
+                    fileIcon.setImageResource(R.drawable.folder_public);\r
                 } else {\r
                     fileIcon.setImageResource(\r
-                            DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())\r
+                            DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())\r
                     );\r
                 }\r
-\r
-                // If folder is sharedByLink, icon folder must be changed to\r
-                // folder-public one\r
-                if (file.isShareByLink()) {\r
-                    fileIcon.setImageResource(R.drawable.folder_public);\r
-                }\r
-            }\r
-\r
-            if (file.isShareByLink()) {\r
-                sharedIconV.setVisibility(View.VISIBLE);\r
-            } else {\r
-                sharedIconV.setVisibility(View.GONE);\r
             }\r
         }\r
 \r
@@ -298,7 +340,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
         File dir = new File(path);\r
 \r
         if (dir.exists()) {\r
-            long bytes = getFolderSize(dir);\r
+            long bytes = FileStorageUtils.getFolderSize(dir);\r
             return DisplayUtils.bytesToHumanReadable(bytes);\r
         }\r
 \r
@@ -356,6 +398,9 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
         }\r
         if (mStorageManager != null) {\r
             mFiles = mStorageManager.getFolderContent(mFile);\r
+            mFilesOrig.clear();\r
+            mFilesOrig.addAll(mFiles);\r
+            \r
             if (mJustFolders) {\r
                 mFiles = getFolders(mFiles);\r
             }\r
@@ -363,29 +408,11 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
             mFiles = null;\r
         }\r
 \r
-        sortDirectory();\r
-    }\r
-    \r
-    /**\r
-     * Sorts all filenames, regarding last user decision \r
-     */\r
-    private void sortDirectory(){\r
-        switch (mSortOrder){\r
-        case 0:\r
-            sortByName(mSortAscending);\r
-            break;\r
-        case 1:\r
-            sortByDate(mSortAscending);\r
-            break;\r
-        case 2: \r
-            sortBySize(mSortAscending);\r
-            break;\r
-        }\r
-        \r
+        mFiles = FileStorageUtils.sortFolder(mFiles);\r
         notifyDataSetChanged();\r
     }\r
     \r
-    \r
+\r
     /**\r
      * Filter for getting only the folders\r
      * @param files\r
@@ -418,110 +445,27 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
                 && file.getPermissions().contains(PERMISSION_SHARED_WITH_ME));\r
     }\r
 \r
-    /**\r
-     * Sorts list by Date\r
-     * @param sortAscending true: ascending, false: descending\r
-     */\r
-    private void sortByDate(boolean sortAscending){\r
-        final Integer val;\r
-        if (sortAscending){\r
-            val = 1;\r
-        } else {\r
-            val = -1;\r
-        }\r
-        \r
-        Collections.sort(mFiles, new Comparator<OCFile>() {\r
-            public int compare(OCFile o1, OCFile o2) {\r
-                if (o1.isFolder() && o2.isFolder()) {\r
-                    Long obj1 = o1.getModificationTimestamp();\r
-                    return val * obj1.compareTo(o2.getModificationTimestamp());\r
-                }\r
-                else if (o1.isFolder()) {\r
-                    return -1;\r
-                } else if (o2.isFolder()) {\r
-                    return 1;\r
-                } else if (o1.getModificationTimestamp() == 0 || o2.getModificationTimestamp() == 0){\r
-                    return 0;\r
-                } else {\r
-                    Long obj1 = o1.getModificationTimestamp();\r
-                    return val * obj1.compareTo(o2.getModificationTimestamp());\r
-                }\r
-            }\r
-        });\r
-    }\r
-\r
-    /**\r
-     * Sorts list by Size\r
-     * @param sortAscending true: ascending, false: descending\r
-     */\r
-    private void sortBySize(boolean sortAscending){\r
-        final Integer val;\r
-        if (sortAscending){\r
-            val = 1;\r
-        } else {\r
-            val = -1;\r
-        }\r
-        \r
-        Collections.sort(mFiles, new Comparator<OCFile>() {\r
-            public int compare(OCFile o1, OCFile o2) {\r
-                if (o1.isFolder() && o2.isFolder()) {\r
-                    Long obj1 = getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1)));\r
-                    return val * obj1.compareTo(getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2))));\r
-                }\r
-                else if (o1.isFolder()) {\r
-                    return -1;\r
-                } else if (o2.isFolder()) {\r
-                    return 1;\r
-                } else if (o1.getFileLength() == 0 || o2.getFileLength() == 0){\r
-                    return 0;\r
-                } else {\r
-                    Long obj1 = o1.getFileLength();\r
-                    return val * obj1.compareTo(o2.getFileLength());\r
-                }\r
-            }\r
-        });\r
-    }\r
-\r
-    /**\r
-     * Sorts list by Name\r
-     * @param sortAscending true: ascending, false: descending\r
-     */\r
-    private void sortByName(boolean sortAscending){\r
-        final Integer val;\r
-        if (sortAscending){\r
-            val = 1;\r
-        } else {\r
-            val = -1;\r
-        }\r
-\r
-        Collections.sort(mFiles, new Comparator<OCFile>() {\r
-            public int compare(OCFile o1, OCFile o2) {\r
-                if (o1.isFolder() && o2.isFolder()) {\r
-                    return val * o1.getRemotePath().toLowerCase().compareTo(o2.getRemotePath().toLowerCase());\r
-                } else if (o1.isFolder()) {\r
-                    return -1;\r
-                } else if (o2.isFolder()) {\r
-                    return 1;\r
-                }\r
-                return val * new AlphanumComparator().compare(o1, o2);\r
-            }\r
-        });\r
-    }\r
-\r
     public void setSortOrder(Integer order, boolean ascending) {\r
         SharedPreferences.Editor editor = mAppPreferences.edit();\r
         editor.putInt("sortOrder", order);\r
         editor.putBoolean("sortAscending", ascending);\r
         editor.commit();\r
         \r
-        mSortOrder = order;\r
-        mSortAscending = ascending;\r
+        FileStorageUtils.mSortOrder = order;\r
+        FileStorageUtils.mSortAscending = ascending;\r
         \r
-        sortDirectory();\r
-    }    \r
+\r
+        mFiles = FileStorageUtils.sortFolder(mFiles);\r
+        notifyDataSetChanged();\r
+\r
+    }\r
     \r
     private CharSequence showRelativeTimestamp(OCFile file){\r
         return DisplayUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),\r
                 DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);\r
     }\r
+\r
+    public void setGridMode(boolean gridMode) {\r
+        mGridMode = gridMode;\r
+    }\r
 }\r
index 6190ebe..823abc5 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -22,6 +25,7 @@ import java.util.Arrays;
 import java.util.Comparator;
 
 import android.content.Context;
+import android.graphics.Bitmap;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -32,21 +36,22 @@ import android.widget.ListView;
 import android.widget.TextView;
 
 import com.owncloud.android.R;
+import com.owncloud.android.datamodel.ThumbnailsCacheManager;
+import com.owncloud.android.utils.BitmapUtils;
 import com.owncloud.android.utils.DisplayUtils;
 
+import third_parties.in.srain.cube.GridViewWithHeaderAndFooter;
+
 /**
  * This Adapter populates a ListView with all files and directories contained
  * in a local directory
- * 
- * @author David A. Velasco
- * 
  */
 public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
     
     private Context mContext;
     private File mDirectory;
     private File[] mFiles = null;
-
+    
     public LocalFileListAdapter(File directory, Context context) {
         mContext = context;
         swapDirectory(directory);
@@ -99,12 +104,13 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
             String name = file.getName();
             fileName.setText(name);
             
-            ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
+            ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
             if (!file.isDirectory()) {
                 fileIcon.setImageResource(R.drawable.file);
             } else {
                 fileIcon.setImageResource(R.drawable.ic_menu_archive);
             }
+            fileIcon.setTag(file.hashCode());
 
             TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);
             TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
@@ -112,9 +118,10 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
             if (!file.isDirectory()) {
                 fileSizeV.setVisibility(View.VISIBLE);
                 fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.length()));
+
                 lastModV.setVisibility(View.VISIBLE);
                 lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.lastModified()));
-                ListView parentList = (ListView)parent;
+                ListView parentList = (ListView) parent;
                 if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { 
                     checkBoxV.setVisibility(View.GONE);
                 } else {
@@ -125,15 +132,47 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
                     }
                     checkBoxV.setVisibility(View.VISIBLE);
                 }
+                
+             // get Thumbnail if file is image
+                if (BitmapUtils.isImage(file)){
+                // Thumbnail in Cache?
+                    Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
+                            String.valueOf(file.hashCode())
+                    );
+                    if (thumbnail != null){
+                        fileIcon.setImageBitmap(thumbnail);
+                    } else {
+
+                        // generate new Thumbnail
+                        if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) {
+                            final ThumbnailsCacheManager.ThumbnailGenerationTask task =
+                                    new ThumbnailsCacheManager.ThumbnailGenerationTask(fileIcon);
+                            if (thumbnail == null) {
+                                thumbnail = ThumbnailsCacheManager.mDefaultImg;
+                            }
+                            final ThumbnailsCacheManager.AsyncDrawable asyncDrawable =
+                                       new ThumbnailsCacheManager.AsyncDrawable(
+                                    mContext.getResources(), 
+                                    thumbnail, 
+                                    task
+                                       );
+                            fileIcon.setImageDrawable(asyncDrawable);
+                            task.execute(file);
+                        }
+                    }
+                } else {
+                    fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(null, file.getName()));
+                }  
 
             } else {
                 fileSizeV.setVisibility(View.GONE);
                 lastModV.setVisibility(View.GONE);
                 checkBoxV.setVisibility(View.GONE);
             }
-            
-            view.findViewById(R.id.imageView2).setVisibility(View.INVISIBLE);   // not GONE; the alignment changes; ugly way to keep it
-            view.findViewById(R.id.imageView3).setVisibility(View.GONE);
+
+            // not GONE; the alignment changes; ugly way to keep it
+            view.findViewById(R.id.localFileIndicator).setVisibility(View.INVISIBLE);   
+            view.findViewById(R.id.favoriteIcon).setVisibility(View.GONE);
             
             view.findViewById(R.id.sharedIcon).setVisibility(View.GONE);
             view.findViewById(R.id.sharedWithMeIcon).setVisibility(View.GONE);
index ae4335e..b5664d5 100644 (file)
@@ -1,3 +1,22 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 package com.owncloud.android.ui.adapter;
 
 import java.io.File;
index a944ead..7165614 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -27,9 +31,6 @@ import android.widget.TextView;
 
 /**
  * TODO
- * 
- * @author masensio
- * @author David A. Velasco
  */
 public class SslCertificateViewAdapter implements SslUntrustedCertDialog.CertificateViewAdapter {
     
index 7d2e291..7ac7144 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -24,10 +28,6 @@ import android.widget.TextView;
 
 /**
  * Dialog to show an Untrusted Certificate
- * 
- * @author masensio
- * @author David A. Velasco
- *
  */
 public class SslErrorViewAdapter implements SslUntrustedCertDialog.ErrorViewAdapter {
     
index a290dca..1c8c8c2 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,9 +35,6 @@ import android.view.View;
 import android.widget.TextView;
 
 /**
- * 
- * @author masensio
- * @author David A. Velasco
  *
  */
 public class X509CertificateViewAdapter implements SslUntrustedCertDialog.CertificateViewAdapter {
index eef9d09..24d7bc2 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index a9307b9..29ed390 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 91cfbfd..6cf229d 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -33,9 +36,6 @@ import com.owncloud.android.utils.DisplayUtils;
 
 /**
  * Dialog which will be displayed to user upon keep-in-sync file conflict.
- * 
- * @author Bartek Przybylski
- *
  */
 public class ConflictsResolveDialog extends SherlockDialogFragment {
 
index 29b3be2..170fe08 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -37,9 +40,7 @@ import android.widget.Toast;
 /**
  *  Dialog to input the name for a new folder to create.  
  * 
- *  Triggers the folder creation when name is confirmed. 
- *  
- *  @author David A. Velasco
+ *  Triggers the folder creation when name is confirmed.
  */
 public class CreateFolderDialogFragment 
 extends SherlockDialogFragment implements DialogInterface.OnClickListener {
index 080316b..1b99c7b 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index dbd3d99..32fa4c6 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index d0dcfb7..e8e68e7 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 2453404..c3b7ed1 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -20,9 +23,7 @@ package com.owncloud.android.ui.dialog;
 /**
  *  Dialog requiring confirmation before removing a given OCFile.  
  * 
- *  Triggers the removal according to the user response. 
- *  
- *  @author David A. Velasco
+ *  Triggers the removal according to the user response.
  */
 import java.util.Vector;
 
index d285f1e..0e7850b 100644 (file)
@@ -1,4 +1,7 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2014 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
@@ -43,9 +46,7 @@ import com.owncloud.android.ui.activity.ComponentsGetter;
 /**
  *  Dialog to input a new name for a file or folder to rename.  
  * 
- *  Triggers the rename operation when name is confirmed. 
- *  
- *  @author David A. Velasco
+ *  Triggers the rename operation when name is confirmed.
  */
 public class RenameFileDialogFragment
 extends SherlockDialogFragment implements DialogInterface.OnClickListener {
index 76243ed..31d1d2d 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Maria Asensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -44,9 +48,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 
 /**
  * Dialog to show the WebView for SAML Authentication
- * 
- * @author Maria Asensio
- * @author David A. Velasco
  */
 public class SamlWebViewDialog extends SherlockDialogFragment {
 
@@ -76,7 +77,6 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
      * @return              New dialog instance, ready to show.
      */
     public static SamlWebViewDialog newInstance(String url, String targetUrl) {
-        Log_OC.d(TAG, "New instance");
         SamlWebViewDialog fragment = new SamlWebViewDialog();
         Bundle args = new Bundle();
         args.putString(ARG_INITIAL_URL, url);
@@ -88,13 +88,12 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
     
     public SamlWebViewDialog() {
         super();
-        Log_OC.d(TAG, "constructor");
     }
     
     
     @Override
     public void onAttach(Activity activity) {
-        Log_OC.d(TAG, "onAttach");
+        Log_OC.v(TAG, "onAttach");
         super.onAttach(activity);
         try {
             mSsoWebViewClientListener = (SsoWebViewClientListener) activity;
@@ -110,7 +109,7 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
     @SuppressLint("SetJavaScriptEnabled")
     @Override
     public void onCreate(Bundle savedInstanceState) {
-        Log_OC.d(TAG, "onCreate, savedInstanceState is " + savedInstanceState);
+        Log_OC.v(TAG, "onCreate, savedInstanceState is " + savedInstanceState);
         super.onCreate(savedInstanceState);
         
         setRetainInstance(true);
@@ -132,7 +131,7 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
     @SuppressLint("SetJavaScriptEnabled")
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        Log_OC.d(TAG, "onCreateView, savedInsanceState is " + savedInstanceState);
+        Log_OC.v(TAG, "onCreateView, savedInsanceState is " + savedInstanceState);
         
         // Inflate layout of the dialog  
         RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.sso_dialog, container, false);  // null parent view because it will go in the dialog layout
@@ -144,11 +143,6 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
             mSsoWebView.setFocusableInTouchMode(true);
             mSsoWebView.setClickable(true);
             
-            CookieManager cookieManager = CookieManager.getInstance();
-            cookieManager.setAcceptCookie(true);
-            cookieManager.removeAllCookie();
-            mSsoWebView.loadUrl(mInitialUrl);
-          
             WebSettings webSettings = mSsoWebView.getSettings();
             webSettings.setJavaScriptEnabled(true);
             webSettings.setBuiltInZoomControls(false);
@@ -156,6 +150,12 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
             webSettings.setSavePassword(false);
             webSettings.setUserAgentString(OwnCloudClient.USER_AGENT);
             webSettings.setSaveFormData(false);
+            
+            CookieManager cookieManager = CookieManager.getInstance();
+            cookieManager.setAcceptCookie(true);
+            cookieManager.removeAllCookie();
+            
+            mSsoWebView.loadUrl(mInitialUrl);
         }
         
         mWebViewClient.setTargetUrl(mTargetUrl);
@@ -174,7 +174,7 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
 
     @Override
     public void onSaveInstanceState(Bundle outState) {
-        Log_OC.d(TAG, "onSaveInstanceState being CALLED");
+        Log_OC.v(TAG, "onSaveInstanceState being CALLED");
         super.onSaveInstanceState(outState);
         
         // save URLs
@@ -184,7 +184,7 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
 
     @Override
     public void onDestroyView() {
-        Log_OC.d(TAG, "onDestroyView");
+        Log_OC.v(TAG, "onDestroyView");
         
         if ((ViewGroup)mSsoWebView.getParent() != null) {
             ((ViewGroup)mSsoWebView.getParent()).removeView(mSsoWebView);
@@ -196,8 +196,6 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
         Dialog dialog = getDialog();
         if ((dialog != null)) {
             dialog.setOnDismissListener(null);
-            //dialog.dismiss();
-            //dialog.setDismissMessage(null);
         }
         
         super.onDestroyView();
@@ -205,13 +203,13 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
     
     @Override
     public void onDestroy() {
-        Log_OC.d(TAG, "onDestroy");
+        Log_OC.v(TAG, "onDestroy");
         super.onDestroy();
     }
 
     @Override
     public void onDetach() {
-        Log_OC.d(TAG, "onDetach");
+        Log_OC.v(TAG, "onDetach");
         mSsoWebViewClientListener = null;
         mWebViewClient = null;
         super.onDetach();
@@ -231,39 +229,39 @@ public class SamlWebViewDialog extends SherlockDialogFragment {
     
     @Override
     public void onStart() {
-        Log_OC.d(TAG, "onStart");
+        Log_OC.v(TAG, "onStart");
         super.onStart();
     }
 
     @Override
     public void onStop() {
-        Log_OC.d(TAG, "onStop");
+        Log_OC.v(TAG, "onStop");
         super.onStop();
     }
 
     @Override
     public void onResume() {
-        Log_OC.d(TAG, "onResume");
+        Log_OC.v(TAG, "onResume");
         super.onResume();
         mSsoWebView.onResume();
     }
 
     @Override
     public void onPause() {
-        Log_OC.d(TAG, "onPause");
+        Log_OC.v(TAG, "onPause");
         mSsoWebView.onPause();
         super.onPause();
     }
     
     @Override
     public int show (FragmentTransaction transaction, String tag) {
-        Log_OC.d(TAG, "show (transaction)");
+        Log_OC.v(TAG, "show (transaction)");
         return super.show(transaction, tag);
     }
 
     @Override
     public void show (FragmentManager manager, String tag) {
-        Log_OC.d(TAG, "show (manager)");
+        Log_OC.v(TAG, "show (manager)");
         super.show(manager, tag);
     }
     
index 2876f7b..e05f216 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -50,8 +53,6 @@ import com.owncloud.android.ui.activity.FileActivity;
 /**
  * Dialog showing a list activities able to resolve a given Intent, 
  * filtering out the activities matching give package names.
- * 
- * @author David A. Velasco
  */
 public class ShareLinkToDialog  extends SherlockDialogFragment {
     
index 167177b..6658260 100644 (file)
@@ -1,5 +1,9 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -47,10 +51,7 @@ import com.owncloud.android.ui.adapter.X509CertificateViewAdapter;
  * to decide trust on it or not.
  * 
  * Abstract implementation of common functionality for different dialogs that
- * get the information about the error and the certificate from different classes. 
- * 
- * @author masensio
- * @author David A. Velasco
+ * get the information about the error and the certificate from different classes.
  */
 public class SslUntrustedCertDialog extends SherlockDialogFragment {
     
index db20a5c..1e31c0c 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -46,8 +49,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 
 /**
  * Dialog to request the user about a certificate that could not be validated with the certificates store in the system.
- * 
- * @author David A. Velasco
  */
 public class SslValidatorDialog extends Dialog {
 
index 3a71139..dae43f8 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index f096103..1552da1 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 5abf55d..5a8da70 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 1b7a1dd..03289cf 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2012-2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -20,15 +22,17 @@ package com.owncloud.android.ui.fragment;
 
 import java.util.ArrayList;
 
+import android.content.Context;
 import android.os.Bundle;
 import android.support.v4.widget.SwipeRefreshLayout;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.AbsListView;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemClickListener;
+import android.widget.GridView;
 import android.widget.ListAdapter;
-import android.widget.ListView;
 import android.widget.TextView;
 
 import com.actionbarsherlock.app.SherlockFragment;
@@ -36,6 +40,9 @@ import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.ExtendedListView;
 import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
+import com.owncloud.android.ui.adapter.FileListListAdapter;
+
+import third_parties.in.srain.cube.GridViewWithHeaderAndFooter;
 
 /**
  * TODO extending SherlockListFragment instead of SherlockFragment
@@ -52,9 +59,8 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     private static final String KEY_HEIGHT_CELL = "HEIGHT_CELL";
     private static final String KEY_EMPTY_LIST_MESSAGE = "EMPTY_LIST_MESSAGE";
 
-    protected ExtendedListView mList;
-
-    private SwipeRefreshLayout mRefreshLayout;
+    private SwipeRefreshLayout mRefreshListLayout;
+    private SwipeRefreshLayout mRefreshGridLayout;
     private SwipeRefreshLayout mRefreshEmptyLayout;
     private TextView mEmptyListMessage;
     
@@ -66,46 +72,98 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
 
     private OnEnforceableRefreshListener mOnRefreshListener = null;
     
-    
-    public void setListAdapter(ListAdapter listAdapter) {
-        mList.setAdapter(listAdapter);
-        mList.invalidate();
+    protected AbsListView mCurrentListView;
+    private ExtendedListView mListView;
+    private View mListFooterView;
+    private GridViewWithHeaderAndFooter mGridView;
+    private View mGridFooterView;
+
+    private ListAdapter mAdapter;
+
+
+    protected void setListAdapter(ListAdapter listAdapter) {
+        mAdapter = listAdapter;
+        mCurrentListView.setAdapter(listAdapter);
+        mCurrentListView.invalidate();
     }
 
-    public void setFooterView(View footer) {
-        mList.addFooterView(footer, null, false);
-        mList.invalidate();
+    protected AbsListView getListView() {
+        return mCurrentListView;
     }
 
-    public ListView getListView() {
-        return mList;
+
+    protected void switchToGridView() {
+        if ((mCurrentListView == mListView)) {
+
+            mListView.setAdapter(null);
+            mRefreshListLayout.setVisibility(View.GONE);
+
+            if (mAdapter instanceof FileListListAdapter) {
+                ((FileListListAdapter) mAdapter).setGridMode(true);
+            }
+            mGridView.setAdapter(mAdapter);
+            mRefreshGridLayout.setVisibility(View.VISIBLE);
+
+            mCurrentListView = mGridView;
+        }
     }
+    
+    protected void switchToListView() {
+        if (mCurrentListView == mGridView) {
+            mGridView.setAdapter(null);
+            mRefreshGridLayout.setVisibility(View.GONE);
+
+            if (mAdapter instanceof FileListListAdapter) {
+                ((FileListListAdapter) mAdapter).setGridMode(false);
+            }
+            mListView.setAdapter(mAdapter);
+            mRefreshListLayout.setVisibility(View.VISIBLE);
 
+            mCurrentListView = mListView;
+        }
+    }
+    
+    
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        Log_OC.e(TAG, "onCreateView");
+        Log_OC.d(TAG, "onCreateView");
 
         View v = inflater.inflate(R.layout.list_fragment, null);
-        mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view);
-        mList = (ExtendedListView) (v.findViewById(R.id.list_root));
-        mList.setOnItemClickListener(this);
 
-        mList.setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
-        mList.setDividerHeight(1);
+        mListView = (ExtendedListView)(v.findViewById(R.id.list_root));
+        mListView.setOnItemClickListener(this);
+        mListFooterView = inflater.inflate(R.layout.list_footer, null, false);
+
+        mGridView = (GridViewWithHeaderAndFooter) (v.findViewById(R.id.grid_root));
+        mGridView.setNumColumns(GridView.AUTO_FIT);
+        mGridView.setOnItemClickListener(this);
+        mGridFooterView = inflater.inflate(R.layout.list_footer, null, false);
 
         if (savedInstanceState != null) {
             int referencePosition = savedInstanceState.getInt(KEY_SAVED_LIST_POSITION);
-            setReferencePosition(referencePosition);
+            if (mCurrentListView == mListView) {
+                Log_OC.v(TAG, "Setting and centering around list position " + referencePosition);
+                mListView.setAndCenterSelection(referencePosition);
+            } else {
+                Log_OC.v(TAG, "Setting grid position " + referencePosition);
+                mGridView.setSelection(referencePosition);
+            }
         }
 
-        // Pull down refresh
-        mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files);
-        mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files_emptyView);
+        // Pull-down to refresh layout
+        mRefreshListLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_containing_list);
+        mRefreshGridLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_containing_grid);
+        mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_containing_empty);
+        mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view);
         
-        onCreateSwipeToRefresh(mRefreshLayout);
+        onCreateSwipeToRefresh(mRefreshListLayout);
+        onCreateSwipeToRefresh(mRefreshGridLayout);
         onCreateSwipeToRefresh(mRefreshEmptyLayout);
-        
-        mList.setEmptyView(mRefreshEmptyLayout);
+
+        mListView.setEmptyView(mRefreshEmptyLayout);
+        mGridView.setEmptyView(mRefreshEmptyLayout);
+
+        mCurrentListView = mListView;   // list as default
 
         return v;
     }
@@ -136,7 +194,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     @Override
     public void onSaveInstanceState(Bundle savedInstanceState) {
         super.onSaveInstanceState(savedInstanceState);
-        Log_OC.e(TAG, "onSaveInstanceState()");
+        Log_OC.d(TAG, "onSaveInstanceState()");
         savedInstanceState.putInt(KEY_SAVED_LIST_POSITION, getReferencePosition());
         savedInstanceState.putIntegerArrayList(KEY_INDEXES, mIndexes);
         savedInstanceState.putIntegerArrayList(KEY_FIRST_POSITIONS, mFirstPositions);
@@ -150,32 +208,20 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
      * reposition the visible items in the list when the device is turned to
      * other position.
      * 
-     * THe current policy is take as a reference the visible item in the center
+     * The current policy is take as a reference the visible item in the center
      * of the screen.
      * 
      * @return The position in the list of the visible item in the center of the
      *         screen.
      */
     protected int getReferencePosition() {
-        if (mList != null) {
-            return (mList.getFirstVisiblePosition() + mList.getLastVisiblePosition()) / 2;
+        if (mCurrentListView != null) {
+            return (mCurrentListView.getFirstVisiblePosition() + mCurrentListView.getLastVisiblePosition()) / 2;
         } else {
             return 0;
         }
     }
 
-    /**
-     * Sets the visible part of the list from the reference position.
-     * 
-     * @param position Reference position previously returned by
-     *            {@link LocalFileListFragment#getReferencePosition()}
-     */
-    protected void setReferencePosition(int position) {
-        if (mList != null) {
-            mList.setAndCenterSelection(position);
-        }
-    }
-
 
     /*
      * Restore index and position
@@ -185,28 +231,28 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
             // needs to be checked; not every browse-up had a browse-down before 
             
             int index = mIndexes.remove(mIndexes.size() - 1);
-            
-            int firstPosition = mFirstPositions.remove(mFirstPositions.size() -1);
-            
+            final int firstPosition = mFirstPositions.remove(mFirstPositions.size() -1);
             int top = mTops.remove(mTops.size() - 1);
-            
-            mList.setSelectionFromTop(firstPosition, top);
-            
-            // Move the scroll if the selection is not visible
-            int indexPosition = mHeightCell*index;
-            int height = mList.getHeight();
-            
-            if (indexPosition > height) {
-                if (android.os.Build.VERSION.SDK_INT >= 11)
-                {
-                    mList.smoothScrollToPosition(index); 
+
+            Log_OC.v(TAG, "Setting selection to position: " + firstPosition + "; top: " + top + "; index: " + index);
+
+            if (mCurrentListView == mListView) {
+                if (mHeightCell*index <= mListView.getHeight()) {
+                    mListView.setSelectionFromTop(firstPosition, top);
+                } else {
+                    mListView.setSelectionFromTop(index, 0);
                 }
-                else if (android.os.Build.VERSION.SDK_INT >= 8)
-                {
-                    mList.setSelectionFromTop(index, 0);
+
+            } else {
+                if (mHeightCell*index <= mGridView.getHeight()) {
+                    mGridView.setSelection(firstPosition);
+                    //mGridView.smoothScrollToPosition(firstPosition);
+                } else {
+                    mGridView.setSelection(index);
+                    //mGridView.smoothScrollToPosition(index);
                 }
-                
             }
+
         }
     }
     
@@ -217,10 +263,10 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         
         mIndexes.add(index);
         
-        int firstPosition = mList.getFirstVisiblePosition();
+        int firstPosition = mCurrentListView.getFirstVisiblePosition();
         mFirstPositions.add(firstPosition);
         
-        View view = mList.getChildAt(0);
+        View view = mCurrentListView.getChildAt(0);
         int top = (view == null) ? 0 : view.getTop() ;
 
         mTops.add(top);
@@ -237,10 +283,10 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
 
     @Override
     public void onRefresh() {
-        // to be @overriden
-        mRefreshLayout.setRefreshing(false);
+        mRefreshListLayout.setRefreshing(false);
+        mRefreshGridLayout.setRefreshing(false);
         mRefreshEmptyLayout.setRefreshing(false);
-        
+
         if (mOnRefreshListener != null) {
             mOnRefreshListener.onRefresh();
         }
@@ -251,32 +297,18 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     
 
     /**
-     * Enables swipe gesture
-     */
-    public void enableSwipe() {
-        mRefreshLayout.setEnabled(true);
-    }
-    /**
-     * Disables swipe gesture. It prevents manual gestures but keeps the option you show
-     * refreshing programmatically.
-     */
-    public void disableSwipe() {
-        mRefreshLayout.setEnabled(false);
-    }
-    
-    /**
-     * It shows the SwipeRefreshLayout progress
-     */
-    public void showSwipeProgress() {
-        mRefreshLayout.setRefreshing(true);
-    }
-    /**
-     * It shows the SwipeRefreshLayout progress
+     * Disables swipe gesture.
+     *
+     * Sets the 'enabled' state of the refresh layouts contained in the fragment.
+     *
+     * When 'false' is set, prevents user gestures but keeps the option to refresh programatically,
+     *
+     * @param   enabled     Desired state for capturing swipe gesture.
      */
-    public void hideSwipeProgress() {
-        mRefreshLayout.setRefreshing(false);
+    public void setSwipeEnabled(boolean enabled) {
+        mRefreshListLayout.setEnabled(enabled);
+        mRefreshGridLayout.setEnabled(enabled);
+        mRefreshEmptyLayout.setEnabled(enabled);
     }
 
     /**
@@ -307,11 +339,71 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
 
     @Override
     public void onRefresh(boolean ignoreETag) {
-        mRefreshLayout.setRefreshing(false);
+        mRefreshListLayout.setRefreshing(false);
+        mRefreshGridLayout.setRefreshing(false);
         mRefreshEmptyLayout.setRefreshing(false);
 
         if (mOnRefreshListener != null) {
             mOnRefreshListener.onRefresh(ignoreETag);
         }
     }
+
+
+    protected void setChoiceMode(int choiceMode) {
+        mListView.setChoiceMode(choiceMode);
+        mGridView.setChoiceMode(choiceMode);
+    }
+
+    protected void registerForContextMenu() {
+        registerForContextMenu(mListView);
+        registerForContextMenu(mGridView);
+        mListView.setOnCreateContextMenuListener(this);
+        mGridView.setOnCreateContextMenuListener(this);
+    }
+
+    /**
+     * TODO doc
+     * To be called before setAdapter, or GridViewWithHeaderAndFooter will throw an exception
+     *
+     * @param enabled
+     */
+    protected void setFooterEnabled(boolean enabled) {
+        if (enabled) {
+            if (mGridView.getFooterViewCount() == 0) {
+                if (mGridFooterView.getParent() != null ) {
+                    ((ViewGroup) mGridFooterView.getParent()).removeView(mGridFooterView);
+                }
+                mGridView.addFooterView(mGridFooterView, null, false);
+            }
+            mGridFooterView.invalidate();
+
+            if (mListView.getFooterViewsCount() == 0) {
+                if (mListFooterView.getParent() != null ) {
+                    ((ViewGroup) mListFooterView.getParent()).removeView(mListFooterView);
+                }
+                mListView.addFooterView(mListFooterView, null, false);
+            }
+            mListFooterView.invalidate();
+
+        } else {
+            mGridView.removeFooterView(mGridFooterView);
+            mListView.removeFooterView(mListFooterView);
+        }
+    }
+
+    /**
+     * TODO doc
+     * @param text
+     */
+    protected void setFooterText(String text) {
+        if (text != null && text.length() > 0) {
+            ((TextView)mListFooterView.findViewById(R.id.footerText)).setText(text);
+            ((TextView)mGridFooterView.findViewById(R.id.footerText)).setText(text);
+            setFooterEnabled(true);
+
+        } else {
+            setFooterEnabled(false);
+        }
+    }
+
 }
index 2ff2925..6a19957 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -52,9 +56,6 @@ import com.owncloud.android.utils.DisplayUtils;
 
 /**
  * This Fragment is used to display the details about a file.
- * 
- * @author Bartek Przybylski
- * @author David A. Velasco
  */
 public class FileDetailFragment extends FileFragment implements OnClickListener {
 
@@ -348,7 +349,10 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
             // configure UI for depending upon local state of the file
             FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
             FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
-            if (transferring || (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) || (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file))) {
+            if (transferring ||
+                    (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) ||
+                    (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file))
+                    ) {
                 setButtonsForTransferring();
                 
             } else if (file.isDown()) {
@@ -396,7 +400,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
         }
         ImageView iv = (ImageView) getView().findViewById(R.id.fdIcon);
         if (iv != null) {
-            iv.setImageResource(DisplayUtils.getResourceId(mimetype, filename));
+            iv.setImageResource(DisplayUtils.getFileTypeIconId(mimetype, filename));
         }
     }
 
@@ -449,6 +453,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
             progressText.setVisibility(View.VISIBLE);
             FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
             FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
+            //if (getFile().isDownloading()) {
             if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, getFile())) {
                 progressText.setText(R.string.downloader_download_in_progress_ticker);
             } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, getFile())) {
@@ -532,9 +537,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
 
     
     /**
-     * Helper class responsible for updating the progress bar shown for file uploading or downloading  
-     * 
-     * @author David A. Velasco
+     * Helper class responsible for updating the progress bar shown for file uploading or downloading
      */
     private class ProgressListener implements OnDatatransferProgressListener {
         int mLastPercent = 0;
index 3e6fa31..87dca25 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013  ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015  ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -30,9 +33,6 @@ import com.owncloud.android.ui.activity.ComponentsGetter;
 
 /**
  * Common methods for {@link Fragment}s containing {@link OCFile}s
- * 
- * @author David A. Velasco
- *
  */
 public class FileFragment extends SherlockFragment {
     
@@ -102,8 +102,6 @@ public class FileFragment extends SherlockFragment {
     /**
      * Interface to implement by any Activity that includes some instance of FileListFragment
      * Interface to implement by any Activity that includes some instance of FileFragment
-     * 
-     * @author David A. Velasco
      */
     public interface ContainerActivity extends ComponentsGetter {
 
index c9408b1..b3e40d8 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -38,9 +41,6 @@ import com.owncloud.android.ui.adapter.LocalFileListAdapter;
 
 /**
  * A Fragment that lists all files and folders in a given LOCAL path.
- * 
- * @author David A. Velasco
- * 
  */
 public class LocalFileListFragment extends ExtendedListFragment {
     private static final String TAG = "LocalFileListFragment";
@@ -76,12 +76,12 @@ public class LocalFileListFragment extends ExtendedListFragment {
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         Log_OC.i(TAG, "onCreateView() start");
         View v = super.onCreateView(inflater, container, savedInstanceState);
-        getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
-        disableSwipe(); // Disable pull refresh
+        setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
+        setSwipeEnabled(false); // Disable pull-to-refresh
         setMessageForEmptyList(getString(R.string.local_file_list_empty));
         Log_OC.i(TAG, "onCreateView() end");
         return v;
-    }    
+    }
 
 
     /**
@@ -98,7 +98,6 @@ public class LocalFileListFragment extends ExtendedListFragment {
         Log_OC.i(TAG, "onActivityCreated() stop");
     }
     
-    
     /**
      * Checks the file clicked over. Browses inside if it is a directory. Notifies the container activity in any case.
      */
@@ -195,10 +194,10 @@ public class LocalFileListFragment extends ExtendedListFragment {
             directory = directory.getParentFile();
         }
 
-        mList.clearChoices();   // by now, only files in the same directory will be kept as selected
+        mCurrentListView.clearChoices();   // by now, only files in the same directory will be kept as selected
         mAdapter.swapDirectory(directory);
         if (mDirectory == null || !mDirectory.equals(directory)) {
-            mList.setSelectionFromTop(0, 0);
+            mCurrentListView.setSelection(0);
         }
         mDirectory = directory;
     }
@@ -211,11 +210,11 @@ public class LocalFileListFragment extends ExtendedListFragment {
      */
     public String[] getCheckedFilePaths() {
         ArrayList<String> result = new ArrayList<String>();
-        SparseBooleanArray positions = mList.getCheckedItemPositions();
+        SparseBooleanArray positions = mCurrentListView.getCheckedItemPositions();
         if (positions.size() > 0) {
             for (int i = 0; i < positions.size(); i++) {
                 if (positions.get(positions.keyAt(i)) == true) {
-                    result.add(((File) mList.getItemAtPosition(positions.keyAt(i))).getAbsolutePath());
+                    result.add(((File) mCurrentListView.getItemAtPosition(positions.keyAt(i))).getAbsolutePath());
                 }
             }
 
@@ -227,15 +226,13 @@ public class LocalFileListFragment extends ExtendedListFragment {
     
     /**
      * Interface to implement by any Activity that includes some instance of LocalFileListFragment
-     * 
-     * @author David A. Velasco
      */
     public interface ContainerActivity {
 
         /**
          * Callback method invoked when a directory is clicked by the user on the files list
          *  
-         * @param file
+         * @param directory
          */
         public void onDirectoryClick(File directory);
         
index fd0b1a5..60ac78d 100644 (file)
@@ -1,6 +1,11 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author Bartek Przybylski
+ *   @author masensio
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2014 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
 package com.owncloud.android.ui.fragment;
 
 import java.io.File;
-import java.util.Vector;
 
 import android.app.Activity;
-import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.widget.SwipeRefreshLayout;
@@ -31,8 +34,6 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.TextView;
-import android.view.LayoutInflater;
 
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -48,15 +49,12 @@ import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
 import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
 import com.owncloud.android.ui.preview.PreviewImageFragment;
 import com.owncloud.android.ui.preview.PreviewMediaFragment;
+import com.owncloud.android.utils.FileStorageUtils;
 
 /**
  * A Fragment that lists all files and folders in a given path.
  * 
  * TODO refactorize to get rid of direct dependency on FileDisplayActivity
- * 
- * @author Bartek Przybylski
- * @author masensio
- * @author David A. Velasco
  */
 public class OCFileListFragment extends ExtendedListFragment {
     
@@ -70,11 +68,13 @@ public class OCFileListFragment extends ExtendedListFragment {
             
     private static final String KEY_FILE = MY_PACKAGE + ".extra.FILE";
 
+    private final static Double THUMBNAIL_THRESHOLD = 0.5;
+
     private FileFragment.ContainerActivity mContainerActivity;
    
     private OCFile mFile = null;
     private FileListListAdapter mAdapter;
-    private View mFooterView;
+    private boolean mJustFolders;
     
     private OCFile mTargetFile;
 
@@ -122,22 +122,23 @@ public class OCFileListFragment extends ExtendedListFragment {
             mFile = savedInstanceState.getParcelable(KEY_FILE);
         }
 
-        mFooterView = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
-                        R.layout.list_footer, null, false);
-        setFooterView(mFooterView);
+        if (mJustFolders) {
+            setFooterEnabled(false);
+        } else {
+            setFooterEnabled(true);
+        }
 
         Bundle args = getArguments();
-        boolean justFolders = (args == null) ? false : args.getBoolean(ARG_JUST_FOLDERS, false); 
+        mJustFolders = (args == null) ? false : args.getBoolean(ARG_JUST_FOLDERS, false);
         mAdapter = new FileListListAdapter(
-                justFolders,
-                getSherlockActivity(), 
+                mJustFolders,
+                getSherlockActivity(),
                 mContainerActivity
                 );
         setListAdapter(mAdapter);
 
-        registerForContextMenu(getListView());
-        getListView().setOnCreateContextMenuListener(this);
-    }
+        registerForContextMenu();
+  }
 
     /**
      * Saves the current listed folder.
@@ -257,15 +258,9 @@ public class OCFileListFragment extends ExtendedListFragment {
                 );
                 mf.filter(menu);
             }
-            
-            /// additional restrictions for this fragment 
-            // TODO allow in the future 'open with' for previewable files
-            MenuItem item = menu.findItem(R.id.action_open_file_with);
-            if (item != null) {
-                item.setVisible(false);
-                item.setEnabled(false);
-            }
+                 
             /// TODO break this direct dependency on FileDisplayActivity... if possible
+            MenuItem item = menu.findItem(R.id.action_open_file_with);
             FileFragment frag = ((FileDisplayActivity)getSherlockActivity()).getSecondFragment();
             if (frag != null && frag instanceof FileDetailFragment && 
                     frag.getFile().getFileId() == targetFile.getFileId()) {
@@ -291,6 +286,10 @@ public class OCFileListFragment extends ExtendedListFragment {
                 mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile);
                 return true;
             }
+            case R.id.action_open_file_with: {
+                mContainerActivity.getFileOperationsHelper().openFile(mTargetFile);
+                return true;
+            }
             case R.id.action_unshare_file: {
                 mContainerActivity.getFileOperationsHelper().unshareFileWithLink(mTargetFile);
                 return true;
@@ -390,64 +389,75 @@ public class OCFileListFragment extends ExtendedListFragment {
 
             mAdapter.swapDirectory(directory, storageManager);
             if (mFile == null || !mFile.equals(directory)) {
-                mList.setSelectionFromTop(0, 0);
+                mCurrentListView.setSelection(0);
             }
             mFile = directory;
-            
-            // Update Footer
-            TextView footerText = (TextView) mFooterView.findViewById(R.id.footerText);
-            Log_OC.d("footer", String.valueOf(System.currentTimeMillis()));
-            footerText.setText(generateFooterText(directory));
-            Log_OC.d("footer", String.valueOf(System.currentTimeMillis()));
+
+            updateLayout();
+
         }
     }
-    
-    private String generateFooterText(OCFile directory) {
-        Integer files = 0;
-        Integer folders = 0;
 
-        FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
-        Vector<OCFile> mFiles = storageManager.getFolderContent(mFile);
+    private void updateLayout() {
+        if (!mJustFolders) {
+            int filesCount = 0, foldersCount = 0, imagesCount = 0;
+            int count = mAdapter.getCount();
+            OCFile file;
+            for (int i=0; i < count ; i++) {
+                file = (OCFile) mAdapter.getItem(i);
+                if (file.isFolder()) {
+                    foldersCount++;
+                } else {
+                    filesCount++;
+                    if (file.isImage()){
+                        imagesCount++;
+                    }
+                }
+            }
+            // set footer text
+            setFooterText(generateFooterText(filesCount, foldersCount));
 
-        for (OCFile ocFile : mFiles) {
-            if (ocFile.isFolder()) {
-                folders++;
+            // decide grid vs list view
+            if (((double)imagesCount / (double)filesCount) >= THUMBNAIL_THRESHOLD) {
+                switchToGridView();
             } else {
-                files++;
+                switchToListView();
             }
         }
+    }
 
+    private String generateFooterText(int filesCount, int foldersCount) {
         String output = "";
-       
-        if (files > 0){
-            if (files == 1) {
-                output = output + files.toString() + " " + getResources().getString(R.string.file_list_file);
+        if (filesCount > 0){
+            if (filesCount == 1) {
+                output = output + filesCount + " " + getResources().getString(R.string.file_list_file);
             } else {
-                output = output + files.toString() + " " + getResources().getString(R.string.file_list_files);
+                output = output + filesCount + " " + getResources().getString(R.string.file_list_files);
             }
         }
-        if (folders > 0 && files > 0){
+        if (foldersCount > 0 && filesCount > 0){
             output = output + ", ";
         }
-        if (folders == 1) {
-            output = output + folders.toString() + " " + getResources().getString(R.string.file_list_folder);
-        } else if (folders > 1) {
-            output = output + folders.toString() + " " + getResources().getString(R.string.file_list_folders);
+        if (foldersCount == 1) {
+            output = output + foldersCount + " " + getResources().getString(R.string.file_list_folder);
+        } else if (foldersCount > 1) {
+            output = output + foldersCount + " " + getResources().getString(R.string.file_list_folders);
         }
-        
+
         return output;
     }
-    
+
+
     public void sortByName(boolean descending) {
-        mAdapter.setSortOrder(FileListListAdapter.SORT_NAME, descending);
+        mAdapter.setSortOrder(FileStorageUtils.SORT_NAME, descending);
     }
 
     public void sortByDate(boolean descending) {
-        mAdapter.setSortOrder(FileListListAdapter.SORT_DATE, descending);
+        mAdapter.setSortOrder(FileStorageUtils.SORT_DATE, descending);
     }
 
     public void sortBySize(boolean descending) {
-        mAdapter.setSortOrder(FileListListAdapter.SORT_SIZE, descending);
+        mAdapter.setSortOrder(FileStorageUtils.SORT_SIZE, descending);
     }  
 
 }
index 98bbda3..99a4d44 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
- * 
- *   Copyright (C) 2012-2013  ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015  ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -42,8 +44,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 
 /**
  * This Fragment is used to monitor the progress of a file downloading.
- * 
- * @author David A. Velasco
  */
 public class FileDownloadFragment extends FileFragment implements OnClickListener {
 
@@ -211,10 +211,11 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
      * @param   transferring    When true, the view must be updated assuming that the holded file is 
      *                          downloading, no matter what the downloaderBinder says.
      */
+    /*
     public void updateView(boolean transferring) {
         // configure UI for depending upon local state of the file
-        FileDownloaderBinder downloaderBinder = (mContainerActivity == null) ? null : mContainerActivity.getFileDownloaderBinder();
-        if (transferring || (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, getFile()))) {
+        // TODO remove
+        if (transferring || getFile().isDownloading()) {
             setButtonsForTransferring();
             
         } else if (getFile().isDown()) {
@@ -227,7 +228,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
         getView().invalidate();
         
     }
-
+    */
 
     /**
      * Enables or disables buttons for a file being downloaded
@@ -307,9 +308,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
 
     
     /**
-     * Helper class responsible for updating the progress bar shown for file uploading or downloading  
-     * 
-     * @author David A. Velasco
+     * Helper class responsible for updating the progress bar shown for file uploading or downloading
      */
     private class ProgressListener implements OnDatatransferProgressListener {
         int mLastPercent = 0;
index 1cee30e..1f6ab80 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013  ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015  ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -62,8 +65,6 @@ import com.owncloud.android.utils.DisplayUtils;
 
 /**
  *  Holds a swiping galley where image files contained in an ownCloud directory are shown
- *  
- *  @author David A. Velasco
  */
 public class PreviewImageActivity extends FileActivity implements 
  FileFragment.ContainerActivity,
@@ -426,7 +427,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
     
 
     /**
-     * Class waiting for broadcast events from the {@link FielDownloader} service.
+     * Class waiting for broadcast events from the {@link FileDownloader} service.
      * 
      * Updates the UI when a download is started or finished, provided that it is relevant for the
      * folder displayed in the gallery.
index 0995793..9d1cd60 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc. 
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -54,8 +57,8 @@ import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
 import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.BitmapUtils;
-import com.owncloud.android.utils.TouchImageViewCustom;
 
+import third_parties.michaelOrtiz.TouchImageViewCustom;
 
 
 /**
@@ -64,8 +67,6 @@ import com.owncloud.android.utils.TouchImageViewCustom;
  * Trying to get an instance with NULL {@link OCFile} or ownCloud {@link Account} values will produce an {@link IllegalStateException}.
  * 
  * If the {@link OCFile} passed is not downloaded, an {@link IllegalStateException} is generated on instantiation too.
- * 
- * @author David A. Velasco
  */
 public class PreviewImageFragment extends FileFragment {
 
index f2a9a9b..14ae34f 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013  ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015  ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -16,6 +19,8 @@
  */
 package com.owncloud.android.ui.preview;
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -31,12 +36,12 @@ import android.view.ViewGroup;
 
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.ui.adapter.FileListListAdapter;
 import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.utils.FileStorageUtils;
 
 /**
- * Adapter class that provides Fragment instances  
- * 
- * @author David A. Velasco
+ * Adapter class that provides Fragment instances
  */
 //public class PreviewImagePagerAdapter extends PagerAdapter {
 public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
@@ -73,13 +78,15 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
         mAccount = account;
         mStorageManager = storageManager;
         mImageFiles = mStorageManager.getFolderImages(parentFolder); 
+        
+        mImageFiles = FileStorageUtils.sortFolder(mImageFiles);
+        
         mObsoleteFragments = new HashSet<Object>();
         mObsoletePositions = new HashSet<Integer>();
         mDownloadErrors = new HashSet<Integer>();
         //mFragmentManager = fragmentManager;
         mCachedFragments = new HashMap<Integer, FileFragment>();
     }
-
     
     /**
      * Returns the image files handled by the adapter.
index 7d6489b..d82faa5 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc. 
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -64,8 +67,6 @@ import com.owncloud.android.ui.fragment.FileFragment;
  * Trying to get an instance with NULL {@link OCFile} or ownCloud {@link Account} values will produce an {@link IllegalStateException}.
  * 
  * By now, if the {@link OCFile} passed is not downloaded, an {@link IllegalStateException} is generated on instantiation too.
- * 
- * @author David A. Velasco
  */
 public class PreviewMediaFragment extends FileFragment implements
         OnTouchListener {
index 39e8e23..938d52d 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -45,9 +48,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
  *  Used as an utility to preview video files contained in an ownCloud account.
  *  
  *  Currently, it always plays in landscape mode, full screen. When the playback ends,
- *  the activity is finished. 
- *  
- *  @author David A. Velasco
+ *  the activity is finished.
  */
 public class PreviewVideoActivity extends FileActivity implements OnCompletionListener, OnPreparedListener, OnErrorListener {
 
index 7036727..ce7590d 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -23,11 +26,13 @@ import android.graphics.BitmapFactory;
 import android.graphics.Matrix;
 import android.graphics.BitmapFactory.Options;
 import android.media.ExifInterface;
+import android.net.Uri;
+import android.webkit.MimeTypeMap;
+
+import java.io.File;
 
 /**
  * Utility class with methods for decoding Bitmaps.
- * 
- * @author David A. Velasco
  */
 public class BitmapUtils {
     
@@ -169,6 +174,18 @@ public class BitmapUtils {
         }
         return resultBitmap;
     }
-    
+
+    /**
+     * Checks if file passed is an image
+     * @param file
+     * @return true/false
+     */
+    public static boolean isImage(File file) {
+        Uri selectedUri = Uri.fromFile(file);
+        String fileExtension = MimeTypeMap.getFileExtensionFromUrl(selectedUri.toString().toLowerCase());
+        String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
+
+        return (mimeType != null && mimeType.startsWith("image/"));
+    }
     
 }
index a1afb89..905f60b 100644 (file)
@@ -1,6 +1,10 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
+ *   @author David A. Velasco\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
 package com.owncloud.android.utils;\r
 \r
 import java.net.IDN;\r
+import java.text.DateFormat;\r
 import java.util.Arrays;\r
 import java.util.Calendar;\r
 import java.util.Date;\r
 import java.util.HashMap;\r
 import java.util.HashSet;\r
 import java.util.Set;\r
+import java.util.Vector;\r
 \r
 import android.annotation.TargetApi;\r
 import android.content.Context;\r
 import android.os.Build;\r
 import android.text.format.DateUtils;\r
+import android.webkit.MimeTypeMap;\r
 \r
 import com.owncloud.android.MainApp;\r
 import com.owncloud.android.R;\r
@@ -37,9 +44,6 @@ import com.owncloud.android.datamodel.OCFile;
 \r
 /**\r
  * A helper class for some string operations.\r
- * \r
- * @author Bartek Przybylski\r
- * @author David A. Velasco\r
  */\r
 public class DisplayUtils {\r
     \r
@@ -73,21 +77,28 @@ public class DisplayUtils {
     private static final String TYPE_VIDEO = "video";\r
     \r
     private static final String SUBTYPE_PDF = "pdf";\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 final String SUBTYPE_XML = "xml";\r
+    private static final String[] SUBTYPES_DOCUMENT = { \r
+        "msword",\r
+        "vnd.openxmlformats-officedocument.wordprocessingml.document",\r
+        "vnd.oasis.opendocument.text",\r
+        "rtf",\r
+        "javascript"\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 final String[] SUBTYPES_SPREADSHEET = {\r
+        "msexcel",\r
+        "vnd.ms-excel",\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 final String[] SUBTYPES_PRESENTATION = { \r
+        "mspowerpoint",\r
+        "vnd.ms-powerpoint",\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
@@ -95,6 +106,8 @@ public class DisplayUtils {
     private static final String EXTENSION_RAR = "rar";\r
     private static final String EXTENSION_RTF = "rtf";\r
     private static final String EXTENSION_3GP = "3gp";\r
+    private static final String EXTENSION_PY = "py";\r
+    private static final String EXTENSION_JS = "js";\r
     \r
     /**\r
      * Converts the file size in bytes to human readable output.\r
@@ -114,30 +127,6 @@ public class DisplayUtils {
     }\r
 \r
     /**\r
-     * Removes special HTML entities from a string\r
-     * \r
-     * @param s Input string\r
-     * @return A cleaned version of the string\r
-     */\r
-    public static String HtmlDecode(String s) {\r
-        /*\r
-         * TODO: Perhaps we should use something more proven like:\r
-         * http://commons.apache.org/lang/api-2.6/org/apache/commons/lang/StringEscapeUtils.html#unescapeHtml%28java.lang.String%29\r
-         */\r
-\r
-        String ret = "";\r
-        for (int i = 0; i < s.length(); ++i) {\r
-            if (s.charAt(i) == '%') {\r
-                ret += (char) Integer.parseInt(s.substring(i + 1, i + 3), 16);\r
-                i += 2;\r
-            } else {\r
-                ret += s.charAt(i);\r
-            }\r
-        }\r
-        return ret;\r
-    }\r
-\r
-    /**\r
      * Converts MIME types like "image/jpg" to more end user friendly output\r
      * like "JPG image".\r
      * \r
@@ -155,18 +144,25 @@ public class DisplayUtils {
     \r
     \r
     /**\r
-     * Returns the resource identifier of an image resource to use as icon associated to a \r
-     * known MIME type.\r
+     * Returns the resource identifier of an image to use as icon associated to a known MIME type.\r
      * \r
-     * @param mimetype      MIME type string.\r
-     * @param filename      name, with extension\r
-     * @return              Resource identifier of an image resource.\r
+     * @param mimetype      MIME type string; if NULL, the method tries to guess it from the extension in filename\r
+     * @param filename      Name, with extension.\r
+     * @return              Identifier of an image resource.\r
      */\r
-    public static int getResourceId(String mimetype, String filename) {\r
+    public static int getFileTypeIconId(String mimetype, String filename) {\r
 \r
-        if (mimetype == null || "DIR".equals(mimetype)) {\r
-            return R.drawable.ic_menu_archive;\r
+        if (mimetype == null) {\r
+            String fileExtension = getExtension(filename);\r
+            mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);\r
+            if (mimetype == null) {\r
+                mimetype = TYPE_APPLICATION + "/" + SUBTYPE_OCTET_STREAM;\r
+            }\r
+        } \r
             \r
+        if ("DIR".equals(mimetype)) {\r
+            return R.drawable.ic_menu_archive;\r
+\r
         } else {\r
             String [] parts = mimetype.split("/");\r
             String type = parts[0];\r
@@ -189,6 +185,9 @@ public class DisplayUtils {
                 if (SUBTYPE_PDF.equals(subtype)) {\r
                     return R.drawable.file_pdf;\r
                     \r
+                } else if (SUBTYPE_XML.equals(subtype)) {\r
+                    return R.drawable.file_doc;\r
+\r
                 } else if (SUBTYPES_DOCUMENT_SET.contains(subtype)) {\r
                     return R.drawable.file_doc;\r
 \r
@@ -200,7 +199,7 @@ public class DisplayUtils {
 \r
                 } else if (SUBTYPES_COMPRESSED_SET.contains(subtype)) {\r
                     return R.drawable.file_zip;\r
-                    \r
+\r
                 } else if (SUBTYPE_OCTET_STREAM.equals(subtype) ) {\r
                     if (getExtension(filename).equalsIgnoreCase(EXTENSION_RAR)) {\r
                         return R.drawable.file_zip;\r
@@ -210,7 +209,10 @@ public class DisplayUtils {
                         \r
                     } else if (getExtension(filename).equalsIgnoreCase(EXTENSION_3GP)) {\r
                         return R.drawable.file_movie;\r
-                        \r
+                     \r
+                    } else if ( getExtension(filename).equalsIgnoreCase(EXTENSION_PY) ||\r
+                                getExtension(filename).equalsIgnoreCase(EXTENSION_JS)) {\r
+                        return R.drawable.file_doc;\r
                     } \r
                 } \r
             }\r
@@ -222,19 +224,19 @@ public class DisplayUtils {
 \r
     \r
     private static String getExtension(String filename) {\r
-        String extension = filename.substring(filename.lastIndexOf(".") + 1);\r
-        \r
+        String extension = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();\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
+     * @param milliseconds that have passed since 01/01/1970\r
      * @return The human readable time for the users locale\r
      */\r
     public static String unixTimeToHumanReadable(long milliseconds) {\r
         Date date = new Date(milliseconds);\r
-        return date.toLocaleString();\r
+        DateFormat df = DateFormat.getDateTimeInstance();\r
+        return df.format(date);\r
     }\r
     \r
     \r
@@ -295,7 +297,11 @@ public class DisplayUtils {
         return fileExtension;\r
     }\r
 \r
-    public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution, long transitionResolution, int flags){\r
+    @SuppressWarnings("deprecation")\r
+    public static CharSequence getRelativeDateTimeString (\r
+            Context c, long time, long minResolution, long transitionResolution, int flags\r
+            ){\r
+        \r
         CharSequence dateString = "";\r
         \r
         // in Future\r
@@ -307,18 +313,21 @@ public class DisplayUtils {
             return c.getString(R.string.file_list_seconds_ago);\r
         } else {\r
             // Workaround 2.x bug (see https://github.com/owncloud/android/issues/716)\r
-            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB && (System.currentTimeMillis() - time) > 24 * 60 * 60 * 1000){\r
+            if (    Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB && \r
+                    (System.currentTimeMillis() - time) > 24 * 60 * 60 * 1000   ) {\r
                 Date date = new Date(time);\r
                 date.setHours(0);\r
                 date.setMinutes(0);\r
                 date.setSeconds(0);\r
-                dateString = DateUtils.getRelativeDateTimeString(c, date.getTime(), minResolution, transitionResolution, flags);\r
+                dateString = DateUtils.getRelativeDateTimeString(\r
+                        c, date.getTime(), minResolution, transitionResolution, flags\r
+                );\r
             } else {\r
                 dateString = DateUtils.getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags);\r
             }\r
         }\r
         \r
-        return dateString.toString().split(",")[0];
+        return dateString.toString().split(",")[0];\r
     }\r
 \r
     /**\r
@@ -333,4 +342,5 @@ public class DisplayUtils {
         }\r
         return path;\r
     }\r
+\r
 }\r
index e56e876..12a1a5a 100644 (file)
@@ -1,4 +1,7 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
  *   Copyright (C) 2014 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
@@ -36,14 +39,13 @@ import com.owncloud.android.operations.MoveFileOperation;
 import com.owncloud.android.operations.RemoveFileOperation;
 import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
+import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
 import com.owncloud.android.operations.UploadFileOperation;
 
 /**
- * Class to choose proper error messages to show to the user depending on the results of operations, always following the same policy
- * 
- * @author masensio
- *
+ * Class to choose proper error messages to show to the user depending on the results of operations,
+ * always following the same policy
  */
 
 public class ErrorMessageAdapter {
@@ -206,6 +208,21 @@ public class ErrorMessageAdapter {
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.move_file_error);
             }
+        } else if (operation instanceof SynchronizeFolderOperation) {
+
+            if (!result.isSuccess()) {
+                String folderPathName = new File(
+                        ((SynchronizeFolderOperation) operation).getFolderPath()).getName();
+                if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
+                    message = String.format(res.getString(R.string.sync_current_folder_was_removed),
+                            folderPathName);
+
+                } else {    // Generic error
+                    // Show a Message, operation finished without success
+                    message = String.format(res.getString(R.string.download_folder_failed_content),
+                            folderPathName);
+                }
+            }
         }
         
         return message;
index 892a1ca..e70302f 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
 package com.owncloud.android.utils;
 
 import java.io.File;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Vector;
+
+import third_parties.daveKoeller.AlphanumComparator;
 
 import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
@@ -31,14 +39,20 @@ import android.preference.PreferenceManager;
 import android.net.Uri;
 import android.os.Environment;
 import android.os.StatFs;
+import android.webkit.MimeTypeMap;
 
 
 /**
  * Static methods to help in access to local file system.
- * 
- * @author David A. Velasco
  */
 public class FileStorageUtils {
+    public static Integer mSortOrder;
+    public static Boolean mSortAscending;
+    public static final Integer SORT_NAME = 0;
+    public static final Integer SORT_DATE = 1;
+    public static final Integer SORT_SIZE = 2;
+  
+    
     //private static final String LOG_TAG = "FileStorageUtils";
 
     public static final String getSavePath(String accountName) {
@@ -123,7 +137,7 @@ public class FileStorageUtils {
     /**
      * Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}.
      * 
-     * @param oCFile    OCFile 
+     * @param ocFile    OCFile
      * @return          New RemoteFile instance representing the resource described by ocFile.
      */
     public static RemoteFile fillRemoteFile(OCFile ocFile){
@@ -137,5 +151,156 @@ public class FileStorageUtils {
         file.setRemoteId(ocFile.getRemoteId());
         return file;
     }
+    
+    /**
+     * Sorts all filenames, regarding last user decision 
+     */
+    public static Vector<OCFile> sortFolder(Vector<OCFile> files){
+        switch (mSortOrder){
+        case 0:
+            files = FileStorageUtils.sortByName(files);
+            break;
+        case 1:
+            files = FileStorageUtils.sortByDate(files);
+            break;
+        case 2: 
+           // mFiles = FileStorageUtils.sortBySize(mSortAscending);
+            break;
+        }
+       
+        return files;
+    }
+    
+    /**
+     * Sorts list by Date
+     * @param files
+     */
+    public static Vector<OCFile> sortByDate(Vector<OCFile> files){
+        final Integer val;
+        if (mSortAscending){
+            val = 1;
+        } else {
+            val = -1;
+        }
+        
+        Collections.sort(files, new Comparator<OCFile>() {
+            public int compare(OCFile o1, OCFile o2) {
+                if (o1.isFolder() && o2.isFolder()) {
+                    Long obj1 = o1.getModificationTimestamp();
+                    return val * obj1.compareTo(o2.getModificationTimestamp());
+                }
+                else if (o1.isFolder()) {
+                    return -1;
+                } else if (o2.isFolder()) {
+                    return 1;
+                } else if (o1.getModificationTimestamp() == 0 || o2.getModificationTimestamp() == 0){
+                    return 0;
+                } else {
+                    Long obj1 = o1.getModificationTimestamp();
+                    return val * obj1.compareTo(o2.getModificationTimestamp());
+                }
+            }
+        });
+        
+        return files;
+    }
+
+//    /**
+//     * Sorts list by Size
+//     * @param sortAscending true: ascending, false: descending
+//     */
+//    public static Vector<OCFile> sortBySize(Vector<OCFile> files){
+//        final Integer val;
+//        if (mSortAscending){
+//            val = 1;
+//        } else {
+//            val = -1;
+//        }
+//        
+//        Collections.sort(files, new Comparator<OCFile>() {
+//            public int compare(OCFile o1, OCFile o2) {
+//                if (o1.isFolder() && o2.isFolder()) {
+//                    Long obj1 = getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1)));
+//                    return val * obj1.compareTo(getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2))));
+//                }
+//                else if (o1.isFolder()) {
+//                    return -1;
+//                } else if (o2.isFolder()) {
+//                    return 1;
+//                } else if (o1.getFileLength() == 0 || o2.getFileLength() == 0){
+//                    return 0;
+//                } else {
+//                    Long obj1 = o1.getFileLength();
+//                    return val * obj1.compareTo(o2.getFileLength());
+//                }
+//            }
+//        });
+//        
+//        return files;
+//    }
+
+    /**
+     * Sorts list by Name
+     * @param files     files to sort
+     */
+    public static Vector<OCFile> sortByName(Vector<OCFile> files){
+        final Integer val;
+        if (mSortAscending){
+            val = 1;
+        } else {
+            val = -1;
+        }
+
+        Collections.sort(files, new Comparator<OCFile>() {
+            public int compare(OCFile o1, OCFile o2) {
+                if (o1.isFolder() && o2.isFolder()) {
+                    return val * o1.getRemotePath().toLowerCase().compareTo(o2.getRemotePath().toLowerCase());
+                } else if (o1.isFolder()) {
+                    return -1;
+                } else if (o2.isFolder()) {
+                    return 1;
+                }
+                return val * new AlphanumComparator().compare(o1, o2);
+            }
+        });
+        
+        return files;
+    }
+    
+    /**
+     * Local Folder size
+     * @param dir File
+     * @return Size in bytes
+     */
+    public static long getFolderSize(File dir) {
+        if (dir.exists()) {
+            long result = 0;
+            File[] fileList = dir.listFiles();
+            for(int i = 0; i < fileList.length; i++) {
+                if(fileList[i].isDirectory()) {
+                    result += getFolderSize(fileList[i]);
+                } else {
+                    result += fileList[i].length();
+                }
+            }
+            return result;
+        }
+        return 0;
+    }
+
+    /**
+     * Mimetype String of a file
+     * @param path
+     * @return
+     */
+    public static String getMimeTypeFromName(String path) {
+        String extension = "";
+        int pos = path.lastIndexOf('.');
+        if (pos >= 0) {
+            extension = path.substring(pos + 1);
+        }
+        String result = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
+        return (result != null) ? result : "";
+    }
   
 }
index 13ead88..6292a2b 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application\r
+/**\r
+ *   ownCloud Android client application\r
+ *\r
+ *   @author Bartek Przybylski\r
  *   Copyright (C) 2011  Bartek Przybylski\r
- *   Copyright (C) 2012-2013 ownCloud Inc.\r
+ *   Copyright (C) 2015 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
  *   it under the terms of the GNU General Public License version 2,\r
@@ -19,9 +22,6 @@ package com.owncloud.android.utils;
 \r
 /**\r
  * Represents a session to an ownCloud instance\r
- * \r
- * @author Bartek Przybylski\r
- * \r
  */\r
 public class OwnCloudSession {\r
     private String mSessionName;\r
index be44f8f..4a70631 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
diff --git a/src/com/owncloud/android/utils/TouchImageViewCustom.java b/src/com/owncloud/android/utils/TouchImageViewCustom.java
deleted file mode 100644 (file)
index a0f7b79..0000000
+++ /dev/null
@@ -1,1276 +0,0 @@
-/*
- * TouchImageView.java
- * By: Michael Ortiz
- * Updated By: Patrick Lackemacher
- * Updated By: Babay88
- * Updated By: @ipsilondev
- * Updated By: hank-cp
- * Updated By: singpolyma
- * -------------------
- * Extends Android ImageView to include pinch zooming, panning, fling and double tap zoom.
- */
-
-package com.owncloud.android.utils;
-
-import com.owncloud.android.ui.preview.ImageViewCustom;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.PointF;
-import android.graphics.RectF;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Build.VERSION;
-import android.os.Build.VERSION_CODES;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.GestureDetector;
-import android.view.MotionEvent;
-import android.view.ScaleGestureDetector;
-import android.view.View;
-import android.view.animation.AccelerateDecelerateInterpolator;
-import android.widget.OverScroller;
-import android.widget.Scroller;
-
-public class TouchImageViewCustom extends ImageViewCustom {
-    private static final String DEBUG = "DEBUG";
-       
-       //
-       // SuperMin and SuperMax multipliers. Determine how much the image can be
-       // zoomed below or above the zoom boundaries, before animating back to the
-       // min/max zoom boundary.
-       //
-       private static final float SUPER_MIN_MULTIPLIER = .75f;
-       private static final float SUPER_MAX_MULTIPLIER = 1.25f;
-
-    //
-    // Scale of image ranges from minScale to maxScale, where minScale == 1
-    // when the image is stretched to fit view.
-    //
-    private float normalizedScale;
-    
-    //
-    // Matrix applied to image. MSCALE_X and MSCALE_Y should always be equal.
-    // MTRANS_X and MTRANS_Y are the other values used. prevMatrix is the matrix
-    // saved prior to the screen rotating.
-    //
-       private Matrix matrix, prevMatrix;
-
-    private static enum State { NONE, DRAG, ZOOM, FLING, ANIMATE_ZOOM };
-    private State state;
-
-    private float minScale;
-    private float maxScale;
-    private float superMinScale;
-    private float superMaxScale;
-    private float[] m;
-    
-    private Context context;
-    private Fling fling;
-    
-    private ScaleType mScaleType;
-    
-    private boolean imageRenderedAtLeastOnce;
-    private boolean onDrawReady;
-    
-    private ZoomVariables delayedZoomVariables;
-
-    //
-    // Size of view and previous view size (ie before rotation)
-    //
-    private int viewWidth, viewHeight, prevViewWidth, prevViewHeight;
-    
-    //
-    // Size of image when it is stretched to fit view. Before and After rotation.
-    //
-    private float matchViewWidth, matchViewHeight, prevMatchViewWidth, prevMatchViewHeight;
-    
-    private ScaleGestureDetector mScaleDetector;
-    private GestureDetector mGestureDetector;
-    private GestureDetector.OnDoubleTapListener doubleTapListener = null;
-    private OnTouchListener userTouchListener = null;
-    private OnTouchImageViewListener touchImageViewListener = null;
-
-    public TouchImageViewCustom(Context context) {
-        super(context);
-        sharedConstructing(context);
-    }
-
-    public TouchImageViewCustom(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        sharedConstructing(context);
-    }
-    
-    public TouchImageViewCustom(Context context, AttributeSet attrs, int defStyle) {
-       super(context, attrs, defStyle);
-       sharedConstructing(context);
-    }
-    
-    private void sharedConstructing(Context context) {
-        super.setClickable(true);
-        this.context = context;
-        mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
-        mGestureDetector = new GestureDetector(context, new GestureListener());
-        matrix = new Matrix();
-        prevMatrix = new Matrix();
-        m = new float[9];
-        normalizedScale = 1;
-        if (mScaleType == null) {
-               mScaleType = ScaleType.FIT_CENTER;
-        }
-        minScale = 1;
-        maxScale = 3;
-        superMinScale = SUPER_MIN_MULTIPLIER * minScale;
-        superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
-        setImageMatrix(matrix);
-        setScaleType(ScaleType.MATRIX);
-        setState(State.NONE);
-        onDrawReady = false;
-        super.setOnTouchListener(new PrivateOnTouchListener());
-    }
-
-    @Override
-    public void setOnTouchListener(View.OnTouchListener l) {
-        userTouchListener = l;
-    }
-    
-    public void setOnTouchImageViewListener(OnTouchImageViewListener l) {
-       touchImageViewListener = l;
-    }
-
-    public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener l) {
-        doubleTapListener = l;
-    }
-
-    @Override
-    public void setImageResource(int resId) {
-       super.setImageResource(resId);
-       savePreviousImageValues();
-       fitImageToView();
-    }
-    
-    @Override
-    public void setImageBitmap(Bitmap bm) {
-       super.setImageBitmap(bm);
-       savePreviousImageValues();
-       fitImageToView();
-    }
-    
-    @Override
-    public void setImageDrawable(Drawable drawable) {
-       super.setImageDrawable(drawable);
-       savePreviousImageValues();
-       fitImageToView();
-    }
-    
-    @Override
-    public void setImageURI(Uri uri) {
-       super.setImageURI(uri);
-       savePreviousImageValues();
-       fitImageToView();
-    }
-    
-    @Override
-    public void setScaleType(ScaleType type) {
-       if (type == ScaleType.FIT_START || type == ScaleType.FIT_END) {
-               throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
-       }
-       if (type == ScaleType.MATRIX) {
-               super.setScaleType(ScaleType.MATRIX);
-               
-       } else {
-               mScaleType = type;
-               if (onDrawReady) {
-                       //
-                       // If the image is already rendered, scaleType has been called programmatically
-                       // and the TouchImageView should be updated with the new scaleType.
-                       //
-                       setZoom(this);
-               }
-       }
-    }
-    
-    @Override
-    public ScaleType getScaleType() {
-       return mScaleType;
-    }
-    
-    /**
-     * Returns false if image is in initial, unzoomed state. False, otherwise.
-     * @return true if image is zoomed
-     */
-    public boolean isZoomed() {
-       return normalizedScale != 1;
-    }
-    
-    /**
-     * Return a Rect representing the zoomed image.
-     * @return rect representing zoomed image
-     */
-    public RectF getZoomedRect() {
-       if (mScaleType == ScaleType.FIT_XY) {
-               throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
-       }
-       PointF topLeft = transformCoordTouchToBitmap(0, 0, true);
-       PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true);
-       
-       float w = getDrawable().getIntrinsicWidth();
-       float h = getDrawable().getIntrinsicHeight();
-       return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h);
-    }
-    
-    /**
-     * Save the current matrix and view dimensions
-     * in the prevMatrix and prevView variables.
-     */
-    private void savePreviousImageValues() {
-       if (matrix != null && viewHeight != 0 && viewWidth != 0) {
-               matrix.getValues(m);
-               prevMatrix.setValues(m);
-               prevMatchViewHeight = matchViewHeight;
-               prevMatchViewWidth = matchViewWidth;
-               prevViewHeight = viewHeight;
-               prevViewWidth = viewWidth;
-       }
-    }
-    
-    @Override
-    public Parcelable onSaveInstanceState() {
-       Bundle bundle = new Bundle();
-       bundle.putParcelable("instanceState", super.onSaveInstanceState());
-       bundle.putFloat("saveScale", normalizedScale);
-       bundle.putFloat("matchViewHeight", matchViewHeight);
-       bundle.putFloat("matchViewWidth", matchViewWidth);
-       bundle.putInt("viewWidth", viewWidth);
-       bundle.putInt("viewHeight", viewHeight);
-       matrix.getValues(m);
-       bundle.putFloatArray("matrix", m);
-       bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce);
-       return bundle;
-    }
-    
-    @Override
-    public void onRestoreInstanceState(Parcelable state) {
-       if (state instanceof Bundle) {
-               Bundle bundle = (Bundle) state;
-               normalizedScale = bundle.getFloat("saveScale");
-               m = bundle.getFloatArray("matrix");
-               prevMatrix.setValues(m);
-               prevMatchViewHeight = bundle.getFloat("matchViewHeight");
-               prevMatchViewWidth = bundle.getFloat("matchViewWidth");
-               prevViewHeight = bundle.getInt("viewHeight");
-               prevViewWidth = bundle.getInt("viewWidth");
-               imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
-               super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
-               return;
-       }
-
-       super.onRestoreInstanceState(state);
-    }
-    
-    @Override
-    protected void onDraw(Canvas canvas) {
-       onDrawReady = true;
-       imageRenderedAtLeastOnce = true;
-       if (delayedZoomVariables != null) {
-               setZoom(delayedZoomVariables.scale, delayedZoomVariables.focusX, delayedZoomVariables.focusY, delayedZoomVariables.scaleType);
-               delayedZoomVariables = null;
-       }
-       super.onDraw(canvas);
-    }
-    
-    @Override
-    public void onConfigurationChanged(Configuration newConfig) {
-       super.onConfigurationChanged(newConfig);
-       savePreviousImageValues();
-    }
-    
-    /**
-     * Get the max zoom multiplier.
-     * @return max zoom multiplier.
-     */
-    public float getMaxZoom() {
-       return maxScale;
-    }
-
-    /**
-     * Set the max zoom multiplier. Default value: 3.
-     * @param max max zoom multiplier.
-     */
-    public void setMaxZoom(float max) {
-        maxScale = max;
-        superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
-    }
-    
-    /**
-     * Get the min zoom multiplier.
-     * @return min zoom multiplier.
-     */
-    public float getMinZoom() {
-       return minScale;
-    }
-    
-    /**
-     * Get the current zoom. This is the zoom relative to the initial
-     * scale, not the original resource.
-     * @return current zoom multiplier.
-     */
-    public float getCurrentZoom() {
-       return normalizedScale;
-    }
-    
-    /**
-     * Set the min zoom multiplier. Default value: 1.
-     * @param min min zoom multiplier.
-     */
-    public void setMinZoom(float min) {
-       minScale = min;
-       superMinScale = SUPER_MIN_MULTIPLIER * minScale;
-    }
-    
-    /**
-     * Reset zoom and translation to initial state.
-     */
-    public void resetZoom() {
-       normalizedScale = 1;
-       fitImageToView();
-    }
-    
-    /**
-     * Set zoom to the specified scale. Image will be centered by default.
-     * @param scale
-     */
-    public void setZoom(float scale) {
-       setZoom(scale, 0.5f, 0.5f);
-    }
-    
-    /**
-     * Set zoom to the specified scale. Image will be centered around the point
-     * (focusX, focusY). These floats range from 0 to 1 and denote the focus point
-     * as a fraction from the left and top of the view. For example, the top left 
-     * corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
-     * @param scale
-     * @param focusX
-     * @param focusY
-     */
-    public void setZoom(float scale, float focusX, float focusY) {
-       setZoom(scale, focusX, focusY, mScaleType);
-    }
-    
-    /**
-     * Set zoom to the specified scale. Image will be centered around the point
-     * (focusX, focusY). These floats range from 0 to 1 and denote the focus point
-     * as a fraction from the left and top of the view. For example, the top left 
-     * corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
-     * @param scale
-     * @param focusX
-     * @param focusY
-     * @param scaleType
-     */
-    public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) {
-       //
-       // setZoom can be called before the image is on the screen, but at this point, 
-       // image and view sizes have not yet been calculated in onMeasure. Thus, we should
-       // delay calling setZoom until the view has been measured.
-       //
-       if (!onDrawReady) {
-               delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType);
-               return;
-       }
-       
-       if (scaleType != mScaleType) {
-               setScaleType(scaleType);
-       }
-       resetZoom();
-       scaleImage(scale, viewWidth / 2, viewHeight / 2, true);
-       matrix.getValues(m);
-       m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f));
-       m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f));
-       matrix.setValues(m);
-       fixTrans();
-       setImageMatrix(matrix);
-    }
-    
-    /**
-     * Set zoom parameters equal to another TouchImageView. Including scale, position,
-     * and ScaleType.
-     * @param TouchImageView
-     */
-    public void setZoom(TouchImageViewCustom img) {
-       PointF center = img.getScrollPosition();
-       setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
-    }
-    
-    /**
-     * Return the point at the center of the zoomed image. The PointF coordinates range
-     * in value between 0 and 1 and the focus point is denoted as a fraction from the left 
-     * and top of the view. For example, the top left corner of the image would be (0, 0). 
-     * And the bottom right corner would be (1, 1).
-     * @return PointF representing the scroll position of the zoomed image.
-     */
-    public PointF getScrollPosition() {
-       Drawable drawable = getDrawable();
-       if (drawable == null) {
-               return null;
-       }
-       int drawableWidth = drawable.getIntrinsicWidth();
-        int drawableHeight = drawable.getIntrinsicHeight();
-        
-        PointF point = transformCoordTouchToBitmap(viewWidth / 2, viewHeight / 2, true);
-        point.x /= drawableWidth;
-        point.y /= drawableHeight;
-        return point;
-    }
-    
-    /**
-     * Set the focus point of the zoomed image. The focus points are denoted as a fraction from the
-     * left and top of the view. The focus points can range in value between 0 and 1. 
-     * @param focusX
-     * @param focusY
-     */
-    public void setScrollPosition(float focusX, float focusY) {
-       setZoom(normalizedScale, focusX, focusY);
-    }
-    
-    /**
-     * Performs boundary checking and fixes the image matrix if it 
-     * is out of bounds.
-     */
-    private void fixTrans() {
-        matrix.getValues(m);
-        float transX = m[Matrix.MTRANS_X];
-        float transY = m[Matrix.MTRANS_Y];
-        
-        float fixTransX = getFixTrans(transX, viewWidth, getImageWidth());
-        float fixTransY = getFixTrans(transY, viewHeight, getImageHeight());
-        
-        if (fixTransX != 0 || fixTransY != 0) {
-            matrix.postTranslate(fixTransX, fixTransY);
-        }
-    }
-    
-    /**
-     * When transitioning from zooming from focus to zoom from center (or vice versa)
-     * the image can become unaligned within the view. This is apparent when zooming
-     * quickly. When the content size is less than the view size, the content will often
-     * be centered incorrectly within the view. fixScaleTrans first calls fixTrans() and 
-     * then makes sure the image is centered correctly within the view.
-     */
-    private void fixScaleTrans() {
-       fixTrans();
-       matrix.getValues(m);
-       if (getImageWidth() < viewWidth) {
-               m[Matrix.MTRANS_X] = (viewWidth - getImageWidth()) / 2;
-       }
-       
-       if (getImageHeight() < viewHeight) {
-               m[Matrix.MTRANS_Y] = (viewHeight - getImageHeight()) / 2;
-       }
-       matrix.setValues(m);
-    }
-
-    private float getFixTrans(float trans, float viewSize, float contentSize) {
-        float minTrans, maxTrans;
-
-        if (contentSize <= viewSize) {
-            minTrans = 0;
-            maxTrans = viewSize - contentSize;
-            
-        } else {
-            minTrans = viewSize - contentSize;
-            maxTrans = 0;
-        }
-
-        if (trans < minTrans)
-            return -trans + minTrans;
-        if (trans > maxTrans)
-            return -trans + maxTrans;
-        return 0;
-    }
-    
-    private float getFixDragTrans(float delta, float viewSize, float contentSize) {
-        if (contentSize <= viewSize) {
-            return 0;
-        }
-        return delta;
-    }
-    
-    private float getImageWidth() {
-       return matchViewWidth * normalizedScale;
-    }
-    
-    private float getImageHeight() {
-       return matchViewHeight * normalizedScale;
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        Drawable drawable = getDrawable();
-        if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
-               setMeasuredDimension(0, 0);
-               return;
-        }
-        
-        int drawableWidth = drawable.getIntrinsicWidth();
-        int drawableHeight = drawable.getIntrinsicHeight();
-        int widthSize = MeasureSpec.getSize(widthMeasureSpec);
-        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
-        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
-        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
-        viewWidth = setViewSize(widthMode, widthSize, drawableWidth);
-        viewHeight = setViewSize(heightMode, heightSize, drawableHeight);
-        
-        //
-        // Set view dimensions
-        //
-        setMeasuredDimension(viewWidth, viewHeight);
-        
-        //
-        // Fit content within view
-        //
-        fitImageToView();
-    }
-    
-    /**
-     * If the normalizedScale is equal to 1, then the image is made to fit the screen. Otherwise,
-     * it is made to fit the screen according to the dimensions of the previous image matrix. This
-     * allows the image to maintain its zoom after rotation.
-     */
-    private void fitImageToView() {
-       Drawable drawable = getDrawable();
-        if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
-               return;
-        }
-        if (matrix == null || prevMatrix == null) {
-               return;
-        }
-        
-        int drawableWidth = drawable.getIntrinsicWidth();
-        int drawableHeight = drawable.getIntrinsicHeight();
-       
-       //
-       // Scale image for view
-       //
-        float scaleX = (float) viewWidth / drawableWidth;
-        float scaleY = (float) viewHeight / drawableHeight;
-        
-        switch (mScaleType) {
-        case CENTER:
-               scaleX = scaleY = 1;
-               break;
-               
-        case CENTER_CROP:
-               scaleX = scaleY = Math.max(scaleX, scaleY);
-               break;
-               
-        case CENTER_INSIDE:
-               scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
-               
-        case FIT_CENTER:
-               scaleX = scaleY = Math.min(scaleX, scaleY);
-               break;
-               
-        case FIT_XY:
-               break;
-               
-       default:
-               //
-               // FIT_START and FIT_END not supported
-               //
-               throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
-               
-        }
-
-        //
-        // Center the image
-        //
-        float redundantXSpace = viewWidth - (scaleX * drawableWidth);
-        float redundantYSpace = viewHeight - (scaleY * drawableHeight);
-        matchViewWidth = viewWidth - redundantXSpace;
-        matchViewHeight = viewHeight - redundantYSpace;
-        if (!isZoomed() && !imageRenderedAtLeastOnce) {
-               //
-               // Stretch and center image to fit view
-               //
-               matrix.setScale(scaleX, scaleY);
-               matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
-               normalizedScale = 1;
-               
-        } else {
-               //
-               // These values should never be 0 or we will set viewWidth and viewHeight
-               // to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues
-               // to set them equal to the current values.
-               //
-               if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
-                       savePreviousImageValues();
-               }
-               
-               prevMatrix.getValues(m);
-               
-               //
-               // Rescale Matrix after rotation
-               //
-               m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
-               m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
-               
-               //
-               // TransX and TransY from previous matrix
-               //
-            float transX = m[Matrix.MTRANS_X];
-            float transY = m[Matrix.MTRANS_Y];
-            
-            //
-            // Width
-            //
-            float prevActualWidth = prevMatchViewWidth * normalizedScale;
-            float actualWidth = getImageWidth();
-            translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth);
-            
-            //
-            // Height
-            //
-            float prevActualHeight = prevMatchViewHeight * normalizedScale;
-            float actualHeight = getImageHeight();
-            translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight);
-            
-            //
-            // Set the matrix to the adjusted scale and translate values.
-            //
-            matrix.setValues(m);
-        }
-        fixTrans();
-        setImageMatrix(matrix);
-    }
-    
-    /**
-     * Set view dimensions based on layout params
-     * 
-     * @param mode 
-     * @param size
-     * @param drawableWidth
-     * @return
-     */
-    private int setViewSize(int mode, int size, int drawableWidth) {
-       int viewSize;
-       switch (mode) {
-               case MeasureSpec.EXACTLY:
-                       viewSize = size;
-                       break;
-                       
-               case MeasureSpec.AT_MOST:
-                       viewSize = Math.min(drawableWidth, size);
-                       break;
-                       
-               case MeasureSpec.UNSPECIFIED:
-                       viewSize = drawableWidth;
-                       break;
-                       
-               default:
-                       viewSize = size;
-                       break;
-               }
-       return viewSize;
-    }
-    
-    /**
-     * After rotating, the matrix needs to be translated. This function finds the area of image 
-     * which was previously centered and adjusts translations so that is again the center, post-rotation.
-     * 
-     * @param axis Matrix.MTRANS_X or Matrix.MTRANS_Y
-     * @param trans the value of trans in that axis before the rotation
-     * @param prevImageSize the width/height of the image before the rotation
-     * @param imageSize width/height of the image after rotation
-     * @param prevViewSize width/height of view before rotation
-     * @param viewSize width/height of view after rotation
-     * @param drawableSize width/height of drawable
-     */
-    private void translateMatrixAfterRotate(int axis, float trans, float prevImageSize, float imageSize, int prevViewSize, int viewSize, int drawableSize) {
-       if (imageSize < viewSize) {
-               //
-               // The width/height of image is less than the view's width/height. Center it.
-               //
-               m[axis] = (viewSize - (drawableSize * m[Matrix.MSCALE_X])) * 0.5f;
-               
-        } else if (trans > 0) {
-               //
-               // The image is larger than the view, but was not before rotation. Center it.
-               //
-               m[axis] = -((imageSize - viewSize) * 0.5f);
-               
-        } else {
-               //
-               // Find the area of the image which was previously centered in the view. Determine its distance
-               // from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage
-               // to calculate the trans in the new view width/height.
-               //
-               float percentage = (Math.abs(trans) + (0.5f * prevViewSize)) / prevImageSize;
-               m[axis] = -((percentage * imageSize) - (viewSize * 0.5f));
-        }
-    }
-    
-    private void setState(State state) {
-       this.state = state;
-    }
-    
-    public boolean canScrollHorizontallyFroyo(int direction) {
-        return canScrollHorizontally(direction);
-    }
-    
-    @Override
-    public boolean canScrollHorizontally(int direction) {
-       matrix.getValues(m);
-       float x = m[Matrix.MTRANS_X];
-       
-       if (getImageWidth() < viewWidth) {
-               return false;
-               
-       } else if (x >= -1 && direction < 0) {
-               return false;
-               
-       } else if (Math.abs(x) + viewWidth + 1 >= getImageWidth() && direction > 0) {
-               return false;
-       }
-       
-       return true;
-    }
-    
-    /**
-     * Gesture Listener detects a single click or long click and passes that on
-     * to the view's listener.
-     * @author Ortiz
-     *
-     */
-    private class GestureListener extends GestureDetector.SimpleOnGestureListener {
-       
-        @Override
-        public boolean onSingleTapConfirmed(MotionEvent e)
-        {
-            if(doubleTapListener != null) {
-               return doubleTapListener.onSingleTapConfirmed(e);
-            }
-               return performClick();
-        }
-        
-        @Override
-        public void onLongPress(MotionEvent e)
-        {
-               performLongClick();
-        }
-        
-        @Override
-        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
-        {
-               if (fling != null) {
-                       //
-                       // If a previous fling is still active, it should be cancelled so that two flings
-                       // are not run simultaenously.
-                       //
-                       fling.cancelFling();
-               }
-               fling = new Fling((int) velocityX, (int) velocityY);
-               compatPostOnAnimation(fling);
-               return super.onFling(e1, e2, velocityX, velocityY);
-        }
-        
-        @Override
-        public boolean onDoubleTap(MotionEvent e) {
-               boolean consumed = false;
-            if(doubleTapListener != null) {
-               consumed = doubleTapListener.onDoubleTap(e);
-            }
-               if (state == State.NONE) {
-                       float targetZoom = (normalizedScale == minScale) ? maxScale : minScale;
-                       DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, e.getX(), e.getY(), false);
-                       compatPostOnAnimation(doubleTap);
-                       consumed = true;
-               }
-               return consumed;
-        }
-
-        @Override
-        public boolean onDoubleTapEvent(MotionEvent e) {
-            if(doubleTapListener != null) {
-               return doubleTapListener.onDoubleTapEvent(e);
-            }
-            return false;
-        }
-    }
-    
-    public interface OnTouchImageViewListener {
-       public void onMove();
-    }
-    
-    /**
-     * Responsible for all touch events. Handles the heavy lifting of drag and also sends
-     * touch events to Scale Detector and Gesture Detector.
-     * @author Ortiz
-     *
-     */
-    private class PrivateOnTouchListener implements OnTouchListener {
-       
-       //
-        // Remember last point position for dragging
-        //
-        private PointF last = new PointF();
-       
-       @Override
-        public boolean onTouch(View v, MotionEvent event) {
-            mScaleDetector.onTouchEvent(event);
-            mGestureDetector.onTouchEvent(event);
-            PointF curr = new PointF(event.getX(), event.getY());
-            
-            if (state == State.NONE || state == State.DRAG || state == State.FLING) {
-                   switch (event.getAction()) {
-                       case MotionEvent.ACTION_DOWN:
-                               last.set(curr);
-                           if (fling != null)
-                               fling.cancelFling();
-                           setState(State.DRAG);
-                           break;
-                           
-                       case MotionEvent.ACTION_MOVE:
-                           if (state == State.DRAG) {
-                               float deltaX = curr.x - last.x;
-                               float deltaY = curr.y - last.y;
-                               float fixTransX = getFixDragTrans(deltaX, viewWidth, getImageWidth());
-                               float fixTransY = getFixDragTrans(deltaY, viewHeight, getImageHeight());
-                               matrix.postTranslate(fixTransX, fixTransY);
-                               fixTrans();
-                               last.set(curr.x, curr.y);
-                           }
-                           break;
-       
-                       case MotionEvent.ACTION_UP:
-                       case MotionEvent.ACTION_POINTER_UP:
-                           setState(State.NONE);
-                           break;
-                   }
-            }
-            
-            setImageMatrix(matrix);
-            
-            //
-               // User-defined OnTouchListener
-               //
-               if(userTouchListener != null) {
-                       userTouchListener.onTouch(v, event);
-               }
-            
-               //
-               // OnTouchImageViewListener is set: TouchImageView dragged by user.
-               //
-               if (touchImageViewListener != null) {
-                       touchImageViewListener.onMove();
-               }
-               
-            //
-            // indicate event was handled
-            //
-            return true;
-        }
-    }
-
-    /**
-     * ScaleListener detects user two finger scaling and scales image.
-     * @author Ortiz
-     *
-     */
-    private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
-        @Override
-        public boolean onScaleBegin(ScaleGestureDetector detector) {
-            setState(State.ZOOM);
-            return true;
-        }
-
-        @Override
-        public boolean onScale(ScaleGestureDetector detector) {
-               scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);
-               
-               //
-               // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
-               //
-               if (touchImageViewListener != null) {
-                       touchImageViewListener.onMove();
-               }
-            return true;
-        }
-        
-        @Override
-        public void onScaleEnd(ScaleGestureDetector detector) {
-               super.onScaleEnd(detector);
-               setState(State.NONE);
-               boolean animateToZoomBoundary = false;
-               float targetZoom = normalizedScale;
-               if (normalizedScale > maxScale) {
-                       targetZoom = maxScale;
-                       animateToZoomBoundary = true;
-                       
-               } else if (normalizedScale < minScale) {
-                       targetZoom = minScale;
-                       animateToZoomBoundary = true;
-               }
-               
-               if (animateToZoomBoundary) {
-                       DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
-                       compatPostOnAnimation(doubleTap);
-               }
-        }
-    }
-    
-    private void scaleImage(double deltaScale, float focusX, float focusY, boolean stretchImageToSuper) {
-       
-       float lowerScale, upperScale;
-       if (stretchImageToSuper) {
-               lowerScale = superMinScale;
-               upperScale = superMaxScale;
-               
-       } else {
-               lowerScale = minScale;
-               upperScale = maxScale;
-       }
-       
-       float origScale = normalizedScale;
-        normalizedScale *= deltaScale;
-        if (normalizedScale > upperScale) {
-            normalizedScale = upperScale;
-            deltaScale = upperScale / origScale;
-        } else if (normalizedScale < lowerScale) {
-            normalizedScale = lowerScale;
-            deltaScale = lowerScale / origScale;
-        }
-        
-        matrix.postScale((float) deltaScale, (float) deltaScale, focusX, focusY);
-        fixScaleTrans();
-    }
-    
-    /**
-     * DoubleTapZoom calls a series of runnables which apply
-     * an animated zoom in/out graphic to the image.
-     * @author Ortiz
-     *
-     */
-    private class DoubleTapZoom implements Runnable {
-       
-       private long startTime;
-       private static final float ZOOM_TIME = 500;
-       private float startZoom, targetZoom;
-       private float bitmapX, bitmapY;
-       private boolean stretchImageToSuper;
-       private AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
-       private PointF startTouch;
-       private PointF endTouch;
-
-       DoubleTapZoom(float targetZoom, float focusX, float focusY, boolean stretchImageToSuper) {
-               setState(State.ANIMATE_ZOOM);
-               startTime = System.currentTimeMillis();
-               this.startZoom = normalizedScale;
-               this.targetZoom = targetZoom;
-               this.stretchImageToSuper = stretchImageToSuper;
-               PointF bitmapPoint = transformCoordTouchToBitmap(focusX, focusY, false);
-               this.bitmapX = bitmapPoint.x;
-               this.bitmapY = bitmapPoint.y;
-               
-               //
-               // Used for translating image during scaling
-               //
-               startTouch = transformCoordBitmapToTouch(bitmapX, bitmapY);
-               endTouch = new PointF(viewWidth / 2, viewHeight / 2);
-       }
-
-               @Override
-               public void run() {
-                       float t = interpolate();
-                       double deltaScale = calculateDeltaScale(t);
-                       scaleImage(deltaScale, bitmapX, bitmapY, stretchImageToSuper);
-                       translateImageToCenterTouchPosition(t);
-                       fixScaleTrans();
-                       setImageMatrix(matrix);
-                       
-                       //
-                       // OnTouchImageViewListener is set: double tap runnable updates listener
-                       // with every frame.
-                       //
-                       if (touchImageViewListener != null) {
-                               touchImageViewListener.onMove();
-                       }
-                       
-                       if (t < 1f) {
-                               //
-                               // We haven't finished zooming
-                               //
-                               compatPostOnAnimation(this);
-                               
-                       } else {
-                               //
-                               // Finished zooming
-                               //
-                               setState(State.NONE);
-                       }
-               }
-               
-               /**
-                * Interpolate between where the image should start and end in order to translate
-                * the image so that the point that is touched is what ends up centered at the end
-                * of the zoom.
-                * @param t
-                */
-               private void translateImageToCenterTouchPosition(float t) {
-                       float targetX = startTouch.x + t * (endTouch.x - startTouch.x);
-                       float targetY = startTouch.y + t * (endTouch.y - startTouch.y);
-                       PointF curr = transformCoordBitmapToTouch(bitmapX, bitmapY);
-                       matrix.postTranslate(targetX - curr.x, targetY - curr.y);
-               }
-               
-               /**
-                * Use interpolator to get t
-                * @return
-                */
-               private float interpolate() {
-                       long currTime = System.currentTimeMillis();
-                       float elapsed = (currTime - startTime) / ZOOM_TIME;
-                       elapsed = Math.min(1f, elapsed);
-                       return interpolator.getInterpolation(elapsed);
-               }
-               
-               /**
-                * Interpolate the current targeted zoom and get the delta
-                * from the current zoom.
-                * @param t
-                * @return
-                */
-               private double calculateDeltaScale(float t) {
-                       double zoom = startZoom + t * (targetZoom - startZoom);
-                       return zoom / normalizedScale;
-               }
-    }
-    
-    /**
-     * This function will transform the coordinates in the touch event to the coordinate 
-     * system of the drawable that the imageview contain
-     * @param x x-coordinate of touch event
-     * @param y y-coordinate of touch event
-     * @param clipToBitmap Touch event may occur within view, but outside image content. True, to clip return value
-     *                         to the bounds of the bitmap size.
-     * @return Coordinates of the point touched, in the coordinate system of the original drawable.
-     */
-    private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) {
-         matrix.getValues(m);
-         float origW = getDrawable().getIntrinsicWidth();
-         float origH = getDrawable().getIntrinsicHeight();
-         float transX = m[Matrix.MTRANS_X];
-         float transY = m[Matrix.MTRANS_Y];
-         float finalX = ((x - transX) * origW) / getImageWidth();
-         float finalY = ((y - transY) * origH) / getImageHeight();
-         
-         if (clipToBitmap) {
-                finalX = Math.min(Math.max(finalX, 0), origW);
-                finalY = Math.min(Math.max(finalY, 0), origH);
-         }
-         
-         return new PointF(finalX , finalY);
-    }
-    
-    /**
-     * Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the
-     * drawable's coordinate system to the view's coordinate system.
-     * @param bx x-coordinate in original bitmap coordinate system
-     * @param by y-coordinate in original bitmap coordinate system
-     * @return Coordinates of the point in the view's coordinate system.
-     */
-    private PointF transformCoordBitmapToTouch(float bx, float by) {
-        matrix.getValues(m);        
-        float origW = getDrawable().getIntrinsicWidth();
-        float origH = getDrawable().getIntrinsicHeight();
-        float px = bx / origW;
-        float py = by / origH;
-        float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px;
-        float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py;
-        return new PointF(finalX , finalY);
-    }
-    
-    /**
-     * Fling launches sequential runnables which apply
-     * the fling graphic to the image. The values for the translation
-     * are interpolated by the Scroller.
-     * @author Ortiz
-     *
-     */
-    private class Fling implements Runnable {
-       
-        CompatScroller scroller;
-       int currX, currY;
-       
-       Fling(int velocityX, int velocityY) {
-               setState(State.FLING);
-               scroller = new CompatScroller(context);
-               matrix.getValues(m);
-               
-               int startX = (int) m[Matrix.MTRANS_X];
-               int startY = (int) m[Matrix.MTRANS_Y];
-               int minX, maxX, minY, maxY;
-               
-               if (getImageWidth() > viewWidth) {
-                       minX = viewWidth - (int) getImageWidth();
-                       maxX = 0;
-                       
-               } else {
-                       minX = maxX = startX;
-               }
-               
-               if (getImageHeight() > viewHeight) {
-                       minY = viewHeight - (int) getImageHeight();
-                       maxY = 0;
-                       
-               } else {
-                       minY = maxY = startY;
-               }
-               
-               scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX,
-                    maxX, minY, maxY);
-               currX = startX;
-               currY = startY;
-       }
-       
-       public void cancelFling() {
-               if (scroller != null) {
-                       setState(State.NONE);
-                       scroller.forceFinished(true);
-               }
-       }
-       
-               @Override
-               public void run() {
-                       
-                       //
-                       // OnTouchImageViewListener is set: TouchImageView listener has been flung by user.
-                       // Listener runnable updated with each frame of fling animation.
-                       //
-                       if (touchImageViewListener != null) {
-                               touchImageViewListener.onMove();
-                       }
-                       
-                       if (scroller.isFinished()) {
-                       scroller = null;
-                       return;
-               }
-                       
-                       if (scroller.computeScrollOffset()) {
-                       int newX = scroller.getCurrX();
-                   int newY = scroller.getCurrY();
-                   int transX = newX - currX;
-                   int transY = newY - currY;
-                   currX = newX;
-                   currY = newY;
-                   matrix.postTranslate(transX, transY);
-                   fixTrans();
-                   setImageMatrix(matrix);
-                   compatPostOnAnimation(this);
-               }
-               }
-    }
-    
-    @TargetApi(Build.VERSION_CODES.GINGERBREAD)
-       private class CompatScroller {
-       Scroller scroller;
-       OverScroller overScroller;
-       boolean isPreGingerbread;
-       
-       public CompatScroller(Context context) {
-               if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
-                       isPreGingerbread = true;
-                       scroller = new Scroller(context);
-                       
-               } else {
-                       isPreGingerbread = false;
-                       overScroller = new OverScroller(context);
-               }
-       }
-       
-       public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY) {
-               if (isPreGingerbread) {
-                       scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
-               } else {
-                       overScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
-               }
-       }
-       
-       public void forceFinished(boolean finished) {
-               if (isPreGingerbread) {
-                       scroller.forceFinished(finished);
-               } else {
-                       overScroller.forceFinished(finished);
-               }
-       }
-       
-       public boolean isFinished() {
-               if (isPreGingerbread) {
-                       return scroller.isFinished();
-               } else {
-                       return overScroller.isFinished();
-               }
-       }
-       
-       public boolean computeScrollOffset() {
-               if (isPreGingerbread) {
-                       return scroller.computeScrollOffset();
-               } else {
-                       overScroller.computeScrollOffset();
-                       return overScroller.computeScrollOffset();
-               }
-       }
-       
-       public int getCurrX() {
-               if (isPreGingerbread) {
-                       return scroller.getCurrX();
-               } else {
-                       return overScroller.getCurrX();
-               }
-       }
-       
-       public int getCurrY() {
-               if (isPreGingerbread) {
-                       return scroller.getCurrY();
-               } else {
-                       return overScroller.getCurrY();
-               }
-       }
-    }
-    
-    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
-       private void compatPostOnAnimation(Runnable runnable) {
-       if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
-            postOnAnimation(runnable);
-            
-        } else {
-            postDelayed(runnable, 1000/60);
-        }
-    }
-    
-    private class ZoomVariables {
-       public float scale;
-       public float focusX;
-       public float focusY;
-       public ScaleType scaleType;
-       
-       public ZoomVariables(float scale, float focusX, float focusY, ScaleType scaleType) {
-               this.scale = scale;
-               this.focusX = focusX;
-               this.focusY = focusY;
-               this.scaleType = scaleType;
-       }
-    }
-    
-    private void printMatrixInfo() {
-       float[] n = new float[9];
-       matrix.getValues(n);
-       Log.d(DEBUG, "Scale: " + n[Matrix.MSCALE_X] + " TransX: " + n[Matrix.MTRANS_X] + " TransY: " + n[Matrix.MTRANS_Y]);
-    }
-}
\ No newline at end of file
index e66d2c9..8070e36 100644 (file)
@@ -1,5 +1,7 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
index 1077d15..cb0dac4 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
diff --git a/src/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java b/src/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java
new file mode 100644 (file)
index 0000000..508380a
--- /dev/null
@@ -0,0 +1,841 @@
+
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package third_parties.in.srain.cube;
+
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.database.DataSetObservable;
+import android.database.DataSetObserver;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.Filter;
+import android.widget.Filterable;
+import android.widget.FrameLayout;
+import android.widget.GridView;
+import android.widget.ListAdapter;
+import android.widget.WrapperListAdapter;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+
+/**
+ * A {@link android.widget.GridView} that supports adding header rows in a
+ * very similar way to {@link android.widget.ListView}.
+ * See {@link GridViewWithHeaderAndFooter#addHeaderView(View, Object, boolean)}
+ * See {@link GridViewWithHeaderAndFooter#addFooterView(View, Object, boolean)}
+ */
+public class GridViewWithHeaderAndFooter extends GridView {
+
+    public static boolean DEBUG = false;
+
+    /**
+     * A class that represents a fixed view in a list, for example a header at the top
+     * or a footer at the bottom.
+     */
+    private static class FixedViewInfo {
+        /**
+         * The view to add to the grid
+         */
+        public View view;
+        public ViewGroup viewContainer;
+        /**
+         * The data backing the view. This is returned from {@link android.widget.ListAdapter#getItem(int)}.
+         */
+        public Object data;
+        /**
+         * <code>true</code> if the fixed view should be selectable in the grid
+         */
+        public boolean isSelectable;
+    }
+
+    private int mNumColumns = AUTO_FIT;
+    private View mViewForMeasureRowHeight = null;
+    private int mRowHeight = -1;
+    private static final String LOG_TAG = "grid-view-with-header-and-footer";
+
+    private ArrayList<FixedViewInfo> mHeaderViewInfos = new ArrayList<FixedViewInfo>();
+    private ArrayList<FixedViewInfo> mFooterViewInfos = new ArrayList<FixedViewInfo>();
+
+    private void initHeaderGridView() {
+    }
+
+    public GridViewWithHeaderAndFooter(Context context) {
+        super(context);
+        initHeaderGridView();
+    }
+
+    public GridViewWithHeaderAndFooter(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        initHeaderGridView();
+    }
+
+    public GridViewWithHeaderAndFooter(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        initHeaderGridView();
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        ListAdapter adapter = getAdapter();
+        if (adapter != null && adapter instanceof HeaderViewGridAdapter) {
+            ((HeaderViewGridAdapter) adapter).setNumColumns(getNumColumnsCompatible());
+            ((HeaderViewGridAdapter) adapter).setRowHeight(getRowHeight());
+        }
+    }
+
+    @Override
+    public void setClipChildren(boolean clipChildren) {
+        // Ignore, since the header rows depend on not being clipped
+    }
+
+    /**
+     * Do not call this method unless you know how it works.
+     *
+     * @param clipChildren
+     */
+    public void setClipChildrenSupper(boolean clipChildren) {
+        super.setClipChildren(false);
+    }
+
+    /**
+     * Add a fixed view to appear at the top of the grid. If addHeaderView is
+     * called more than once, the views will appear in the order they were
+     * added. Views added using this call can take focus if they want.
+     * <p/>
+     * NOTE: Call this before calling setAdapter. This is so HeaderGridView can wrap
+     * the supplied cursor with one that will also account for header views.
+     *
+     * @param v The view to add.
+     */
+    public void addHeaderView(View v) {
+        addHeaderView(v, null, true);
+    }
+
+    /**
+     * Add a fixed view to appear at the top of the grid. If addHeaderView is
+     * called more than once, the views will appear in the order they were
+     * added. Views added using this call can take focus if they want.
+     * <p/>
+     * NOTE: Call this before calling setAdapter. This is so HeaderGridView can wrap
+     * the supplied cursor with one that will also account for header views.
+     *
+     * @param v            The view to add.
+     * @param data         Data to associate with this view
+     * @param isSelectable whether the item is selectable
+     */
+    public void addHeaderView(View v, Object data, boolean isSelectable) {
+        ListAdapter adapter = getAdapter();
+        if (adapter != null && !(adapter instanceof HeaderViewGridAdapter)) {
+            throw new IllegalStateException(
+                    "Cannot add header view to grid -- setAdapter has already been called.");
+        }
+
+        ViewGroup.LayoutParams lyp = v.getLayoutParams();
+
+        FixedViewInfo info = new FixedViewInfo();
+        FrameLayout fl = new FullWidthFixedViewLayout(getContext());
+
+        if (lyp != null) {
+            v.setLayoutParams(new FrameLayout.LayoutParams(lyp.width, lyp.height));
+            fl.setLayoutParams(new LayoutParams(lyp.width, lyp.height));
+        }
+        fl.addView(v);
+        info.view = v;
+        info.viewContainer = fl;
+        info.data = data;
+        info.isSelectable = isSelectable;
+        mHeaderViewInfos.add(info);
+        // in the case of re-adding a header view, or adding one later on,
+        // we need to notify the observer
+        if (adapter != null) {
+            ((HeaderViewGridAdapter) adapter).notifyDataSetChanged();
+        }
+    }
+
+    public void addFooterView(View v) {
+        addFooterView(v, null, true);
+    }
+
+    public void addFooterView(View v, Object data, boolean isSelectable) {
+        ListAdapter mAdapter = getAdapter();
+        if (mAdapter != null && !(mAdapter instanceof HeaderViewGridAdapter)) {
+            throw new IllegalStateException(
+                    "Cannot add header view to grid -- setAdapter has already been called.");
+        }
+
+        ViewGroup.LayoutParams lyp = v.getLayoutParams();
+
+        FixedViewInfo info = new FixedViewInfo();
+        FrameLayout fl = new FullWidthFixedViewLayout(getContext());
+
+        if (lyp != null) {
+            v.setLayoutParams(new FrameLayout.LayoutParams(lyp.width, lyp.height));
+            fl.setLayoutParams(new LayoutParams(lyp.width, lyp.height));
+        }
+        fl.addView(v);
+        info.view = v;
+        info.viewContainer = fl;
+        info.data = data;
+        info.isSelectable = isSelectable;
+        mFooterViewInfos.add(info);
+
+        if (mAdapter != null) {
+            ((HeaderViewGridAdapter) mAdapter).notifyDataSetChanged();
+        }
+    }
+
+    public int getHeaderViewCount() {
+        return mHeaderViewInfos.size();
+    }
+
+    public int getFooterViewCount() {
+        return mFooterViewInfos.size();
+    }
+
+    /**
+     * Removes a previously-added header view.
+     *
+     * @param v The view to remove
+     * @return true if the view was removed, false if the view was not a header
+     * view
+     */
+    public boolean removeHeaderView(View v) {
+        if (mHeaderViewInfos.size() > 0) {
+            boolean result = false;
+            ListAdapter adapter = getAdapter();
+            if (adapter != null && ((HeaderViewGridAdapter) adapter).removeHeader(v)) {
+                result = true;
+            }
+            removeFixedViewInfo(v, mHeaderViewInfos);
+            return result;
+        }
+        return false;
+    }
+
+    /**
+     * Removes a previously-added footer view.
+     *
+     * @param v The view to remove
+     * @return true if the view was removed, false if the view was not a header
+     * view
+     */
+    public boolean removeFooterView(View v) {
+        if (mFooterViewInfos.size() > 0) {
+            boolean result = false;
+            ListAdapter adapter = getAdapter();
+            if (adapter != null && ((HeaderViewGridAdapter) adapter).removeFooter(v)) {
+                result = true;
+            }
+            removeFixedViewInfo(v, mFooterViewInfos);
+            return result;
+        }
+        return false;
+    }
+
+    private void removeFixedViewInfo(View v, ArrayList<FixedViewInfo> where) {
+        int len = where.size();
+        for (int i = 0; i < len; ++i) {
+            FixedViewInfo info = where.get(i);
+            if (info.view == v) {
+                where.remove(i);
+                break;
+            }
+        }
+    }
+
+    @TargetApi(11)
+    private int getNumColumnsCompatible() {
+        if (Build.VERSION.SDK_INT >= 11) {
+            return super.getNumColumns();
+        } else {
+            try {
+                Field numColumns = getClass().getSuperclass().getDeclaredField("mNumColumns");
+                numColumns.setAccessible(true);
+                return numColumns.getInt(this);
+            } catch (Exception e) {
+                if (mNumColumns != -1) {
+                    return mNumColumns;
+                }
+                throw new RuntimeException("Can not determine the mNumColumns for this API platform, please call setNumColumns to set it.");
+            }
+        }
+    }
+
+    @TargetApi(16)
+    private int getColumnWidthCompatible() {
+        if (Build.VERSION.SDK_INT >= 16) {
+            return super.getColumnWidth();
+        } else {
+            try {
+                Field numColumns = getClass().getSuperclass().getDeclaredField("mColumnWidth");
+                numColumns.setAccessible(true);
+                return numColumns.getInt(this);
+            } catch (NoSuchFieldException e) {
+                throw new RuntimeException(e);
+            } catch (IllegalAccessException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        mViewForMeasureRowHeight = null;
+    }
+
+    public void invalidateRowHeight() {
+        mRowHeight = -1;
+    }
+
+    public int getRowHeight() {
+        if (mRowHeight > 0) {
+            return mRowHeight;
+        }
+        ListAdapter adapter = getAdapter();
+        int numColumns = getNumColumnsCompatible();
+
+        // adapter has not been set or has no views in it;
+        if (adapter == null || adapter.getCount() <= numColumns * (mHeaderViewInfos.size() + mFooterViewInfos.size())) {
+            return -1;
+        }
+        int mColumnWidth = getColumnWidthCompatible();
+        View view = getAdapter().getView(numColumns * mHeaderViewInfos.size(), mViewForMeasureRowHeight, this);
+        LayoutParams p = (LayoutParams) view.getLayoutParams();
+        if (p == null) {
+            p = new LayoutParams(-1, -2, 0);
+            view.setLayoutParams(p);
+        }
+        int childHeightSpec = getChildMeasureSpec(
+                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 0, p.height);
+        int childWidthSpec = getChildMeasureSpec(
+                MeasureSpec.makeMeasureSpec(mColumnWidth, MeasureSpec.EXACTLY), 0, p.width);
+        view.measure(childWidthSpec, childHeightSpec);
+        mViewForMeasureRowHeight = view;
+        mRowHeight = view.getMeasuredHeight();
+        return mRowHeight;
+    }
+
+    @TargetApi(11)
+    public void tryToScrollToBottomSmoothly() {
+        int lastPos = getAdapter().getCount() - 1;
+        if (Build.VERSION.SDK_INT >= 11) {
+            smoothScrollToPositionFromTop(lastPos, 0);
+        } else {
+            setSelection(lastPos);
+        }
+    }
+
+    @TargetApi(11)
+    public void tryToScrollToBottomSmoothly(int duration) {
+        int lastPos = getAdapter().getCount() - 1;
+        if (Build.VERSION.SDK_INT >= 11) {
+            smoothScrollToPositionFromTop(lastPos, 0, duration);
+        } else {
+            setSelection(lastPos);
+        }
+    }
+
+    @Override
+    public void setAdapter(ListAdapter adapter) {
+        if (mHeaderViewInfos.size() > 0 || mFooterViewInfos.size() > 0) {
+            HeaderViewGridAdapter headerViewGridAdapter = new HeaderViewGridAdapter(mHeaderViewInfos, mFooterViewInfos, adapter);
+            int numColumns = getNumColumnsCompatible();
+            if (numColumns > 1) {
+                headerViewGridAdapter.setNumColumns(numColumns);
+            }
+            headerViewGridAdapter.setRowHeight(getRowHeight());
+            super.setAdapter(headerViewGridAdapter);
+        } else {
+            super.setAdapter(adapter);
+        }
+    }
+
+    /**
+     * full width
+     */
+    private class FullWidthFixedViewLayout extends FrameLayout {
+
+        public FullWidthFixedViewLayout(Context context) {
+            super(context);
+        }
+
+        @Override
+        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+            int realLeft = GridViewWithHeaderAndFooter.this.getPaddingLeft() + getPaddingLeft();
+            // Try to make where it should be, from left, full width
+            if (realLeft != left) {
+                offsetLeftAndRight(realLeft - left);
+            }
+            super.onLayout(changed, left, top, right, bottom);
+        }
+
+        @Override
+        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+            int targetWidth = GridViewWithHeaderAndFooter.this.getMeasuredWidth()
+                    - GridViewWithHeaderAndFooter.this.getPaddingLeft()
+                    - GridViewWithHeaderAndFooter.this.getPaddingRight();
+            widthMeasureSpec = MeasureSpec.makeMeasureSpec(targetWidth,
+                    MeasureSpec.getMode(widthMeasureSpec));
+            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        }
+    }
+
+    @Override
+    public void setNumColumns(int numColumns) {
+        super.setNumColumns(numColumns);
+        mNumColumns = numColumns;
+        ListAdapter adapter = getAdapter();
+        if (adapter != null && adapter instanceof HeaderViewGridAdapter) {
+            ((HeaderViewGridAdapter) adapter).setNumColumns(numColumns);
+        }
+    }
+
+    /**
+     * ListAdapter used when a HeaderGridView has header views. This ListAdapter
+     * wraps another one and also keeps track of the header views and their
+     * associated data objects.
+     * <p>This is intended as a base class; you will probably not need to
+     * use this class directly in your own code.
+     */
+    private static class HeaderViewGridAdapter implements WrapperListAdapter, Filterable {
+        // This is used to notify the container of updates relating to number of columns
+        // or headers changing, which changes the number of placeholders needed
+        private final DataSetObservable mDataSetObservable = new DataSetObservable();
+        private final ListAdapter mAdapter;
+        static final ArrayList<FixedViewInfo> EMPTY_INFO_LIST =
+                new ArrayList<FixedViewInfo>();
+
+        // This ArrayList is assumed to NOT be null.
+        ArrayList<FixedViewInfo> mHeaderViewInfos;
+        ArrayList<FixedViewInfo> mFooterViewInfos;
+        private int mNumColumns = 1;
+        private int mRowHeight = -1;
+        boolean mAreAllFixedViewsSelectable;
+        private final boolean mIsFilterable;
+        private boolean mCachePlaceHoldView = true;
+        // From Recycle Bin or calling getView, this a question...
+        private boolean mCacheFirstHeaderView = false;
+
+        public HeaderViewGridAdapter(ArrayList<FixedViewInfo> headerViewInfos, ArrayList<FixedViewInfo> footViewInfos, ListAdapter adapter) {
+            mAdapter = adapter;
+            mIsFilterable = adapter instanceof Filterable;
+            if (headerViewInfos == null) {
+                mHeaderViewInfos = EMPTY_INFO_LIST;
+            } else {
+                mHeaderViewInfos = headerViewInfos;
+            }
+
+            if (footViewInfos == null) {
+                mFooterViewInfos = EMPTY_INFO_LIST;
+            } else {
+                mFooterViewInfos = footViewInfos;
+            }
+            mAreAllFixedViewsSelectable = areAllListInfosSelectable(mHeaderViewInfos)
+                    && areAllListInfosSelectable(mFooterViewInfos);
+        }
+
+        public void setNumColumns(int numColumns) {
+            if (numColumns < 1) {
+                return;
+            }
+            if (mNumColumns != numColumns) {
+                mNumColumns = numColumns;
+                notifyDataSetChanged();
+            }
+        }
+
+        public void setRowHeight(int height) {
+            mRowHeight = height;
+        }
+
+        public int getHeadersCount() {
+            return mHeaderViewInfos.size();
+        }
+
+        public int getFootersCount() {
+            return mFooterViewInfos.size();
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return (mAdapter == null || mAdapter.isEmpty()) && getHeadersCount() == 0 && getFootersCount() == 0;
+        }
+
+        private boolean areAllListInfosSelectable(ArrayList<FixedViewInfo> infos) {
+            if (infos != null) {
+                for (FixedViewInfo info : infos) {
+                    if (!info.isSelectable) {
+                        return false;
+                    }
+                }
+            }
+            return true;
+        }
+
+        public boolean removeHeader(View v) {
+            for (int i = 0; i < mHeaderViewInfos.size(); i++) {
+                FixedViewInfo info = mHeaderViewInfos.get(i);
+                if (info.view == v) {
+                    mHeaderViewInfos.remove(i);
+                    mAreAllFixedViewsSelectable =
+                            areAllListInfosSelectable(mHeaderViewInfos) && areAllListInfosSelectable(mFooterViewInfos);
+                    mDataSetObservable.notifyChanged();
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public boolean removeFooter(View v) {
+            for (int i = 0; i < mFooterViewInfos.size(); i++) {
+                FixedViewInfo info = mFooterViewInfos.get(i);
+                if (info.view == v) {
+                    mFooterViewInfos.remove(i);
+                    mAreAllFixedViewsSelectable =
+                            areAllListInfosSelectable(mHeaderViewInfos) && areAllListInfosSelectable(mFooterViewInfos);
+                    mDataSetObservable.notifyChanged();
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public int getCount() {
+            if (mAdapter != null) {
+                return (getFootersCount() + getHeadersCount()) * mNumColumns + getAdapterAndPlaceHolderCount();
+            } else {
+                return (getFootersCount() + getHeadersCount()) * mNumColumns;
+            }
+        }
+
+        @Override
+        public boolean areAllItemsEnabled() {
+            if (mAdapter != null) {
+                return mAreAllFixedViewsSelectable && mAdapter.areAllItemsEnabled();
+            } else {
+                return true;
+            }
+        }
+
+        private int getAdapterAndPlaceHolderCount() {
+            final int adapterCount = (int) (Math.ceil(1f * mAdapter.getCount() / mNumColumns) * mNumColumns);
+            return adapterCount;
+        }
+
+        @Override
+        public boolean isEnabled(int position) {
+            // Header (negative positions will throw an IndexOutOfBoundsException)
+            int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
+            if (position < numHeadersAndPlaceholders) {
+                return position % mNumColumns == 0
+                        && mHeaderViewInfos.get(position / mNumColumns).isSelectable;
+            }
+
+            // Adapter
+            final int adjPosition = position - numHeadersAndPlaceholders;
+            int adapterCount = 0;
+            if (mAdapter != null) {
+                adapterCount = getAdapterAndPlaceHolderCount();
+                if (adjPosition < adapterCount) {
+                    return adjPosition < mAdapter.getCount() && mAdapter.isEnabled(adjPosition);
+                }
+            }
+
+            // Footer (off-limits positions will throw an IndexOutOfBoundsException)
+            final int footerPosition = adjPosition - adapterCount;
+            return footerPosition % mNumColumns == 0
+                    && mFooterViewInfos.get(footerPosition / mNumColumns).isSelectable;
+        }
+
+        @Override
+        public Object getItem(int position) {
+            // Header (negative positions will throw an ArrayIndexOutOfBoundsException)
+            int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
+            if (position < numHeadersAndPlaceholders) {
+                if (position % mNumColumns == 0) {
+                    return mHeaderViewInfos.get(position / mNumColumns).data;
+                }
+                return null;
+            }
+
+            // Adapter
+            final int adjPosition = position - numHeadersAndPlaceholders;
+            int adapterCount = 0;
+            if (mAdapter != null) {
+                adapterCount = getAdapterAndPlaceHolderCount();
+                if (adjPosition < adapterCount) {
+                    if (adjPosition < mAdapter.getCount()) {
+                        return mAdapter.getItem(adjPosition);
+                    } else {
+                        return null;
+                    }
+                }
+            }
+
+            // Footer (off-limits positions will throw an IndexOutOfBoundsException)
+            final int footerPosition = adjPosition - adapterCount;
+            if (footerPosition % mNumColumns == 0) {
+                return mFooterViewInfos.get(footerPosition).data;
+            } else {
+                return null;
+            }
+        }
+
+        @Override
+        public long getItemId(int position) {
+            int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
+            if (mAdapter != null && position >= numHeadersAndPlaceholders) {
+                int adjPosition = position - numHeadersAndPlaceholders;
+                int adapterCount = mAdapter.getCount();
+                if (adjPosition < adapterCount) {
+                    return mAdapter.getItemId(adjPosition);
+                }
+            }
+            return -1;
+        }
+
+        @Override
+        public boolean hasStableIds() {
+            if (mAdapter != null) {
+                return mAdapter.hasStableIds();
+            }
+            return false;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            if (DEBUG) {
+                Log.d(LOG_TAG, String.format("getView: %s, reused: %s", position, convertView == null));
+            }
+            // Header (negative positions will throw an ArrayIndexOutOfBoundsException)
+            int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
+            if (position < numHeadersAndPlaceholders) {
+                View headerViewContainer = mHeaderViewInfos
+                        .get(position / mNumColumns).viewContainer;
+                if (position % mNumColumns == 0) {
+                    return headerViewContainer;
+                } else {
+                    if (convertView == null) {
+                        convertView = new View(parent.getContext());
+                    }
+                    // We need to do this because GridView uses the height of the last item
+                    // in a row to determine the height for the entire row.
+                    convertView.setVisibility(View.INVISIBLE);
+                    convertView.setMinimumHeight(headerViewContainer.getHeight());
+                    return convertView;
+                }
+            }
+            // Adapter
+            final int adjPosition = position - numHeadersAndPlaceholders;
+            int adapterCount = 0;
+            if (mAdapter != null) {
+                adapterCount = getAdapterAndPlaceHolderCount();
+                if (adjPosition < adapterCount) {
+                    if (adjPosition < mAdapter.getCount()) {
+                        View view = mAdapter.getView(adjPosition, convertView, parent);
+                        return view;
+                    } else {
+                        if (convertView == null) {
+                            convertView = new View(parent.getContext());
+                        }
+                        convertView.setVisibility(View.INVISIBLE);
+                        convertView.setMinimumHeight(mRowHeight);
+                        return convertView;
+                    }
+                }
+            }
+            // Footer
+            final int footerPosition = adjPosition - adapterCount;
+            if (footerPosition < getCount()) {
+                View footViewContainer = mFooterViewInfos
+                        .get(footerPosition / mNumColumns).viewContainer;
+                if (position % mNumColumns == 0) {
+                    return footViewContainer;
+                } else {
+                    if (convertView == null) {
+                        convertView = new View(parent.getContext());
+                    }
+                    // We need to do this because GridView uses the height of the last item
+                    // in a row to determine the height for the entire row.
+                    convertView.setVisibility(View.INVISIBLE);
+                    convertView.setMinimumHeight(footViewContainer.getHeight());
+                    return convertView;
+                }
+            }
+            throw new ArrayIndexOutOfBoundsException(position);
+        }
+
+        @Override
+        public int getItemViewType(int position) {
+
+            final int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
+            final int adapterViewTypeStart = mAdapter == null ? 0 : mAdapter.getViewTypeCount() - 1;
+            int type = AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
+            if (mCachePlaceHoldView) {
+                // Header
+                if (position < numHeadersAndPlaceholders) {
+                    if (position == 0) {
+                        if (mCacheFirstHeaderView) {
+                            type = adapterViewTypeStart + mHeaderViewInfos.size() + mFooterViewInfos.size() + 1 + 1;
+                        }
+                    }
+                    if (position % mNumColumns != 0) {
+                        type = adapterViewTypeStart + (position / mNumColumns + 1);
+                    }
+                }
+            }
+
+            // Adapter
+            final int adjPosition = position - numHeadersAndPlaceholders;
+            int adapterCount = 0;
+            if (mAdapter != null) {
+                adapterCount = getAdapterAndPlaceHolderCount();
+                if (adjPosition >= 0 && adjPosition < adapterCount) {
+                    if (adjPosition < mAdapter.getCount()) {
+                        type = mAdapter.getItemViewType(adjPosition);
+                    } else {
+                        if (mCachePlaceHoldView) {
+                            type = adapterViewTypeStart + mHeaderViewInfos.size() + 1;
+                        }
+                    }
+                }
+            }
+
+            if (mCachePlaceHoldView) {
+                // Footer
+                final int footerPosition = adjPosition - adapterCount;
+                if (footerPosition >= 0 && footerPosition < getCount() && (footerPosition % mNumColumns) != 0) {
+                    type = adapterViewTypeStart + mHeaderViewInfos.size() + 1 + (footerPosition / mNumColumns + 1);
+                }
+            }
+            if (DEBUG) {
+                Log.d(LOG_TAG, String.format("getItemViewType: pos: %s, result: %s", position, type, mCachePlaceHoldView, mCacheFirstHeaderView));
+            }
+            return type;
+        }
+
+        /**
+         * content view, content view holder, header[0], header and footer placeholder(s)
+         *
+         * @return
+         */
+        @Override
+        public int getViewTypeCount() {
+            int count = mAdapter == null ? 1 : mAdapter.getViewTypeCount();
+            if (mCachePlaceHoldView) {
+                int offset = mHeaderViewInfos.size() + 1 + mFooterViewInfos.size();
+                if (mCacheFirstHeaderView) {
+                    offset += 1;
+                }
+                count += offset;
+            }
+            if (DEBUG) {
+                Log.d(LOG_TAG, String.format("getViewTypeCount: %s", count));
+            }
+            return count;
+        }
+
+        @Override
+        public void registerDataSetObserver(DataSetObserver observer) {
+            mDataSetObservable.registerObserver(observer);
+            if (mAdapter != null) {
+                mAdapter.registerDataSetObserver(observer);
+            }
+        }
+
+        @Override
+        public void unregisterDataSetObserver(DataSetObserver observer) {
+            mDataSetObservable.unregisterObserver(observer);
+            if (mAdapter != null) {
+                mAdapter.unregisterDataSetObserver(observer);
+            }
+        }
+
+        @Override
+        public Filter getFilter() {
+            if (mIsFilterable) {
+                return ((Filterable) mAdapter).getFilter();
+            }
+            return null;
+        }
+
+        @Override
+        public ListAdapter getWrappedAdapter() {
+            return mAdapter;
+        }
+
+        public void notifyDataSetChanged() {
+            mDataSetObservable.notifyChanged();
+        }
+    }
+
+
+    /**
+     * Sets the selected item and positions the selection y pixels from the top edge of the ListView.
+     * (If in touch mode, the item will not be selected but it will still be positioned appropriately.)
+     *
+     * @param position     Index (starting at 0) of the data item to be selected.
+     * @param y            The distance from the top edge of the ListView (plus padding)
+     *                     that the item will be positioned.
+     *
+     * @see <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4_r1/android/widget/ListView.java#ListView.setSelectionFromTop%28int%2Cint%29">Original code</a>
+     */
+    public void setSelectionFromTop(int position, int y) {
+        if (getAdapter() == null) {
+            return;
+        }
+
+        setSelection(position);
+        //setSelectionInt(position);
+
+        /*if (!isInTouchMode()) {
+            position = super.lookForSelectablePosition(position, true);
+            if (position >= 0) {
+                setNextSelectedPositionInt(position);
+            }
+        } else {
+            mResurrectToPosition = position;
+        }*/
+
+        /*
+        if (position >= 0) {
+            mLayoutMode = LAYOUT_SPECIFIC;
+            mSpecificTop = mListPadding.top + y;
+
+            if (mNeedSync) {
+                mSyncPosition = position;
+                mSyncRowId = getAdapter().getItemId(position);
+            }
+
+            if (mPositionScroller != null) {
+                mPositionScroller.stop();
+            }
+
+            requestLayout();
+        }
+        */
+    }
+
+}
diff --git a/src/third_parties/in/srain/cube/lapache-2.0.txt b/src/third_parties/in/srain/cube/lapache-2.0.txt
new file mode 100644 (file)
index 0000000..72f817f
--- /dev/null
@@ -0,0 +1,201 @@
+  Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file
diff --git a/src/third_parties/michaelOrtiz/TouchImageViewCustom.java b/src/third_parties/michaelOrtiz/TouchImageViewCustom.java
new file mode 100644 (file)
index 0000000..9b0f5a0
--- /dev/null
@@ -0,0 +1,1277 @@
+/**
+ *   @author Michael Ortiz
+ *   @updated Patrick Lackemacher
+ *   @updated Babay88
+ *   @updated @ipsilondev
+ *   @updated hank-cp
+ *   @updated singpolyma
+ *   Copyright (c) 2012 Michael Ortiz
+ */
+
+package third_parties.michaelOrtiz;
+
+import com.owncloud.android.ui.preview.ImageViewCustom;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.PointF;
+import android.graphics.RectF;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.ScaleGestureDetector;
+import android.view.View;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.widget.OverScroller;
+import android.widget.Scroller;
+
+/**
+ * Extends Android ImageView to include pinch zooming, panning, fling and double tap zoom.
+ */
+public class TouchImageViewCustom extends ImageViewCustom {
+    private static final String DEBUG = "DEBUG";
+       
+       //
+       // SuperMin and SuperMax multipliers. Determine how much the image can be
+       // zoomed below or above the zoom boundaries, before animating back to the
+       // min/max zoom boundary.
+       //
+       private static final float SUPER_MIN_MULTIPLIER = .75f;
+       private static final float SUPER_MAX_MULTIPLIER = 1.25f;
+
+    //
+    // Scale of image ranges from minScale to maxScale, where minScale == 1
+    // when the image is stretched to fit view.
+    //
+    private float normalizedScale;
+    
+    //
+    // Matrix applied to image. MSCALE_X and MSCALE_Y should always be equal.
+    // MTRANS_X and MTRANS_Y are the other values used. prevMatrix is the matrix
+    // saved prior to the screen rotating.
+    //
+       private Matrix matrix, prevMatrix;
+
+    private static enum State { NONE, DRAG, ZOOM, FLING, ANIMATE_ZOOM };
+    private State state;
+
+    private float minScale;
+    private float maxScale;
+    private float superMinScale;
+    private float superMaxScale;
+    private float[] m;
+    
+    private Context context;
+    private Fling fling;
+    
+    private ScaleType mScaleType;
+    
+    private boolean imageRenderedAtLeastOnce;
+    private boolean onDrawReady;
+    
+    private ZoomVariables delayedZoomVariables;
+
+    //
+    // Size of view and previous view size (ie before rotation)
+    //
+    private int viewWidth, viewHeight, prevViewWidth, prevViewHeight;
+    
+    //
+    // Size of image when it is stretched to fit view. Before and After rotation.
+    //
+    private float matchViewWidth, matchViewHeight, prevMatchViewWidth, prevMatchViewHeight;
+    
+    private ScaleGestureDetector mScaleDetector;
+    private GestureDetector mGestureDetector;
+    private GestureDetector.OnDoubleTapListener doubleTapListener = null;
+    private OnTouchListener userTouchListener = null;
+    private OnTouchImageViewListener touchImageViewListener = null;
+
+    public TouchImageViewCustom(Context context) {
+        super(context);
+        sharedConstructing(context);
+    }
+
+    public TouchImageViewCustom(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        sharedConstructing(context);
+    }
+    
+    public TouchImageViewCustom(Context context, AttributeSet attrs, int defStyle) {
+       super(context, attrs, defStyle);
+       sharedConstructing(context);
+    }
+    
+    private void sharedConstructing(Context context) {
+        super.setClickable(true);
+        this.context = context;
+        mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
+        mGestureDetector = new GestureDetector(context, new GestureListener());
+        matrix = new Matrix();
+        prevMatrix = new Matrix();
+        m = new float[9];
+        normalizedScale = 1;
+        if (mScaleType == null) {
+               mScaleType = ScaleType.FIT_CENTER;
+        }
+        minScale = 1;
+        maxScale = 3;
+        superMinScale = SUPER_MIN_MULTIPLIER * minScale;
+        superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
+        setImageMatrix(matrix);
+        setScaleType(ScaleType.MATRIX);
+        setState(State.NONE);
+        onDrawReady = false;
+        super.setOnTouchListener(new PrivateOnTouchListener());
+    }
+
+    @Override
+    public void setOnTouchListener(View.OnTouchListener l) {
+        userTouchListener = l;
+    }
+    
+    public void setOnTouchImageViewListener(OnTouchImageViewListener l) {
+       touchImageViewListener = l;
+    }
+
+    public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener l) {
+        doubleTapListener = l;
+    }
+
+    @Override
+    public void setImageResource(int resId) {
+       super.setImageResource(resId);
+       savePreviousImageValues();
+       fitImageToView();
+    }
+    
+    @Override
+    public void setImageBitmap(Bitmap bm) {
+       super.setImageBitmap(bm);
+       savePreviousImageValues();
+       fitImageToView();
+    }
+    
+    @Override
+    public void setImageDrawable(Drawable drawable) {
+       super.setImageDrawable(drawable);
+       savePreviousImageValues();
+       fitImageToView();
+    }
+    
+    @Override
+    public void setImageURI(Uri uri) {
+       super.setImageURI(uri);
+       savePreviousImageValues();
+       fitImageToView();
+    }
+    
+    @Override
+    public void setScaleType(ScaleType type) {
+       if (type == ScaleType.FIT_START || type == ScaleType.FIT_END) {
+               throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
+       }
+       if (type == ScaleType.MATRIX) {
+               super.setScaleType(ScaleType.MATRIX);
+               
+       } else {
+               mScaleType = type;
+               if (onDrawReady) {
+                       //
+                       // If the image is already rendered, scaleType has been called programmatically
+                       // and the TouchImageView should be updated with the new scaleType.
+                       //
+                       setZoom(this);
+               }
+       }
+    }
+    
+    @Override
+    public ScaleType getScaleType() {
+       return mScaleType;
+    }
+    
+    /**
+     * Returns false if image is in initial, unzoomed state. False, otherwise.
+     * @return true if image is zoomed
+     */
+    public boolean isZoomed() {
+       return normalizedScale != 1;
+    }
+    
+    /**
+     * Return a Rect representing the zoomed image.
+     * @return rect representing zoomed image
+     */
+    public RectF getZoomedRect() {
+       if (mScaleType == ScaleType.FIT_XY) {
+               throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
+       }
+       PointF topLeft = transformCoordTouchToBitmap(0, 0, true);
+       PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true);
+       
+       float w = getDrawable().getIntrinsicWidth();
+       float h = getDrawable().getIntrinsicHeight();
+       return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h);
+    }
+    
+    /**
+     * Save the current matrix and view dimensions
+     * in the prevMatrix and prevView variables.
+     */
+    private void savePreviousImageValues() {
+       if (matrix != null && viewHeight != 0 && viewWidth != 0) {
+               matrix.getValues(m);
+               prevMatrix.setValues(m);
+               prevMatchViewHeight = matchViewHeight;
+               prevMatchViewWidth = matchViewWidth;
+               prevViewHeight = viewHeight;
+               prevViewWidth = viewWidth;
+       }
+    }
+    
+    @Override
+    public Parcelable onSaveInstanceState() {
+       Bundle bundle = new Bundle();
+       bundle.putParcelable("instanceState", super.onSaveInstanceState());
+       bundle.putFloat("saveScale", normalizedScale);
+       bundle.putFloat("matchViewHeight", matchViewHeight);
+       bundle.putFloat("matchViewWidth", matchViewWidth);
+       bundle.putInt("viewWidth", viewWidth);
+       bundle.putInt("viewHeight", viewHeight);
+       matrix.getValues(m);
+       bundle.putFloatArray("matrix", m);
+       bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce);
+       return bundle;
+    }
+    
+    @Override
+    public void onRestoreInstanceState(Parcelable state) {
+       if (state instanceof Bundle) {
+               Bundle bundle = (Bundle) state;
+               normalizedScale = bundle.getFloat("saveScale");
+               m = bundle.getFloatArray("matrix");
+               prevMatrix.setValues(m);
+               prevMatchViewHeight = bundle.getFloat("matchViewHeight");
+               prevMatchViewWidth = bundle.getFloat("matchViewWidth");
+               prevViewHeight = bundle.getInt("viewHeight");
+               prevViewWidth = bundle.getInt("viewWidth");
+               imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
+               super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
+               return;
+       }
+
+       super.onRestoreInstanceState(state);
+    }
+    
+    @Override
+    protected void onDraw(Canvas canvas) {
+       onDrawReady = true;
+       imageRenderedAtLeastOnce = true;
+       if (delayedZoomVariables != null) {
+               setZoom(delayedZoomVariables.scale, delayedZoomVariables.focusX, delayedZoomVariables.focusY, delayedZoomVariables.scaleType);
+               delayedZoomVariables = null;
+       }
+       super.onDraw(canvas);
+    }
+    
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+       super.onConfigurationChanged(newConfig);
+       savePreviousImageValues();
+    }
+    
+    /**
+     * Get the max zoom multiplier.
+     * @return max zoom multiplier.
+     */
+    public float getMaxZoom() {
+       return maxScale;
+    }
+
+    /**
+     * Set the max zoom multiplier. Default value: 3.
+     * @param max max zoom multiplier.
+     */
+    public void setMaxZoom(float max) {
+        maxScale = max;
+        superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
+    }
+    
+    /**
+     * Get the min zoom multiplier.
+     * @return min zoom multiplier.
+     */
+    public float getMinZoom() {
+       return minScale;
+    }
+    
+    /**
+     * Get the current zoom. This is the zoom relative to the initial
+     * scale, not the original resource.
+     * @return current zoom multiplier.
+     */
+    public float getCurrentZoom() {
+       return normalizedScale;
+    }
+    
+    /**
+     * Set the min zoom multiplier. Default value: 1.
+     * @param min min zoom multiplier.
+     */
+    public void setMinZoom(float min) {
+       minScale = min;
+       superMinScale = SUPER_MIN_MULTIPLIER * minScale;
+    }
+    
+    /**
+     * Reset zoom and translation to initial state.
+     */
+    public void resetZoom() {
+       normalizedScale = 1;
+       fitImageToView();
+    }
+    
+    /**
+     * Set zoom to the specified scale. Image will be centered by default.
+     * @param scale
+     */
+    public void setZoom(float scale) {
+       setZoom(scale, 0.5f, 0.5f);
+    }
+    
+    /**
+     * Set zoom to the specified scale. Image will be centered around the point
+     * (focusX, focusY). These floats range from 0 to 1 and denote the focus point
+     * as a fraction from the left and top of the view. For example, the top left 
+     * corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
+     * @param scale
+     * @param focusX
+     * @param focusY
+     */
+    public void setZoom(float scale, float focusX, float focusY) {
+       setZoom(scale, focusX, focusY, mScaleType);
+    }
+    
+    /**
+     * Set zoom to the specified scale. Image will be centered around the point
+     * (focusX, focusY). These floats range from 0 to 1 and denote the focus point
+     * as a fraction from the left and top of the view. For example, the top left 
+     * corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
+     * @param scale
+     * @param focusX
+     * @param focusY
+     * @param scaleType
+     */
+    public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) {
+       //
+       // setZoom can be called before the image is on the screen, but at this point, 
+       // image and view sizes have not yet been calculated in onMeasure. Thus, we should
+       // delay calling setZoom until the view has been measured.
+       //
+       if (!onDrawReady) {
+               delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType);
+               return;
+       }
+       
+       if (scaleType != mScaleType) {
+               setScaleType(scaleType);
+       }
+       resetZoom();
+       scaleImage(scale, viewWidth / 2, viewHeight / 2, true);
+       matrix.getValues(m);
+       m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f));
+       m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f));
+       matrix.setValues(m);
+       fixTrans();
+       setImageMatrix(matrix);
+    }
+    
+    /**
+     * Set zoom parameters equal to another TouchImageView. Including scale, position,
+     * and ScaleType.
+     * @param img
+     */
+    public void setZoom(TouchImageViewCustom img) {
+       PointF center = img.getScrollPosition();
+       setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
+    }
+    
+    /**
+     * Return the point at the center of the zoomed image. The PointF coordinates range
+     * in value between 0 and 1 and the focus point is denoted as a fraction from the left 
+     * and top of the view. For example, the top left corner of the image would be (0, 0). 
+     * And the bottom right corner would be (1, 1).
+     * @return PointF representing the scroll position of the zoomed image.
+     */
+    public PointF getScrollPosition() {
+       Drawable drawable = getDrawable();
+       if (drawable == null) {
+               return null;
+       }
+       int drawableWidth = drawable.getIntrinsicWidth();
+        int drawableHeight = drawable.getIntrinsicHeight();
+        
+        PointF point = transformCoordTouchToBitmap(viewWidth / 2, viewHeight / 2, true);
+        point.x /= drawableWidth;
+        point.y /= drawableHeight;
+        return point;
+    }
+    
+    /**
+     * Set the focus point of the zoomed image. The focus points are denoted as a fraction from the
+     * left and top of the view. The focus points can range in value between 0 and 1. 
+     * @param focusX
+     * @param focusY
+     */
+    public void setScrollPosition(float focusX, float focusY) {
+       setZoom(normalizedScale, focusX, focusY);
+    }
+    
+    /**
+     * Performs boundary checking and fixes the image matrix if it 
+     * is out of bounds.
+     */
+    private void fixTrans() {
+        matrix.getValues(m);
+        float transX = m[Matrix.MTRANS_X];
+        float transY = m[Matrix.MTRANS_Y];
+        
+        float fixTransX = getFixTrans(transX, viewWidth, getImageWidth());
+        float fixTransY = getFixTrans(transY, viewHeight, getImageHeight());
+        
+        if (fixTransX != 0 || fixTransY != 0) {
+            matrix.postTranslate(fixTransX, fixTransY);
+        }
+    }
+    
+    /**
+     * When transitioning from zooming from focus to zoom from center (or vice versa)
+     * the image can become unaligned within the view. This is apparent when zooming
+     * quickly. When the content size is less than the view size, the content will often
+     * be centered incorrectly within the view. fixScaleTrans first calls fixTrans() and 
+     * then makes sure the image is centered correctly within the view.
+     */
+    private void fixScaleTrans() {
+       fixTrans();
+       matrix.getValues(m);
+       if (getImageWidth() < viewWidth) {
+               m[Matrix.MTRANS_X] = (viewWidth - getImageWidth()) / 2;
+       }
+       
+       if (getImageHeight() < viewHeight) {
+               m[Matrix.MTRANS_Y] = (viewHeight - getImageHeight()) / 2;
+       }
+       matrix.setValues(m);
+    }
+
+    private float getFixTrans(float trans, float viewSize, float contentSize) {
+        float minTrans, maxTrans;
+
+        if (contentSize <= viewSize) {
+            minTrans = 0;
+            maxTrans = viewSize - contentSize;
+            
+        } else {
+            minTrans = viewSize - contentSize;
+            maxTrans = 0;
+        }
+
+        if (trans < minTrans)
+            return -trans + minTrans;
+        if (trans > maxTrans)
+            return -trans + maxTrans;
+        return 0;
+    }
+    
+    private float getFixDragTrans(float delta, float viewSize, float contentSize) {
+        if (contentSize <= viewSize) {
+            return 0;
+        }
+        return delta;
+    }
+    
+    private float getImageWidth() {
+       return matchViewWidth * normalizedScale;
+    }
+    
+    private float getImageHeight() {
+       return matchViewHeight * normalizedScale;
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        Drawable drawable = getDrawable();
+        if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
+               setMeasuredDimension(0, 0);
+               return;
+        }
+        
+        int drawableWidth = drawable.getIntrinsicWidth();
+        int drawableHeight = drawable.getIntrinsicHeight();
+        int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
+        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
+        viewWidth = setViewSize(widthMode, widthSize, drawableWidth);
+        viewHeight = setViewSize(heightMode, heightSize, drawableHeight);
+        
+        //
+        // Set view dimensions
+        //
+        setMeasuredDimension(viewWidth, viewHeight);
+        
+        //
+        // Fit content within view
+        //
+        fitImageToView();
+    }
+    
+    /**
+     * If the normalizedScale is equal to 1, then the image is made to fit the screen. Otherwise,
+     * it is made to fit the screen according to the dimensions of the previous image matrix. This
+     * allows the image to maintain its zoom after rotation.
+     */
+    private void fitImageToView() {
+       Drawable drawable = getDrawable();
+        if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
+               return;
+        }
+        if (matrix == null || prevMatrix == null) {
+               return;
+        }
+        
+        int drawableWidth = drawable.getIntrinsicWidth();
+        int drawableHeight = drawable.getIntrinsicHeight();
+       
+       //
+       // Scale image for view
+       //
+        float scaleX = (float) viewWidth / drawableWidth;
+        float scaleY = (float) viewHeight / drawableHeight;
+        
+        switch (mScaleType) {
+        case CENTER:
+               scaleX = scaleY = 1;
+               break;
+               
+        case CENTER_CROP:
+               scaleX = scaleY = Math.max(scaleX, scaleY);
+               break;
+               
+        case CENTER_INSIDE:
+               scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
+               
+        case FIT_CENTER:
+               scaleX = scaleY = Math.min(scaleX, scaleY);
+               break;
+               
+        case FIT_XY:
+               break;
+               
+       default:
+               //
+               // FIT_START and FIT_END not supported
+               //
+               throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
+               
+        }
+
+        //
+        // Center the image
+        //
+        float redundantXSpace = viewWidth - (scaleX * drawableWidth);
+        float redundantYSpace = viewHeight - (scaleY * drawableHeight);
+        matchViewWidth = viewWidth - redundantXSpace;
+        matchViewHeight = viewHeight - redundantYSpace;
+        if (!isZoomed() && !imageRenderedAtLeastOnce) {
+               //
+               // Stretch and center image to fit view
+               //
+               matrix.setScale(scaleX, scaleY);
+               matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
+               normalizedScale = 1;
+               
+        } else {
+               //
+               // These values should never be 0 or we will set viewWidth and viewHeight
+               // to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues
+               // to set them equal to the current values.
+               //
+               if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
+                       savePreviousImageValues();
+               }
+               
+               prevMatrix.getValues(m);
+               
+               //
+               // Rescale Matrix after rotation
+               //
+               m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
+               m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
+               
+               //
+               // TransX and TransY from previous matrix
+               //
+            float transX = m[Matrix.MTRANS_X];
+            float transY = m[Matrix.MTRANS_Y];
+            
+            //
+            // Width
+            //
+            float prevActualWidth = prevMatchViewWidth * normalizedScale;
+            float actualWidth = getImageWidth();
+            translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth);
+            
+            //
+            // Height
+            //
+            float prevActualHeight = prevMatchViewHeight * normalizedScale;
+            float actualHeight = getImageHeight();
+            translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight);
+            
+            //
+            // Set the matrix to the adjusted scale and translate values.
+            //
+            matrix.setValues(m);
+        }
+        fixTrans();
+        setImageMatrix(matrix);
+    }
+    
+    /**
+     * Set view dimensions based on layout params
+     * 
+     * @param mode 
+     * @param size
+     * @param drawableWidth
+     * @return
+     */
+    private int setViewSize(int mode, int size, int drawableWidth) {
+       int viewSize;
+       switch (mode) {
+               case MeasureSpec.EXACTLY:
+                       viewSize = size;
+                       break;
+                       
+               case MeasureSpec.AT_MOST:
+                       viewSize = Math.min(drawableWidth, size);
+                       break;
+                       
+               case MeasureSpec.UNSPECIFIED:
+                       viewSize = drawableWidth;
+                       break;
+                       
+               default:
+                       viewSize = size;
+                       break;
+               }
+       return viewSize;
+    }
+    
+    /**
+     * After rotating, the matrix needs to be translated. This function finds the area of image 
+     * which was previously centered and adjusts translations so that is again the center, post-rotation.
+     * 
+     * @param axis Matrix.MTRANS_X or Matrix.MTRANS_Y
+     * @param trans the value of trans in that axis before the rotation
+     * @param prevImageSize the width/height of the image before the rotation
+     * @param imageSize width/height of the image after rotation
+     * @param prevViewSize width/height of view before rotation
+     * @param viewSize width/height of view after rotation
+     * @param drawableSize width/height of drawable
+     */
+    private void translateMatrixAfterRotate(int axis, float trans, float prevImageSize, float imageSize, int prevViewSize, int viewSize, int drawableSize) {
+       if (imageSize < viewSize) {
+               //
+               // The width/height of image is less than the view's width/height. Center it.
+               //
+               m[axis] = (viewSize - (drawableSize * m[Matrix.MSCALE_X])) * 0.5f;
+               
+        } else if (trans > 0) {
+               //
+               // The image is larger than the view, but was not before rotation. Center it.
+               //
+               m[axis] = -((imageSize - viewSize) * 0.5f);
+               
+        } else {
+               //
+               // Find the area of the image which was previously centered in the view. Determine its distance
+               // from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage
+               // to calculate the trans in the new view width/height.
+               //
+               float percentage = (Math.abs(trans) + (0.5f * prevViewSize)) / prevImageSize;
+               m[axis] = -((percentage * imageSize) - (viewSize * 0.5f));
+        }
+    }
+    
+    private void setState(State state) {
+       this.state = state;
+    }
+    
+    public boolean canScrollHorizontallyFroyo(int direction) {
+        return canScrollHorizontally(direction);
+    }
+    
+    @Override
+    public boolean canScrollHorizontally(int direction) {
+       matrix.getValues(m);
+       float x = m[Matrix.MTRANS_X];
+       
+       if (getImageWidth() < viewWidth) {
+               return false;
+               
+       } else if (x >= -1 && direction < 0) {
+               return false;
+               
+       } else if (Math.abs(x) + viewWidth + 1 >= getImageWidth() && direction > 0) {
+               return false;
+       }
+       
+       return true;
+    }
+    
+    /**
+     * Gesture Listener detects a single click or long click and passes that on
+     * to the view's listener.
+     * @author Ortiz
+     *
+     */
+    private class GestureListener extends GestureDetector.SimpleOnGestureListener {
+       
+        @Override
+        public boolean onSingleTapConfirmed(MotionEvent e)
+        {
+            if(doubleTapListener != null) {
+               return doubleTapListener.onSingleTapConfirmed(e);
+            }
+               return performClick();
+        }
+        
+        @Override
+        public void onLongPress(MotionEvent e)
+        {
+               performLongClick();
+        }
+        
+        @Override
+        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
+        {
+               if (fling != null) {
+                       //
+                       // If a previous fling is still active, it should be cancelled so that two flings
+                       // are not run simultaenously.
+                       //
+                       fling.cancelFling();
+               }
+               fling = new Fling((int) velocityX, (int) velocityY);
+               compatPostOnAnimation(fling);
+               return super.onFling(e1, e2, velocityX, velocityY);
+        }
+        
+        @Override
+        public boolean onDoubleTap(MotionEvent e) {
+               boolean consumed = false;
+            if(doubleTapListener != null) {
+               consumed = doubleTapListener.onDoubleTap(e);
+            }
+               if (state == State.NONE) {
+                       float targetZoom = (normalizedScale == minScale) ? maxScale : minScale;
+                       DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, e.getX(), e.getY(), false);
+                       compatPostOnAnimation(doubleTap);
+                       consumed = true;
+               }
+               return consumed;
+        }
+
+        @Override
+        public boolean onDoubleTapEvent(MotionEvent e) {
+            if(doubleTapListener != null) {
+               return doubleTapListener.onDoubleTapEvent(e);
+            }
+            return false;
+        }
+    }
+    
+    public interface OnTouchImageViewListener {
+       public void onMove();
+    }
+    
+    /**
+     * Responsible for all touch events. Handles the heavy lifting of drag and also sends
+     * touch events to Scale Detector and Gesture Detector.
+     * @author Ortiz
+     *
+     */
+    private class PrivateOnTouchListener implements OnTouchListener {
+       
+       //
+        // Remember last point position for dragging
+        //
+        private PointF last = new PointF();
+       
+       @Override
+        public boolean onTouch(View v, MotionEvent event) {
+            mScaleDetector.onTouchEvent(event);
+            mGestureDetector.onTouchEvent(event);
+            PointF curr = new PointF(event.getX(), event.getY());
+            
+            if (state == State.NONE || state == State.DRAG || state == State.FLING) {
+                   switch (event.getAction()) {
+                       case MotionEvent.ACTION_DOWN:
+                               last.set(curr);
+                           if (fling != null)
+                               fling.cancelFling();
+                           setState(State.DRAG);
+                           break;
+                           
+                       case MotionEvent.ACTION_MOVE:
+                           if (state == State.DRAG) {
+                               float deltaX = curr.x - last.x;
+                               float deltaY = curr.y - last.y;
+                               float fixTransX = getFixDragTrans(deltaX, viewWidth, getImageWidth());
+                               float fixTransY = getFixDragTrans(deltaY, viewHeight, getImageHeight());
+                               matrix.postTranslate(fixTransX, fixTransY);
+                               fixTrans();
+                               last.set(curr.x, curr.y);
+                           }
+                           break;
+       
+                       case MotionEvent.ACTION_UP:
+                       case MotionEvent.ACTION_POINTER_UP:
+                           setState(State.NONE);
+                           break;
+                   }
+            }
+            
+            setImageMatrix(matrix);
+            
+            //
+               // User-defined OnTouchListener
+               //
+               if(userTouchListener != null) {
+                       userTouchListener.onTouch(v, event);
+               }
+            
+               //
+               // OnTouchImageViewListener is set: TouchImageView dragged by user.
+               //
+               if (touchImageViewListener != null) {
+                       touchImageViewListener.onMove();
+               }
+               
+            //
+            // indicate event was handled
+            //
+            return true;
+        }
+    }
+
+    /**
+     * ScaleListener detects user two finger scaling and scales image.
+     * @author Ortiz
+     *
+     */
+    private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
+        @Override
+        public boolean onScaleBegin(ScaleGestureDetector detector) {
+            setState(State.ZOOM);
+            return true;
+        }
+
+        @Override
+        public boolean onScale(ScaleGestureDetector detector) {
+               scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);
+               
+               //
+               // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
+               //
+               if (touchImageViewListener != null) {
+                       touchImageViewListener.onMove();
+               }
+            return true;
+        }
+        
+        @Override
+        public void onScaleEnd(ScaleGestureDetector detector) {
+               super.onScaleEnd(detector);
+               setState(State.NONE);
+               boolean animateToZoomBoundary = false;
+               float targetZoom = normalizedScale;
+               if (normalizedScale > maxScale) {
+                       targetZoom = maxScale;
+                       animateToZoomBoundary = true;
+                       
+               } else if (normalizedScale < minScale) {
+                       targetZoom = minScale;
+                       animateToZoomBoundary = true;
+               }
+               
+               if (animateToZoomBoundary) {
+                       DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
+                       compatPostOnAnimation(doubleTap);
+               }
+        }
+    }
+    
+    private void scaleImage(double deltaScale, float focusX, float focusY, boolean stretchImageToSuper) {
+       
+       float lowerScale, upperScale;
+       if (stretchImageToSuper) {
+               lowerScale = superMinScale;
+               upperScale = superMaxScale;
+               
+       } else {
+               lowerScale = minScale;
+               upperScale = maxScale;
+       }
+       
+       float origScale = normalizedScale;
+        normalizedScale *= deltaScale;
+        if (normalizedScale > upperScale) {
+            normalizedScale = upperScale;
+            deltaScale = upperScale / origScale;
+        } else if (normalizedScale < lowerScale) {
+            normalizedScale = lowerScale;
+            deltaScale = lowerScale / origScale;
+        }
+        
+        matrix.postScale((float) deltaScale, (float) deltaScale, focusX, focusY);
+        fixScaleTrans();
+    }
+    
+    /**
+     * DoubleTapZoom calls a series of runnables which apply
+     * an animated zoom in/out graphic to the image.
+     * @author Ortiz
+     *
+     */
+    private class DoubleTapZoom implements Runnable {
+       
+       private long startTime;
+       private static final float ZOOM_TIME = 500;
+       private float startZoom, targetZoom;
+       private float bitmapX, bitmapY;
+       private boolean stretchImageToSuper;
+       private AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
+       private PointF startTouch;
+       private PointF endTouch;
+
+       DoubleTapZoom(float targetZoom, float focusX, float focusY, boolean stretchImageToSuper) {
+               setState(State.ANIMATE_ZOOM);
+               startTime = System.currentTimeMillis();
+               this.startZoom = normalizedScale;
+               this.targetZoom = targetZoom;
+               this.stretchImageToSuper = stretchImageToSuper;
+               PointF bitmapPoint = transformCoordTouchToBitmap(focusX, focusY, false);
+               this.bitmapX = bitmapPoint.x;
+               this.bitmapY = bitmapPoint.y;
+               
+               //
+               // Used for translating image during scaling
+               //
+               startTouch = transformCoordBitmapToTouch(bitmapX, bitmapY);
+               endTouch = new PointF(viewWidth / 2, viewHeight / 2);
+       }
+
+               @Override
+               public void run() {
+                       float t = interpolate();
+                       double deltaScale = calculateDeltaScale(t);
+                       scaleImage(deltaScale, bitmapX, bitmapY, stretchImageToSuper);
+                       translateImageToCenterTouchPosition(t);
+                       fixScaleTrans();
+                       setImageMatrix(matrix);
+                       
+                       //
+                       // OnTouchImageViewListener is set: double tap runnable updates listener
+                       // with every frame.
+                       //
+                       if (touchImageViewListener != null) {
+                               touchImageViewListener.onMove();
+                       }
+                       
+                       if (t < 1f) {
+                               //
+                               // We haven't finished zooming
+                               //
+                               compatPostOnAnimation(this);
+                               
+                       } else {
+                               //
+                               // Finished zooming
+                               //
+                               setState(State.NONE);
+                       }
+               }
+               
+               /**
+                * Interpolate between where the image should start and end in order to translate
+                * the image so that the point that is touched is what ends up centered at the end
+                * of the zoom.
+                * @param t
+                */
+               private void translateImageToCenterTouchPosition(float t) {
+                       float targetX = startTouch.x + t * (endTouch.x - startTouch.x);
+                       float targetY = startTouch.y + t * (endTouch.y - startTouch.y);
+                       PointF curr = transformCoordBitmapToTouch(bitmapX, bitmapY);
+                       matrix.postTranslate(targetX - curr.x, targetY - curr.y);
+               }
+               
+               /**
+                * Use interpolator to get t
+                * @return
+                */
+               private float interpolate() {
+                       long currTime = System.currentTimeMillis();
+                       float elapsed = (currTime - startTime) / ZOOM_TIME;
+                       elapsed = Math.min(1f, elapsed);
+                       return interpolator.getInterpolation(elapsed);
+               }
+               
+               /**
+                * Interpolate the current targeted zoom and get the delta
+                * from the current zoom.
+                * @param t
+                * @return
+                */
+               private double calculateDeltaScale(float t) {
+                       double zoom = startZoom + t * (targetZoom - startZoom);
+                       return zoom / normalizedScale;
+               }
+    }
+    
+    /**
+     * This function will transform the coordinates in the touch event to the coordinate 
+     * system of the drawable that the imageview contain
+     * @param x x-coordinate of touch event
+     * @param y y-coordinate of touch event
+     * @param clipToBitmap Touch event may occur within view, but outside image content. True, to clip return value
+     *                         to the bounds of the bitmap size.
+     * @return Coordinates of the point touched, in the coordinate system of the original drawable.
+     */
+    private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) {
+         matrix.getValues(m);
+         float origW = getDrawable().getIntrinsicWidth();
+         float origH = getDrawable().getIntrinsicHeight();
+         float transX = m[Matrix.MTRANS_X];
+         float transY = m[Matrix.MTRANS_Y];
+         float finalX = ((x - transX) * origW) / getImageWidth();
+         float finalY = ((y - transY) * origH) / getImageHeight();
+         
+         if (clipToBitmap) {
+                finalX = Math.min(Math.max(finalX, 0), origW);
+                finalY = Math.min(Math.max(finalY, 0), origH);
+         }
+         
+         return new PointF(finalX , finalY);
+    }
+    
+    /**
+     * Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the
+     * drawable's coordinate system to the view's coordinate system.
+     * @param bx x-coordinate in original bitmap coordinate system
+     * @param by y-coordinate in original bitmap coordinate system
+     * @return Coordinates of the point in the view's coordinate system.
+     */
+    private PointF transformCoordBitmapToTouch(float bx, float by) {
+        matrix.getValues(m);        
+        float origW = getDrawable().getIntrinsicWidth();
+        float origH = getDrawable().getIntrinsicHeight();
+        float px = bx / origW;
+        float py = by / origH;
+        float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px;
+        float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py;
+        return new PointF(finalX , finalY);
+    }
+    
+    /**
+     * Fling launches sequential runnables which apply
+     * the fling graphic to the image. The values for the translation
+     * are interpolated by the Scroller.
+     * @author Ortiz
+     *
+     */
+    private class Fling implements Runnable {
+       
+        CompatScroller scroller;
+       int currX, currY;
+       
+       Fling(int velocityX, int velocityY) {
+               setState(State.FLING);
+               scroller = new CompatScroller(context);
+               matrix.getValues(m);
+               
+               int startX = (int) m[Matrix.MTRANS_X];
+               int startY = (int) m[Matrix.MTRANS_Y];
+               int minX, maxX, minY, maxY;
+               
+               if (getImageWidth() > viewWidth) {
+                       minX = viewWidth - (int) getImageWidth();
+                       maxX = 0;
+                       
+               } else {
+                       minX = maxX = startX;
+               }
+               
+               if (getImageHeight() > viewHeight) {
+                       minY = viewHeight - (int) getImageHeight();
+                       maxY = 0;
+                       
+               } else {
+                       minY = maxY = startY;
+               }
+               
+               scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX,
+                    maxX, minY, maxY);
+               currX = startX;
+               currY = startY;
+       }
+       
+       public void cancelFling() {
+               if (scroller != null) {
+                       setState(State.NONE);
+                       scroller.forceFinished(true);
+               }
+       }
+       
+               @Override
+               public void run() {
+                       
+                       //
+                       // OnTouchImageViewListener is set: TouchImageView listener has been flung by user.
+                       // Listener runnable updated with each frame of fling animation.
+                       //
+                       if (touchImageViewListener != null) {
+                               touchImageViewListener.onMove();
+                       }
+                       
+                       if (scroller.isFinished()) {
+                       scroller = null;
+                       return;
+               }
+                       
+                       if (scroller.computeScrollOffset()) {
+                       int newX = scroller.getCurrX();
+                   int newY = scroller.getCurrY();
+                   int transX = newX - currX;
+                   int transY = newY - currY;
+                   currX = newX;
+                   currY = newY;
+                   matrix.postTranslate(transX, transY);
+                   fixTrans();
+                   setImageMatrix(matrix);
+                   compatPostOnAnimation(this);
+               }
+               }
+    }
+    
+    @TargetApi(Build.VERSION_CODES.GINGERBREAD)
+       private class CompatScroller {
+       Scroller scroller;
+       OverScroller overScroller;
+       boolean isPreGingerbread;
+       
+       public CompatScroller(Context context) {
+               if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
+                       isPreGingerbread = true;
+                       scroller = new Scroller(context);
+                       
+               } else {
+                       isPreGingerbread = false;
+                       overScroller = new OverScroller(context);
+               }
+       }
+       
+       public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY) {
+               if (isPreGingerbread) {
+                       scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
+               } else {
+                       overScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
+               }
+       }
+       
+       public void forceFinished(boolean finished) {
+               if (isPreGingerbread) {
+                       scroller.forceFinished(finished);
+               } else {
+                       overScroller.forceFinished(finished);
+               }
+       }
+       
+       public boolean isFinished() {
+               if (isPreGingerbread) {
+                       return scroller.isFinished();
+               } else {
+                       return overScroller.isFinished();
+               }
+       }
+       
+       public boolean computeScrollOffset() {
+               if (isPreGingerbread) {
+                       return scroller.computeScrollOffset();
+               } else {
+                       overScroller.computeScrollOffset();
+                       return overScroller.computeScrollOffset();
+               }
+       }
+       
+       public int getCurrX() {
+               if (isPreGingerbread) {
+                       return scroller.getCurrX();
+               } else {
+                       return overScroller.getCurrX();
+               }
+       }
+       
+       public int getCurrY() {
+               if (isPreGingerbread) {
+                       return scroller.getCurrY();
+               } else {
+                       return overScroller.getCurrY();
+               }
+       }
+    }
+    
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+       private void compatPostOnAnimation(Runnable runnable) {
+       if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
+            postOnAnimation(runnable);
+            
+        } else {
+            postDelayed(runnable, 1000/60);
+        }
+    }
+    
+    private class ZoomVariables {
+       public float scale;
+       public float focusX;
+       public float focusY;
+       public ScaleType scaleType;
+       
+       public ZoomVariables(float scale, float focusX, float focusY, ScaleType scaleType) {
+               this.scale = scale;
+               this.focusX = focusX;
+               this.focusY = focusY;
+               this.scaleType = scaleType;
+       }
+    }
+    
+    private void printMatrixInfo() {
+       float[] n = new float[9];
+       matrix.getValues(n);
+       Log.d(DEBUG, "Scale: " + n[Matrix.MSCALE_X] + " TransX: " + n[Matrix.MTRANS_X] + " TransY: " + n[Matrix.MTRANS_Y]);
+    }
+}
\ No newline at end of file
index fc6dc21..769b98b 100644 (file)
@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
diff --git a/user_manual/Makefile b/user_manual/Makefile
new file mode 100644 (file)
index 0000000..74c47b1
--- /dev/null
@@ -0,0 +1,173 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+       @echo "Please use \`make <target>' where <target> is one of"
+       @echo "  html       to make standalone HTML files"
+       @echo "  dirhtml    to make HTML files named index.html in directories"
+       @echo "  singlehtml to make a single large HTML file"
+       @echo "  pickle     to make pickle files"
+       @echo "  json       to make JSON files"
+       @echo "  htmlhelp   to make HTML files and a HTML help project"
+       @echo "  qthelp     to make HTML files and a qthelp project"
+       @echo "  devhelp    to make HTML files and a Devhelp project"
+       @echo "  epub       to make an epub"
+       @echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+       @echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+       @echo "  pdf        to make PDF files"
+       @echo "  text       to make text files"
+       @echo "  man        to make manual pages"
+       @echo "  texinfo    to make Texinfo files"
+       @echo "  info       to make Texinfo files and run them through makeinfo"
+       @echo "  gettext    to make PO message catalogs"
+       @echo "  changes    to make an overview of all changed/added/deprecated items"
+       @echo "  linkcheck  to check all external links for integrity"
+       @echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+       -rm -rf $(BUILDDIR)/*
+
+html:   html-org
+
+html-all: html-release html-org html-com
+
+html-release:
+       $(SPHINXBUILD) -b html -D html_theme='owncloud_release' $(ALLSPHINXOPTS) $(BUILDDIR)/html/release
+       @echo
+       @echo "Build finished. The HTML pages are in $(BUILDDIR)/html/release."
+
+html-org:
+       $(SPHINXBUILD) -b html -D html_theme='owncloud_org' $(ALLSPHINXOPTS) $(BUILDDIR)/html/org
+       @echo
+       @echo "Build finished. The HTML pages are in $(BUILDDIR)/html/org."
+
+html-com:
+       $(SPHINXBUILD) -b html -D html_theme='owncloud_com' $(ALLSPHINXOPTS) $(BUILDDIR)/html/com
+       @echo
+       @echo "Build finished. The HTML pages are in $(BUILDDIR)/html/com."
+
+dirhtml:
+       $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+       @echo
+       @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+       $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+       @echo
+       @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+       $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+       @echo
+       @echo "Build finished; now you can process the pickle files."
+
+json:
+       $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+       @echo
+       @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+       $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+       @echo
+       @echo "Build finished; now you can run HTML Help Workshop with the" \
+             ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+       $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+       @echo
+       @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+             ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+       @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OwncloudDocumentation.qhcp"
+       @echo "To view the help file:"
+       @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OwncloudDocumentation.qhc"
+
+devhelp:
+       $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+       @echo
+       @echo "Build finished."
+       @echo "To view the help file:"
+       @echo "# mkdir -p $$HOME/.local/share/devhelp/OwncloudDocumentation"
+       @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OwncloudDocumentation"
+       @echo "# devhelp"
+
+epub:
+       $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+       @echo
+       @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+       $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+       @echo
+       @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+       @echo "Run \`make' in that directory to run these through (pdf)latex" \
+             "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+       $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+       @echo "Running LaTeX files through pdflatex..."
+       $(MAKE) -C $(BUILDDIR)/latex all-pdf
+       @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+pdf:
+       $(SPHINXBUILD) -b pdf $(ALLSPHINXOPTS) $(BUILDDIR)/pdf
+       @echo
+       @echo "build finished. the text files are in $(BUILDDIR)/pdf."
+
+text:
+       $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+       @echo
+       @echo "build finished. the text files are in $(BUILDDIR)/text."
+
+man:
+       $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+       @echo
+       @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+       $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+       @echo
+       @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+       @echo "Run \`make' in that directory to run these through makeinfo" \
+             "(use \`make info' here to do that automatically)."
+
+info:
+       $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+       @echo "Running Texinfo files through makeinfo..."
+       make -C $(BUILDDIR)/texinfo info
+       @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+       $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+       @echo
+       @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+       $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+       @echo
+       @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+       $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+       @echo
+       @echo "Link check complete; look for any errors in the above output " \
+             "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+       $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+       @echo "Testing of doctests in the sources finished, look at the " \
+             "results in $(BUILDDIR)/doctest/output.txt."
diff --git a/user_manual/android_app.rst b/user_manual/android_app.rst
new file mode 100644 (file)
index 0000000..de2b2d5
--- /dev/null
@@ -0,0 +1,115 @@
+==============================
+Using the ownCloud Android App
+==============================
+
+Accessing your files on your ownCloud server via the Web interface is easy and 
+convenient, as you can use any Web browser on any operating system without 
+installing special client software. However, the ownCloud Android app offers 
+some advantages over the Web interface:
+
+* A simplified interface that fits nicely on a tablet or smartphone
+* Automatic synchronization of your files
+* Instant uploads of photos or videos recorded on your Android device
+* Easily add files from your device to ownCloud
+* Two-factor authentication
+
+Getting the ownCloud Android App
+--------------------------------
+
+One way to get your ownCloud Android app is to log into your ownCloud server 
+from your Android device using a Web browser such as Chrome, Firefox, or 
+Dolphin. The first time you log in to a new ownCloud account you'll see a screen 
+with a download link to the ownCloud app in the `Google Play store
+<https://play.google.com/store/apps/details?id=com.owncloud.android>`_.
+
+.. figure:: images/android-first-screen.jpg
+
+You will also find these links on your Personal page in the Web interface,
+
+You can also get it from the `Amazon App store 
+<http://www.amazon.com/ownCloud-Inc/dp/B00944PQMK/>`_, and get source code and 
+more information from the `ownCloud download page 
+<http://owncloud.org/install/#mobile>`_.
+
+Connecting to Your ownCloud Server
+----------------------------------
+
+The first time you run your ownCloud Android app it opens to a configuration 
+screen. Enter your server URL, login name, password, and click the Connect 
+button. (Click the eyeball to the right of your password to expose your 
+password.)
+
+.. figure:: images/android-new-account.png
+
+For best security your ownCloud server should be SSL-enabled, so that you can 
+connect via ``https``. The ownCloud app will test your connection as soon as 
+you enter it and tell you if you entered it correctly. If your server has a 
+self-signed SSL certificate you'll get a scary warning how it is not to be 
+trusted. Click the OK button to accept the certificate and complete your account 
+setup.
+
+.. figure:: images/android-ssl-cert.png
+
+Managing Files
+--------------
+
+Now you should see the Files page of your ownCloud account. Click the overflow 
+button at the top right (that's the one with three vertical dots, and that is 
+really what it is called) to open a user menu. ``Refresh account`` refreshes the 
+page view. ``Settings`` take you to your settings menu. ``Sort`` gives you the 
+option to sort your files by date, or alphabetically.
+
+.. figure:: images/android-files-page.png
+
+The little file folder icon to the left of the overflow button opens a dialog to 
+create a new folder. The arrow button opens a file upload dialog, and you can 
+either upload content from other Android apps such as Google Drive, the Gallery, 
+your music player, or from your Android filesystem. When you add a new file 
+you will see a confirmation on the top left when it has uploaded successfully, 
+and it is immediately synchronized with the server.
+
+.. figure:: images/android-upload.png
+
+All files (that you have permission to access) on your ownCloud server are 
+displayed in your Android app, but are not downloaded until you download them. 
+Downloaded files are marked with a green arrow.
+
+.. figure:: images/android-file-list.png
+
+Download and preview a file with a short press on the filename.  When the file 
+is in preview mode, a short press on the overflow button opens a menu with 
+options for sharing, opening with an app, removing, sending, and displaying file 
+details. 
+
+.. figure:: images/android-file.png
+
+
+A long press on the filename does not download it, but opens a dialog with 
+options for sharing, downloading, renaming, moving, removing, sending, and 
+viewing file details. 
+
+
+.. figure:: images/android-file-options.png
+
+
+Settings
+--------
+
+The Settings screen offers a number of useful options. In the Accounts 
+section you can configure multiple ownCloud accounts.
+
+The Security section sets up strong two-factor authentication by allowing you 
+to add a PIN (personal identification number) to access your account.  
+
+The Instant Uploads section creates a directory, :file:`/InstantUpload`, and 
+any photos or videos created with your Android device's camera are instantly 
+uploaded to this directory. You also have the option to choose any other 
+existing directory. Another nice option is Upload Pictures/Video via WiFi Only, 
+to conserve your Internet data usage.
+
+.. figure:: images/android-settings.png
+
+The bottom section of the Settings screen has links to help and the 
+app's version number.
+
+.. figure:: images/android-help.png
diff --git a/user_manual/conf.py b/user_manual/conf.py
new file mode 100644 (file)
index 0000000..20e5bda
--- /dev/null
@@ -0,0 +1,293 @@
+# -*- coding: utf-8 -*-
+#
+# ownCloud Documentation documentation build configuration file, created by
+# sphinx-quickstart on Mon Oct 22 23:16:40 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os, inspect
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+#path to this script
+scriptpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.todo']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = [scriptpath+'/ocdoc/_shared_assets/templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'ownCloud Android App Manual'
+copyright = u'2013-2015, The ownCloud developers'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.6.2'
+# The full version, including alpha/beta/rc tags.
+release = version
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build','scripts/*', 'ocdoc/*']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+2
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+html_theme_path = [scriptpath+'/ocdoc/_shared_assets/themes']
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+#html_theme = 'bootstrap'
+html_theme = 'default'
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+html_short_title = "Android App Manual"
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = [scriptpath+'/ocdoc/_shared_assets/static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+html_show_sphinx = False
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'ownCloudAndroidAppManual'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'ownCloudAndroidAppManual.tex', u'ownCloud Android App Manual',
+   u'The ownCloud developers', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('owncloud.1', 'owncloud', u'Android synchronisation and file management utility.',
+     [u'The ownCloud developers'], 1),
+    ('owncloudcmd.1', 'owncloudcmd', u'ownCloud Android app.',
+     [u'The ownCloud developers'], 1),
+]
+
+# If true, show URL addresses after external links.
+man_show_urls = True
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'ownCloudClientManual', u'ownCloud Android App Manual',
+   u'The ownCloud developers', 'ownCloud', 'The ownCloud Android App Manual.',
+   'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+
+# -- Options for Epub output ---------------------------------------------------
+
+# Bibliographic Dublin Core info.
+epub_title = u'ownCloud Android App Manual'
+epub_author = u'The ownCloud developers'
+epub_publisher = u'The ownCloud developers'
+epub_copyright = u'2013-2015, The ownCloud developers'
+
+# The language of the text. It defaults to the language option
+# or en if the language is not set.
+#epub_language = ''
+
+# The scheme of the identifier. Typical schemes are ISBN or URL.
+#epub_scheme = ''
+
+# The unique identifier of the text. This can be a ISBN number
+# or the project homepage.
+#epub_identifier = ''
+
+# A unique identification for the text.
+#epub_uid = ''
+
+# A tuple containing the cover image and cover page html template filenames.
+#epub_cover = ()
+
+# HTML files that should be inserted before the pages created by sphinx.
+# The format is a list of tuples containing the path and title.
+#epub_pre_files = []
+
+# HTML files shat should be inserted after the pages created by sphinx.
+# The format is a list of tuples containing the path and title.
+#epub_post_files = []
+
+# A list of files that should not be packed into the epub file.
+#epub_exclude_files = []
+
+# The depth of the table of contents in toc.ncx.
+#epub_tocdepth = 3
+
+# Allow duplicate toc entries.
+#epub_tocdup = True
+
+# Include todos?
+todo_include_todos = True
diff --git a/user_manual/images/android-downloads.png b/user_manual/images/android-downloads.png
new file mode 100644 (file)
index 0000000..e0bb545
Binary files /dev/null and b/user_manual/images/android-downloads.png differ
diff --git a/user_manual/images/android-file-list.png b/user_manual/images/android-file-list.png
new file mode 100644 (file)
index 0000000..e479b9f
Binary files /dev/null and b/user_manual/images/android-file-list.png differ
diff --git a/user_manual/images/android-file-options.png b/user_manual/images/android-file-options.png
new file mode 100644 (file)
index 0000000..12867a3
Binary files /dev/null and b/user_manual/images/android-file-options.png differ
diff --git a/user_manual/images/android-file.png b/user_manual/images/android-file.png
new file mode 100644 (file)
index 0000000..89ffd28
Binary files /dev/null and b/user_manual/images/android-file.png differ
diff --git a/user_manual/images/android-files-page.png b/user_manual/images/android-files-page.png
new file mode 100644 (file)
index 0000000..1c7fc4d
Binary files /dev/null and b/user_manual/images/android-files-page.png differ
diff --git a/user_manual/images/android-first-screen.jpg b/user_manual/images/android-first-screen.jpg
new file mode 100644 (file)
index 0000000..f4c5132
Binary files /dev/null and b/user_manual/images/android-first-screen.jpg differ
diff --git a/user_manual/images/android-help.png b/user_manual/images/android-help.png
new file mode 100644 (file)
index 0000000..56a7464
Binary files /dev/null and b/user_manual/images/android-help.png differ
diff --git a/user_manual/images/android-new-account.png b/user_manual/images/android-new-account.png
new file mode 100644 (file)
index 0000000..ffbe12e
Binary files /dev/null and b/user_manual/images/android-new-account.png differ
diff --git a/user_manual/images/android-settings.png b/user_manual/images/android-settings.png
new file mode 100644 (file)
index 0000000..7a16084
Binary files /dev/null and b/user_manual/images/android-settings.png differ
diff --git a/user_manual/images/android-ssl-cert.png b/user_manual/images/android-ssl-cert.png
new file mode 100644 (file)
index 0000000..9286fe6
Binary files /dev/null and b/user_manual/images/android-ssl-cert.png differ
diff --git a/user_manual/images/android-upload.png b/user_manual/images/android-upload.png
new file mode 100644 (file)
index 0000000..6ee1b95
Binary files /dev/null and b/user_manual/images/android-upload.png differ
diff --git a/user_manual/index.rst b/user_manual/index.rst
new file mode 100644 (file)
index 0000000..cf15912
--- /dev/null
@@ -0,0 +1,9 @@
+.. _contents:
+
+ownCloud Android App Manual
+==============================
+
+.. toctree::
+   :maxdepth: 2
+   android_app
diff --git a/user_manual/make.bat b/user_manual/make.bat
new file mode 100644 (file)
index 0000000..3fbb57f
--- /dev/null
@@ -0,0 +1,199 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+       set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+       set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+       set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+       :help
+       echo.Please use `make ^<target^>` where ^<target^> is one of
+       echo.  html       to make standalone HTML files
+       echo.  dirhtml    to make HTML files named index.html in directories
+       echo.  singlehtml to make a single large HTML file
+       echo.  pdf        to make a PDF file with rst2pdf
+       echo.  pickle     to make pickle files
+       echo.  json       to make JSON files
+       echo.  htmlhelp   to make HTML files and a HTML help project
+       echo.  qthelp     to make HTML files and a qthelp project
+       echo.  devhelp    to make HTML files and a Devhelp project
+       echo.  epub       to make an epub
+       echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+       echo.  text       to make text files
+       echo.  man        to make manual pages
+       echo.  texinfo    to make Texinfo files
+       echo.  gettext    to make PO message catalogs
+       echo.  changes    to make an overview over all changed/added/deprecated items
+       echo.  linkcheck  to check all external links for integrity
+       echo.  doctest    to run all doctests embedded in the documentation if enabled
+       goto end
+)
+
+if "%1" == "clean" (
+       for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+       del /q /s %BUILDDIR%\*
+       goto end
+)
+
+if "%1" == "html" (
+       %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+       goto end
+)
+
+if "%1" == "dirhtml" (
+       %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+       goto end
+)
+
+if "%1" == "singlehtml" (
+       %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+       goto end
+)
+
+if "%1" == "pdf" (
+       %SPHINXBUILD% -b pdf %ALLSPHINXOPTS% %BUILDDIR%/pdf
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The PDF file is in %BUILDDIR%/pdf.
+       goto end
+)
+
+if "%1" == "pickle" (
+       %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished; now you can process the pickle files.
+       goto end
+)
+
+if "%1" == "json" (
+       %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished; now you can process the JSON files.
+       goto end
+)
+
+if "%1" == "htmlhelp" (
+       %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+       goto end
+)
+
+if "%1" == "qthelp" (
+       %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+       echo.^> qcollectiongenerator %BUILDDIR%\qthelp\OwncloudDocumentation.qhcp
+       echo.To view the help file:
+       echo.^> assistant -collectionFile %BUILDDIR%\qthelp\OwncloudDocumentation.ghc
+       goto end
+)
+
+if "%1" == "devhelp" (
+       %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished.
+       goto end
+)
+
+if "%1" == "epub" (
+       %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The epub file is in %BUILDDIR%/epub.
+       goto end
+)
+
+if "%1" == "latex" (
+       %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+       goto end
+)
+
+if "%1" == "text" (
+       %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The text files are in %BUILDDIR%/text.
+       goto end
+)
+
+if "%1" == "man" (
+       %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The manual pages are in %BUILDDIR%/man.
+       goto end
+)
+
+if "%1" == "texinfo" (
+       %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+       goto end
+)
+
+if "%1" == "gettext" (
+       %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+       goto end
+)
+
+if "%1" == "changes" (
+       %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.The overview file is in %BUILDDIR%/changes.
+       goto end
+)
+
+if "%1" == "linkcheck" (
+       %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+       goto end
+)
+
+if "%1" == "doctest" (
+       %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+       if errorlevel 1 exit /b 1
+       echo.
+       echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+       goto end
+)
+
+:end
diff --git a/user_manual/ocdoc b/user_manual/ocdoc
new file mode 160000 (submodule)
index 0000000..343496c
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 343496c792616459e8204b6614fd42a1b16a6d68