Procházet zdrojové kódy

Merge branch 'gradleWithInternalDependency' into us4_view_text_files

Conflicts:
	src/com/owncloud/android/ui/activity/FileDisplayActivity.java
Jorge Antonio Diaz-Benito Soriano před 10 roky
rodič
revize
10a12fb960

+ 7 - 4
.gitignore

@@ -11,7 +11,6 @@
 # generated files
 bin/
 build/
-*.iml
 gen/
 target/
 
@@ -32,10 +31,14 @@ oc_framework/proguard-project.txt
 oc_framework-test-project/proguard-project.txt
 tests/proguard-project.txt
 
-# Android Studio and Gradle specific entries
+# IntelliJ and Gradle specific entries
 .gradle
-.idea
-*.iml
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/libraries/*.xml
+dataSources.ids
+datasources.xml 
+gradle.xml
 build
 
 # Actionbarsherlock is now ignored since scripts takes care of init the sub-modules.

+ 1 - 0
.idea/.name

@@ -0,0 +1 @@
+android

+ 23 - 0
.idea/compiler.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <option name="DEFAULT_COMPILER" value="Javac" />
+    <resourceExtensions />
+    <wildcardResourcePatterns>
+      <entry name="!?*.java" />
+      <entry name="!?*.form" />
+      <entry name="!?*.class" />
+      <entry name="!?*.groovy" />
+      <entry name="!?*.scala" />
+      <entry name="!?*.flex" />
+      <entry name="!?*.kt" />
+      <entry name="!?*.clj" />
+    </wildcardResourcePatterns>
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="false">
+        <processorPath useClasspath="true" />
+      </profile>
+    </annotationProcessing>
+  </component>
+</project>
+

+ 3 - 0
.idea/copyright/profiles_settings.xml

@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+  <settings default="" />
+</component>

+ 5 - 0
.idea/encodings.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+

+ 10 - 0
.idea/misc.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="EntryPointsManager">
+    <entry_points version="2.0" />
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/build/classes" />
+  </component>
+</project>
+

+ 11 - 0
.idea/modules.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" />
+      <module fileurl="file://$PROJECT_DIR$/owncloud-android-library/owncloud-android-library.iml" filepath="$PROJECT_DIR$/owncloud-android-library/owncloud-android-library.iml" />
+      <module fileurl="file://$PROJECT_DIR$/owncloud-android-library/owncloud-android-library.iml" filepath="$PROJECT_DIR$/owncloud-android-library/owncloud-android-library.iml" />
+    </modules>
+  </component>
+</project>
+

+ 5 - 0
.idea/scopes/scope_settings.xml

@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+  <state>
+    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+  </state>
+</component>

+ 7 - 0
.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>
+

+ 2 - 3
SETUP.md

@@ -86,9 +86,8 @@ NOTE: Even though API level is set to 19, APK also runs on older devices because
 * Complete the setup of project properties running:
     - Windows: "setup_env.bat gradle"
     - Mac OS/Linux: "./setup_env.sh gradle"
-* The first time you want to open the project in Android Studio, select 'Import Project...' and choose the file "android/settings.gradle".
-  Android Studio will then create the '.iml' files it needs. If you ever close the project but the files are still there, you just select
-  'Open Project...'. The file chooser will show an Android face as the folder icon, which you can select to reopen the project.
+* Select 'Open Project...'. The file chooser will show an Android face as the folder icon. Select
+  it to open the project.
 * To build the project, follow the guidelines shown on [4. Building with Gradle][2].
 
 ### 7. Create pull request:

+ 92 - 0
android.iml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android-gradle" name="Android-Gradle">
+      <configuration>
+        <option name="GRADLE_PROJECT_PATH" value=":" />
+      </configuration>
+    </facet>
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="SELECTED_BUILD_VARIANT" value="debug" />
+        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
+        <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
+        <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
+        <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
+        <option name="ALLOW_USER_CONFIGURATION" value="false" />
+        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" />
+        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/res" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/jni" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/build-types/debug/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+      <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+    </content>
+    <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" exported="" name="touch-image-view" level="project" />
+    <orderEntry type="library" exported="" name="disklrucache-2.0.2" level="project" />
+    <orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
+    <orderEntry type="library" exported="" name="jcl-over-slf4j-1.7.4" level="project" />
+    <orderEntry type="library" exported="" name="libs/actionbarsherlock_lib-unspecified" level="project" />
+    <orderEntry type="library" exported="" name="commons-codec-1.2" level="project" />
+    <orderEntry type="library" exported="" name="jackrabbit-webdav-2.7.2" level="project" />
+    <orderEntry type="library" exported="" name="commons-httpclient-3.1" level="project" />
+    <orderEntry type="library" exported="" name="slf4j-api-1.7.5" level="project" />
+    <orderEntry type="module" module-name="owncloud-android-library" exported="" />
+  </component>
+</module>
+

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 99f8c869702a3261d9868207968700277e208507
+Subproject commit 005dd85fdc475c6af0b981a91c758fc41123cf25

+ 0 - 11
res/menu/file_select_all.xml

@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-    <item
-        android:id="@+id/actionbar_select_all"
-        android:icon="@android:drawable/checkbox_off_background"
-        android:orderInCategory="1"
-        android:showAsAction="always"
-        android:title="actionbar_select_all"/>
-    
-
-</menu>

+ 35 - 35
res/values-fr/strings.xml

@@ -40,14 +40,14 @@
   <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 !</string>
+  <string name="recommend_subject">Essayez %1$s sur votre smartphone&amp;nbsp;!</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_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 ?</string>
+  <string name="auth_register">Nouveau dans %1$s&amp;nbsp;?</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>
@@ -82,8 +82,8 @@ Téléchargez-le ici : %2$s</string>
   <string name="common_cancel">Annuler</string>
   <string name="common_save_exit">Sauvegarder &amp; Quitter</string>
   <string name="common_error">Erreur</string>
-  <string name="common_loading">Chargement ...</string>
-  <string name="common_error_unknown">Erreur Inconnue </string>
+  <string name="common_loading">Chargement</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>
@@ -113,7 +113,7 @@ Téléchargez-le ici : %2$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_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 put être synchronisé (%2$d conflits)</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.
@@ -125,7 +125,7 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <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: %1$s</string>
+  <string name="foreign_files_local_text">Local&amp;nbsp;: %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="pincode_enter_pin_code">Veuillez saisir votre code de sécurité</string>
@@ -149,15 +149,15 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <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_invalid_progressive_playback">Le fichier média ne peut pas être diffusé</string>
-  <string name="media_err_unknown">Fichier média ne peut être joué avec le stock de media player</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>
   <string name="media_err_io_ex">Erreur de lecture de fichier à la lecture de %1$s</string>
   <string name="media_err_unexpected">Erreur inattendue à la lecture de %1$s </string>
-  <string name="media_rewind_description">Bouton de rem-bobinage</string>
-  <string name="media_play_pause_description">Bouton de Lecture ou de Pause</string>
+  <string name="media_rewind_description">Bouton de rembobinage</string>
+  <string name="media_play_pause_description">Bouton de lecture ou de pause</string>
   <string name="media_forward_description">Bouton d\'avance rapide</string>
-  <string name="auth_getting_authorization">Demande d\'autorisation...</string>
-  <string name="auth_trying_to_login">Tentative de connexion …</string>
+  <string name="auth_getting_authorization">Demande d\'autorisation</string>
+  <string name="auth_trying_to_login">Tentative de connexion…</string>
   <string name="auth_no_net_conn_title">Pas de connexion réseau</string>
   <string name="auth_nossl_plain_ok_title">Connexion sécurisée non disponible</string>
   <string name="auth_connection_established">Connexion établie</string>
@@ -171,7 +171,7 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <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_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_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>
   <string name="auth_wrong_connection_title">Impossible d\'établir la connexion</string>
   <string name="auth_secure_connection">Connexion sécurisée établie</string>
@@ -182,7 +182,7 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="auth_expired_oauth_token_toast">Votre autorisation a expiré. Merci de vous authentifier à nouveau</string>
   <string name="auth_expired_basic_auth_toast">Veuillez saisir le mot de passe courant</string>
   <string name="auth_expired_saml_sso_token_toast">Votre session a expiré. Merci de vous reconnecter</string>
-  <string name="auth_connecting_auth_server">Connexion au serveur d\'authentification...</string>
+  <string name="auth_connecting_auth_server">Connexion au serveur d\'authentification</string>
   <string name="auth_unsupported_auth_method">Le serveur ne prend pas en charge pas cette méthode d\'authentification</string>
   <string name="auth_unsupported_multiaccount">%1$s ne prend pas en charge les comptes multiples</string>
   <string name="auth_fail_get_user_name">Votre serveur a retourné un identifiant d\'utilisateur incorrect. Veuillez prendre contact avec votre administrateur
@@ -191,8 +191,8 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <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 ?</string>
-  <string name="confirmation_remove_folder_alert">Voulez-vous vraiment supprimer %1$s et son contenu ?</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_local">Local seulement</string>
   <string name="confirmation_remove_folder_local">Le contenu local uniquement</string>
   <string name="confirmation_remove_remote">Effacer du serveur</string>
@@ -205,36 +205,36 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <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="create_dir_fail_msg">Le dossier n\'a pas pu être créé</string>
-  <string name="filename_forbidden_characters">Caractères interdits : / \\ &lt; &gt; : \" | ? *</string>
+  <string name="filename_forbidden_characters">Caractères interdits&amp;nbsp;: / \\ &amp;lt; &amp;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 app pour la sélection du fichier</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="oauth_check_onoff">Connexion avec aAuth2.</string>
-  <string name="oauth_login_connection">Connexion au serveur aAuth2...</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>
   <string name="ssl_validator_reason_cert_not_trusted">- Le certificat du serveur n\'est pas sûr</string>
   <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 ?</string>
+  <string name="ssl_validator_question">Voulez-vous tout de même faire confiance à ce certificat&amp;nbsp;?</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é à :</string>
-  <string name="ssl_validator_label_issuer">Délivré par :</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_CN">Nom d\'usage :</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">De :</string>
-  <string name="ssl_validator_label_validity_to">À :</string>
-  <string name="ssl_validator_label_signature">Signature :</string>
-  <string name="ssl_validator_label_signature_algorithm">Algorithme :</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_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>
@@ -255,7 +255,7 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <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="share_link_no_support_share_api">Désolé, le partage n\'est pas disponible sur votre serveur. Contactez votre administrateur, s\'il vous plait.</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>
   <string name="unshare_link_file_no_exist">Impossible de supprimer le partage. Vérifiez que le fichier est bien présent</string>
@@ -263,7 +263,7 @@ 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 : impossible de réaliser des opérations</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>

+ 31 - 31
res/values-pt-rPT/strings.xml

@@ -1,6 +1,6 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
-  <string name="about_android">%1$s Aplicação(ões) Android</string>
+  <string name="about_android">%1$s App(s) Android</string>
   <string name="about_version">versão %1$s</string>
   <string name="actionbar_sync">Atualizar conta</string>
   <string name="actionbar_upload">Enviar</string>
@@ -51,15 +51,15 @@
   <string name="setup_btn_connect">Ligar</string>
   <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">Nenhuma conta encontrada</string>
-  <string name="uploader_wrn_no_account_text">Não tem nenhuma conta  %1$s no seu dispositivo. Configure uma conta.</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_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 carregar</string>
+  <string name="uploader_wrn_no_content_title">Sem conteúdo para enviar</string>
   <string name="uploader_wrn_no_content_text">Não foi recebido nenhum conteúdo. Nada para enviar.</string>
   <string name="uploader_error_forbidden_content">O  %1$s não está autorizado a aceder aos ficheiro partilhados.</string>
   <string name="uploader_info_uploading">A enviar</string>
-  <string name="file_list_seconds_ago">Minutos atrás</string>
+  <string name="file_list_seconds_ago">segundos atrás</string>
   <string name="file_list_empty">Vazio. Envie alguma coisa!</string>
   <string name="file_list_loading">A carregar ...</string>
   <string name="local_file_list_empty">Não existem ficheiros nesta pasta.</string>
@@ -215,12 +215,12 @@
   <string name="ssl_validator_question">Quer confiar neste certificado de qualquer maneira?</string>
   <string name="ssl_validator_not_saved">O certificado não pôde ser guardado</string>
   <string name="ssl_validator_btn_details_see">Detalhes</string>
-  <string name="ssl_validator_btn_details_hide">Esconder</string>
+  <string name="ssl_validator_btn_details_hide">Ocultar</string>
   <string name="ssl_validator_label_subject">Emitido para:</string>
   <string name="ssl_validator_label_issuer">Emitido por:</string>
   <string name="ssl_validator_label_CN">Nome comum.</string>
   <string name="ssl_validator_label_O">Organização:</string>
-  <string name="ssl_validator_label_OU">Unidade organizaconal.</string>
+  <string name="ssl_validator_label_OU">Unidade organizacional.</string>
   <string name="ssl_validator_label_C">País:</string>
   <string name="ssl_validator_label_ST">Estado:</string>
   <string name="ssl_validator_label_L">Localização:</string>
@@ -229,33 +229,33 @@
   <string name="ssl_validator_label_validity_to">Para:</string>
   <string name="ssl_validator_label_signature">Assinatura:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritmo</string>
-  <string name="ssl_validator_null_cert">O certificado não pôde ser mostrado.</string>
-  <string name="ssl_validator_no_info_about_error">- Nenhuma informação acerca do erro</string>
+  <string name="ssl_validator_null_cert">Não foi possível mostrar o certificado.</string>
+  <string name="ssl_validator_no_info_about_error">- Nenhuma informação sobre o erro</string>
   <string name="placeholder_sentence">Isto é uma variável.</string>
   <string name="placeholder_filename">placeholder.txt</string>
   <string name="placeholder_filetype">Imagem PNG</string>
   <string name="placeholder_filesize">389 KB</string>
-  <string name="placeholder_timestamp">2012/05/18 12:23 PM</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">Enviar fotografias apenas via WiFi</string>
-  <string name="instant_video_upload_on_wifi">Enviar videos apenas por WiFi</string>
-  <string name="instant_upload_path">/Upload-Instantâneo </string>
-  <string name="conflict_title">Conflito na actualização</string>
+  <string name="instant_upload_on_wifi">Só enviar as fotografias via wi-fi</string>
+  <string name="instant_video_upload_on_wifi">Só enviar os vídeos por wi-fi</string>
+  <string name="instant_upload_path">/Envio Instantâneo </string>
+  <string name="conflict_title">Conflito na atualização</string>
   <string name="conflict_message">O ficheiro remoto %s não está sincronizado com o ficheiro local. Se continuar ira substituir o ficheiro no servidor.</string>
-  <string name="conflict_keep_both">Manter os dois</string>
-  <string name="conflict_overwrite">Sobrepor</string>
+  <string name="conflict_keep_both">Manter ambos</string>
+  <string name="conflict_overwrite">Substituir</string>
   <string name="conflict_dont_upload">Não enviar.</string>
-  <string name="preview_image_description">Pré-Visualização da imagem</string>
+  <string name="preview_image_description">Pré-Visualizar imagem</string>
   <string name="preview_image_error_unknown_format">Esta imagem não pode ser mostrada</string>
   <string name="error__upload__local_file_not_copied">Não foi possível copiar %1$s para a pasta local %2$s</string>
-  <string name="prefs_instant_upload_path_title">Caminho de Upload</string>
+  <string name="prefs_instant_upload_path_title">Caminho de \'A Enviar\'</string>
   <string name="share_link_no_support_share_api">Lamentamos mas não é possível partilhar através do seu servidor. Por favor contacte o seu administrador.</string>
   <string name="share_link_file_no_exist">Não é possivel partilhar. Por favor verifique se o ficheiro existe</string>
   <string name="share_link_file_error">Ocorreu um erro enquanto tentava partilhar este ficheiro ou pasta</string>
   <string name="unshare_link_file_no_exist">Não é possível retirar a partilha. Verifique se o ficheiro existe</string>
   <string name="unshare_link_file_error">Ocorreu um erro enquanto retirava a partilha deste ficheiro ou pasta</string>
   <string name="activity_chooser_send_file_title">Enviar</string>
-  <string name="copy_link">Copiar ligação</string>
+  <string name="copy_link">Copiar hiperligação</string>
   <string name="clipboard_text_copied">Copiado para a área de transferência</string>
   <string name="error_cant_bind_to_operations_service">Erro crítico: não é possível executar as operações</string>
   <string name="network_error_socket_exception">Ocorreu um erro durante a ligação ao servidos.</string>
@@ -263,31 +263,31 @@
   <string name="network_error_connect_timeout_exception">Ocorreu um erro durante a ligação ao servidor, não foi possível realizar a operação.</string>
   <string name="network_host_not_available">A operação não foi concluída, o servidor está inacessível.</string>
   <string name="empty"></string>
-  <string name="forbidden_permissions">Você não tem permissão %s</string>
+  <string name="forbidden_permissions">Não tem permissão %s</string>
   <string name="forbidden_permissions_rename">para renomear este ficheiro</string>
-  <string name="forbidden_permissions_delete">para eliminar este ficheiro</string>
+  <string name="forbidden_permissions_delete">para apagar este ficheiro</string>
   <string name="share_link_forbidden_permissions">para partilhar este ficheiro</string>
-  <string name="unshare_link_forbidden_permissions">para eliminar a partilha deste ficheiro</string>
+  <string name="unshare_link_forbidden_permissions">para cancelar a partilha deste ficheiro</string>
   <string name="forbidden_permissions_create">para criar o ficheiro</string>
-  <string name="uploader_upload_forbidden_permissions">para carregar dentro desta pasta</string>
+  <string name="uploader_upload_forbidden_permissions">para enviar nesta pasta</string>
   <string name="downloader_download_file_not_found">O ficheiro não está mais disponível no servidor</string>
   <string name="prefs_category_accounts">Contas</string>
   <string name="prefs_add_account">Adicionar conta</string>
   <string name="auth_redirect_non_secure_connection_title">Ligação segura é redireccionada para um caminho inseguro.</string>
-  <string name="actionbar_logger">Logs</string>
+  <string name="actionbar_logger">Registos de Alterações</string>
   <string name="log_send_history_button">Enviar Histórico</string>
-  <string name="log_mail_subject">Logs da app ownCloud Android</string>
-  <string name="log_progress_dialog_text">A carregar os dados...</string>
+  <string name="log_mail_subject">Registos das alterações da app ownCloud Android</string>
+  <string name="log_progress_dialog_text">A carregar os dados ...</string>
   <string name="saml_authentication_required_text">Autenticação necessária</string>
-  <string name="saml_authentication_wrong_pass">Password errada</string>
+  <string name="saml_authentication_wrong_pass">Palavra-passe errada</string>
   <string name="actionbar_move">Mover</string>
   <string name="file_list_empty_moving">Não está aqui nada. Pode adicionar uma pasta!</string>
-  <string name="move_choose_button_text">Escolha</string>
-  <string name="move_file_not_found">Não é possível mover. Verifique se o ficheiro existe</string>
+  <string name="move_choose_button_text">Escolher</string>
+  <string name="move_file_not_found">Não é possível mover. Por favor, verifique se o ficheiro existe</string>
   <string name="move_file_invalid_into_descendent">Não é possível mover esta pasta deste modo</string>
   <string name="move_file_invalid_overwrite">O ficheiro já existe na pasta de destino</string>
-  <string name="move_file_error">Um erro ocorreu ao tentar mover este ficheiro ou pasta</string>
+  <string name="move_file_error">Ocorreu um ocorreu quando tentava mover este ficheiro ou pasta</string>
   <string name="forbidden_permissions_move">para mover este ficheiro</string>
-  <string name="prefs_category_instant_uploading">Uploads Instantâneos</string>
+  <string name="prefs_category_instant_uploading">Envios Instantâneos</string>
   <string name="prefs_category_security">Segurança</string>
 </resources>

+ 36 - 12
src/com/owncloud/android/files/services/FileUploader.java

@@ -73,6 +73,7 @@ import com.owncloud.android.operations.common.SyncOperation;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.utils.ErrorMessageAdapter;
+import com.owncloud.android.utils.UriUtils;
 
 
 
@@ -120,6 +121,9 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     private NotificationCompat.Builder mNotificationBuilder;
     private int mLastPercent;
 
+    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;
@@ -646,18 +650,6 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
     private OCFile obtainNewOCFileToUpload(String remotePath, String localPath, String mimeType,
             FileDataStorageManager storageManager) {
-        OCFile newFile = new OCFile(remotePath);
-        newFile.setStoragePath(localPath);
-        newFile.setLastSyncDateForProperties(0);
-        newFile.setLastSyncDateForData(0);
-
-        // size
-        if (localPath != null && localPath.length() > 0) {
-            File localFile = new File(localPath);
-            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
 
         // MIME type
         if (mimeType == null || mimeType.length() <= 0) {
@@ -671,6 +663,25 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         if (mimeType == null) {
             mimeType = "application/octet-stream";
         }
+
+        if (isPdfFileFromContentProviderWithoutExtension(localPath, mimeType)){
+            remotePath += FILE_EXTENSION_PDF;
+        }
+
+        OCFile newFile = new OCFile(remotePath);
+        newFile.setStoragePath(localPath);
+        newFile.setLastSyncDateForProperties(0);
+        newFile.setLastSyncDateForData(0);
+
+        // size
+        if (localPath != null && localPath.length() > 0) {
+            File localFile = new File(localPath);
+            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
+
+
         newFile.setMimetype(mimeType);
 
         return newFile;
@@ -856,4 +867,17 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         sendStickyBroadcast(end);
     }
 
+    /**
+     * Checks if content provider, using the content:// scheme, returns a file with mime-type 
+     * 'application/pdf' but file has not extension
+     * @param localPath
+     * @param mimeType
+     * @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) && 
+                !localPath.endsWith(FILE_EXTENSION_PDF);
+    }
+
 }

+ 73 - 47
src/com/owncloud/android/operations/UploadFileOperation.java

@@ -31,11 +31,16 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.commons.httpclient.methods.PutMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 
+import android.accounts.Account;
+import android.content.Context;
+import android.net.Uri;
+
+import com.owncloud.android.MainApp;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileUploader;
-import com.owncloud.android.lib.common.network.ProgressiveDataTransferer;
-import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
 import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
+import com.owncloud.android.lib.common.network.ProgressiveDataTransferer;
 import com.owncloud.android.lib.common.operations.OperationCancelledException;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -45,9 +50,7 @@ import com.owncloud.android.lib.resources.files.ChunkedUploadRemoteFileOperation
 import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 import com.owncloud.android.lib.resources.files.UploadRemoteFileOperation;
 import com.owncloud.android.utils.FileStorageUtils;
-
-import android.accounts.Account;
-import android.content.Context;
+import com.owncloud.android.utils.UriUtils;
 
 
 /**
@@ -92,10 +95,9 @@ public class UploadFileOperation extends RemoteOperation {
             throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation creation");
         if (file == null)
             throw new IllegalArgumentException("Illegal NULL file in UploadFileOperation creation");
-        if (file.getStoragePath() == null || file.getStoragePath().length() <= 0
-                || !(new File(file.getStoragePath()).exists())) {
+        if (file.getStoragePath() == null || file.getStoragePath().length() <= 0) {
             throw new IllegalArgumentException(
-                    "Illegal file in UploadFileOperation; storage path invalid or file not found: "
+                    "Illegal file in UploadFileOperation; storage path invalid: "
                             + file.getStoragePath());
         }
 
@@ -218,52 +220,77 @@ public class UploadFileOperation extends RemoteOperation {
                                    // copied
 
                 } else {
+
                     String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
                     mFile.setStoragePath(temporalPath);
                     temporalFile = new File(temporalPath);
-                    if (!mOriginalStoragePath.equals(temporalPath)) { // preventing
-                                                                      // weird
-                                                                      // but
-                                                                      // possible
-                                                                      // situation
-                        InputStream in = null;
-                        OutputStream out = null;
-                        try {
-                            File temporalParent = temporalFile.getParentFile();
-                            temporalParent.mkdirs();
-                            if (!temporalParent.isDirectory()) {
-                                throw new IOException("Unexpected error: parent directory could not be created");
-                            }
-                            temporalFile.createNewFile();
-                            if (!temporalFile.isFile()) {
-                                throw new IOException("Unexpected error: target file could not be created");
-                            }
-                            in = new FileInputStream(originalFile);
+
+                    File temporalParent = temporalFile.getParentFile();
+                    temporalParent.mkdirs();
+                    if (!temporalParent.isDirectory()) {
+                        throw new IOException("Unexpected error: parent directory could not be created");
+                    }
+                    temporalFile.createNewFile();
+                    if (!temporalFile.isFile()) {
+                        throw new IOException("Unexpected error: target file could not be created");
+                    }
+
+                    InputStream in = null;
+                    OutputStream out = null;
+
+                    try {
+
+                        // In case document provider schema as 'content://'
+                        if (mOriginalStoragePath.startsWith(UriUtils.URI_CONTENT_SCHEME)) {
+
+                            Uri uri = Uri.parse(mOriginalStoragePath);
+
+                            in = MainApp.getAppContext().getContentResolver().openInputStream(uri);
                             out = new FileOutputStream(temporalFile);
-                            byte[] buf = new byte[1024];
-                            int len;
-                            while ((len = in.read(buf)) > 0) {
-                                out.write(buf, 0, len);
-                            }
 
-                        } catch (Exception e) {
-                            result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED);
-                            return result;
-
-                        } finally {
-                            try {
-                                if (in != null)
-                                    in.close();
-                            } catch (Exception e) {
-                                Log_OC.d(TAG, "Weird exception while closing input stream for " + mOriginalStoragePath + " (ignoring)", e);
+                            int nRead;
+                            byte[] data = new byte[16384];
+
+                            while ((nRead = in.read(data, 0, data.length)) != -1) {
+                                out.write(data, 0, nRead);
                             }
-                            try {
-                                if (out != null)
-                                    out.close();
-                            } catch (Exception e) {
-                                Log_OC.d(TAG, "Weird exception while closing output stream for " + expectedPath + " (ignoring)", e);
+
+                            out.flush();
+
+                        } else {
+                            if (!mOriginalStoragePath.equals(temporalPath)) { // preventing
+                                                                          // weird
+                                                                          // but
+                                                                          // possible
+                                                                          // situation
+
+                                in = new FileInputStream(originalFile);
+                                out = new FileOutputStream(temporalFile);
+                                byte[] buf = new byte[1024];
+                                int len;
+                                while ((len = in.read(buf)) > 0) {
+                                    out.write(buf, 0, len);
+                                }
                             }
                         }
+
+                    } catch (Exception e) {
+                        result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED);
+                        return result;
+
+                    } finally {
+                        try {
+                            if (in != null)
+                                in.close();
+                        } catch (Exception 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);
+                        }
                     }
                 }
             }
@@ -417,5 +444,4 @@ public class UploadFileOperation extends RemoteOperation {
     public void cancel() {
         mUploadOperation.cancel();
     }
-
 }

+ 103 - 11
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -28,6 +28,7 @@ import android.app.ProgressDialog;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.ContentResolver;
+import android.content.ContentUris;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -38,13 +39,18 @@ import android.content.SyncRequest;
 import android.content.res.Resources.NotFoundException;
 import android.database.Cursor;
 import android.net.Uri;
+import android.os.Build;
 import android.os.Bundle;
+import android.os.Environment;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
+import android.provider.DocumentsContract;
 import android.provider.MediaStore;
+import android.provider.OpenableColumns;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
+import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
@@ -99,6 +105,7 @@ import com.owncloud.android.ui.preview.PreviewTextFragment;
 import com.owncloud.android.ui.preview.PreviewVideoActivity;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
+import com.owncloud.android.utils.UriUtils;
 
 import java.io.File;
 import java.io.IOException;
@@ -569,6 +576,11 @@ public class FileDisplayActivity extends HookActivity implements
             builder.setExpedited(true);
             builder.setManual(true);
             builder.syncOnce();
+
+            // Fix bug in Android Lollipop when you click on refresh the whole account
+            Bundle extras = new Bundle();
+            builder.setExtras(extras);
+
             SyncRequest request = builder.build();
             ContentResolver.requestSync(request);
         }
@@ -660,8 +672,12 @@ public class FileDisplayActivity extends HookActivity implements
 
     private void requestSimpleUpload(Intent data, int resultCode) {
         String filepath = null;
+        String mimeType = null;
+
+        Uri selectedImageUri = data.getData();
+
         try {
-            Uri selectedImageUri = data.getData();
+            mimeType = getContentResolver().getType(selectedImageUri);
 
             String filemanagerstring = selectedImageUri.getPath();
             String selectedImagePath = getPath(selectedImageUri);
@@ -693,10 +709,34 @@ public class FileDisplayActivity extends HookActivity implements
         }
         if (!remotepath.endsWith(OCFile.PATH_SEPARATOR))
             remotepath += OCFile.PATH_SEPARATOR;
-        remotepath += new File(filepath).getName();
+
+        if (filepath.startsWith(UriUtils.URI_CONTENT_SCHEME)) {
+
+            Cursor cursor = MainApp.getAppContext().getContentResolver()
+                    .query(Uri.parse(filepath), null, null, null, null, null);
+
+            try {
+                if (cursor != null && cursor.moveToFirst()) {
+                    String displayName = cursor.getString(
+                            cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
+                    Log.i(TAG, "Display Name: " + displayName + "; mimeType: " + mimeType);
+
+                    displayName.replace(File.separatorChar, '_');
+                    displayName.replace(File.pathSeparatorChar, '_');
+                    remotepath += displayName + DisplayUtils.getComposedFileExtension(filepath);
+
+                }
+            } finally {
+                cursor.close();
+            }
+
+        } else {
+            remotepath += new File(filepath).getName();
+        }
 
         i.putExtra(FileUploader.KEY_LOCAL_FILE, filepath);
         i.putExtra(FileUploader.KEY_REMOTE_FILE, remotepath);
+        i.putExtra(FileUploader.KEY_MIME_TYPE, mimeType);
         i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE);
         if (resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)
             i.putExtra(FileUploader.KEY_LOCAL_BEHAVIOUR, FileUploader.LOCAL_BEHAVIOUR_MOVE);
@@ -873,22 +913,74 @@ public class FileDisplayActivity extends HookActivity implements
         return dialog;
     }
 
-
     /**
      * Translates a content URI of an image to a physical path
      * on the disk
      *
      * @param uri The URI to resolve
-     * @return The path to the image or null if it could not be found
+     * @return The path to the content or null if it could not be found
      */
     public String getPath(Uri uri) {
-        String[] projection = {MediaStore.Images.Media.DATA};
-        Cursor cursor = managedQuery(uri, projection, null, null, null);
-        if (cursor != null) {
-            int column_index = cursor
-                    .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
-            cursor.moveToFirst();
-            return cursor.getString(column_index);
+        final boolean isKitKatOrLater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
+
+        // DocumentProvider
+        if (isKitKatOrLater && DocumentsContract.isDocumentUri(getApplicationContext(), uri)) {
+            // ExternalStorageProvider
+            if (UriUtils.isExternalStorageDocument(uri)) {
+                final String docId = DocumentsContract.getDocumentId(uri);
+                final String[] split = docId.split(":");
+                final String type = split[0];
+
+                if ("primary".equalsIgnoreCase(type)) {
+                    return Environment.getExternalStorageDirectory() + "/" + split[1];
+                }
+            }
+            // DownloadsProvider
+            else if (UriUtils.isDownloadsDocument(uri)) {
+
+                final String id = DocumentsContract.getDocumentId(uri);
+                final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"),
+                        Long.valueOf(id));
+
+                return UriUtils.getDataColumn(getApplicationContext(), contentUri, null, null);
+            }
+            // MediaProvider
+            else if (UriUtils.isMediaDocument(uri)) {
+                final String docId = DocumentsContract.getDocumentId(uri);
+                final String[] split = docId.split(":");
+                final String type = split[0];
+
+                Uri contentUri = null;
+                if ("image".equals(type)) {
+                    contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
+                } else if ("video".equals(type)) {
+                    contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
+                } else if ("audio".equals(type)) {
+                    contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
+                }
+
+                final String selection = "_id=?";
+                final String[] selectionArgs = new String[]{split[1]};
+
+                return UriUtils.getDataColumn(getApplicationContext(), contentUri, selection, selectionArgs);
+            }
+            // Documents providers returned as content://...
+            else if (UriUtils.isContentDocument(uri)) {
+                return uri.toString();
+            }
+        }
+        // MediaStore (and general)
+        else if ("content".equalsIgnoreCase(uri.getScheme())) {
+
+            // Return the remote address
+            if (UriUtils.isGooglePhotosUri(uri))
+                return uri.getLastPathSegment();
+
+            return UriUtils.getDataColumn(getApplicationContext(), uri, null, null);
+        }
+        // File
+        else if ("file".equalsIgnoreCase(uri.getScheme())) {
+            return uri.getPath();
         }
         return null;
     }

