Merge pull request #740 from owncloud/revert-669-master
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDisplayActivity.java
index ec2e9be..49259e9 100644 (file)
@@ -570,6 +570,11 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
             builder.setExpedited(true);
             builder.setManual(true);
             builder.syncOnce();
             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);
         }
             SyncRequest request = builder.build();
             ContentResolver.requestSync(request);
         }
@@ -710,6 +715,8 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                             cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
                     Log.i(TAG, "Display Name: " + displayName + "; mimeType: " + mimeType);
 
                             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);
 
                 }
                     remotepath += displayName + DisplayUtils.getComposedFileExtension(filepath);
 
                 }
@@ -906,10 +913,10 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
      * @return The path to the content or null if it could not be found
      */
     public String getPath(Uri uri) {
      * @return The path to the content or null if it could not be found
      */
     public String getPath(Uri uri) {
-        final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
+        final boolean isKitKatOrLater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
 
         // DocumentProvider
 
         // DocumentProvider
-        if (isKitKat && DocumentsContract.isDocumentUri(getApplicationContext(), uri)) {
+        if (isKitKatOrLater && DocumentsContract.isDocumentUri(getApplicationContext(), uri)) {
             // ExternalStorageProvider
             if (UriUtils.isExternalStorageDocument(uri)) {
                 final String docId = DocumentsContract.getDocumentId(uri);
             // ExternalStorageProvider
             if (UriUtils.isExternalStorageDocument(uri)) {
                 final String docId = DocumentsContract.getDocumentId(uri);