+ 4 - 40
src/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -34,9 +34,6 @@ import android.widget.TextView;
 
 import com.actionbarsherlock.app.ActionBar;
 import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
-import com.actionbarsherlock.internal.view.menu.ActionMenuItemView;
-import com.actionbarsherlock.view.Menu;
-import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -76,8 +73,6 @@ public class UploadFilesActivity extends FileActivity implements
     private static final String WAIT_DIALOG_TAG = "WAIT";
     private static final String QUERY_TO_MOVE_DIALOG_TAG = "QUERY_TO_MOVE";
     
-    private boolean selectAllToggled = false;
-    private Menu menu;
     
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -124,7 +119,6 @@ public class UploadFilesActivity extends FileActivity implements
         actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
         actionBar.setListNavigationCallbacks(mDirectories, this);
         
-        
         // wait dialog
         if (mCurrentDialog != null) {
             mCurrentDialog.dismiss();
@@ -133,15 +127,8 @@ public class UploadFilesActivity extends FileActivity implements
             
         Log_OC.d(TAG, "onCreate() end");
     }
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        // Inflate the menu items for use in the action bar
-        MenuInflater inflater = getSherlock().getMenuInflater();
-        inflater.inflate(R.menu.file_select_all, menu);     
-        this.menu = menu;
-        return true;
-    }
- 
+
+
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         boolean retval = true;
@@ -152,33 +139,12 @@ public class UploadFilesActivity extends FileActivity implements
                 }
                 break;
             }
-            case R.id.actionbar_select_all:{
-                if(selectAllToggled){
-                    toggleOffSelectAll();
-                }else{
-                    toggleOnSelectAll(item);
-                }
-                break;
-            }
             default:
                 retval = super.onOptionsItemSelected(item);
         }
         return retval;
     }
-    public void toggleOffSelectAll(MenuItem item){
-        selectAllToggled = false;
-        item.setIcon(android.R.drawable.checkbox_off_background);
-        mFileListFragment.deselectAll();
-    }
-    public void toggleOffSelectAll(){
-        MenuItem item = menu.findItem(R.id.actionbar_select_all);
-        toggleOffSelectAll(item);
-    }
-    public void toggleOnSelectAll(MenuItem item){
-        selectAllToggled = true;
-        item.setIcon(android.R.drawable.checkbox_on_background);        
-        mFileListFragment.selectAll();
-    }
+
     
     @Override
     public boolean onNavigationItemSelected(int itemPosition, long itemId) {
@@ -209,7 +175,6 @@ public class UploadFilesActivity extends FileActivity implements
             ActionBar actionBar = getSupportActionBar(); 
             actionBar.setDisplayHomeAsUpEnabled(false);
         } 
-        toggleOffSelectAll();
     }
 
     
@@ -277,11 +242,10 @@ public class UploadFilesActivity extends FileActivity implements
      * {@inheritDoc}
      */
     @Override
-    public void onDirectoryClick(File directory) { 
+    public void onDirectoryClick(File directory) {
         pushDirname(directory);
         ActionBar actionBar = getSupportActionBar();
         actionBar.setDisplayHomeAsUpEnabled(true);
-        toggleOffSelectAll();
     }
     
     

+ 1 - 1
src/com/owncloud/android/ui/activity/Uploader.java

@@ -170,7 +170,7 @@ public class Uploader extends SherlockListActivity implements OnItemClickListene
         case DIALOG_MULTIPLE_ACCOUNT:
             CharSequence ac[] = new CharSequence[mAccountManager.getAccountsByType(MainApp.getAccountType()).length];
             for (int i = 0; i < ac.length; ++i) {
-                ac[i] = mAccountManager.getAccountsByType(MainApp.getAccountType())[i].name;
+                ac[i] = DisplayUtils.convertIdn(mAccountManager.getAccountsByType(MainApp.getAccountType())[i].name, false);
             }
             builder.setTitle(R.string.common_choose_account);
             builder.setItems(ac, new OnClickListener() {

+ 1 - 21
src/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -98,33 +98,13 @@ public class LocalFileListFragment extends ExtendedListFragment {
         Log_OC.i(TAG, "onActivityCreated() stop");
     }
     
-    public void selectAll(){
-        int numberOfFiles = mAdapter.getCount();
-        for(int i = 0; i < numberOfFiles; i++){
-            File file = (File) mAdapter.getItem(i);
-            if (file != null) {                
-                if (!file.isDirectory()) {  
-                    /// Click on a file
-                    getListView().setItemChecked(i, true);                       
-                    // notify the change to the container Activity
-                    mContainerActivity.onFileClick(file);
-                }
-            }
-        }
-    }
-    
-    public void deselectAll(){        
-        mAdapter = new LocalFileListAdapter(mContainerActivity.getInitialDirectory(), getActivity());
-        setListAdapter(mAdapter);
-    }
     
     /**
      * Checks the file clicked over. Browses inside if it is a directory. Notifies the container activity in any case.
      */
     @Override
     public void onItemClick(AdapterView<?> l, View v, int position, long id) {
-        File file = (File) mAdapter.getItem(position);
-        
+        File file = (File) mAdapter.getItem(position); 
         if (file != null) {
             /// Click on a directory
             if (file.isDirectory()) {

+ 19 - 2
src/com/owncloud/android/utils/DisplayUtils.java

@@ -277,7 +277,24 @@ public class DisplayUtils {
             return url;
         }
     }
-    
+
+    /**
+     * Get the file extension if it is on path as type "content://.../DocInfo.doc"
+     * @param filepath: Content Uri converted to string format
+     * @return String: fileExtension (type '.pdf'). Empty if no extension
+     */
+    public static String getComposedFileExtension(String filepath) {
+        String fileExtension = "";
+        String fileNameInContentUri = filepath.substring(filepath.lastIndexOf("/"));
+
+        // Check if extension is included in uri
+        int pos = fileNameInContentUri.lastIndexOf('.');
+        if (pos >= 0) {
+            fileExtension = fileNameInContentUri.substring(pos);
+        }
+        return fileExtension;
+    }
+
     public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution, long transitionResolution, int flags){
         CharSequence dateString = "";
         
@@ -301,6 +318,6 @@ public class DisplayUtils {
             }
         }
         
-        return dateString.toString().split(",")[0];
+        return dateString.toString().split(",")[0];
     }
 }

+ 103 - 0
src/com/owncloud/android/utils/UriUtils.java

@@ -0,0 +1,103 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2014 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.utils;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+
+
+/**
+ * A helper class for some Uri operations.
+ */
+public class UriUtils {
+    
+    public static final String URI_CONTENT_SCHEME = "content://";
+    
+    
+    /**
+     * Get the value of the data column for this Uri. This is useful for
+     * MediaStore Uris, and other file-based ContentProviders.
+     * 
+     * @param context The context.
+     * @param uri The Uri to query.
+     * @param selection (Optional) Filter used in the query.
+     * @param selectionArgs (Optional) Selection arguments used in the query.
+     * @return The value of the _data column, which is typically a file path.
+     */
+    public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
+
+        Cursor cursor = null;
+        final String column = "_data";
+        final String[] projection = { column };
+
+        try {
+            cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
+            if (cursor != null && cursor.moveToFirst()) {
+
+                final int column_index = cursor.getColumnIndexOrThrow(column);
+                return cursor.getString(column_index);
+            }
+        } finally {
+            if (cursor != null)
+                cursor.close();
+        }
+        return null;
+    }
+
+    /**
+     * @param uri The Uri to check.
+     * @return Whether the Uri authority is ExternalStorageProvider.
+     */
+    public static boolean isExternalStorageDocument(Uri uri) {
+        return "com.android.externalstorage.documents".equals(uri.getAuthority());
+    }
+
+    /**
+     * @param uri The Uri to check.
+     * @return Whether the Uri authority is DownloadsProvider.
+     */
+    public static boolean isDownloadsDocument(Uri uri) {
+        return "com.android.providers.downloads.documents".equals(uri.getAuthority());
+    }
+
+    /**
+     * @param uri The Uri to check.
+     * @return Whether the Uri authority is MediaProvider.
+     */
+    public static boolean isMediaDocument(Uri uri) {
+        return "com.android.providers.media.documents".equals(uri.getAuthority());
+    }
+
+    /**
+     * @param uri The Uri to check.
+     * @return Whether the Uri authority is Google Photos.
+     */
+    public static boolean isGooglePhotosUri(Uri uri) {
+        return "com.google.android.apps.photos.content".equals(uri.getAuthority());
+    }
+
+    /**
+     * 
+     * @param uri The Uri to check.
+     * @return Whether the Uri is from a content provider as kind "content://..."
+     */
+    public static boolean isContentDocument(Uri uri) {
+        return uri.toString().startsWith(URI_CONTENT_SCHEME);
+    }
+}

+ 2 - 2
tests/.classpath

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/owncloud-android"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
 	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
 	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="output" path="bin/classes"/>
 </classpath>