소스 검색

Merge remote-tracking branch 'remotes/origin/master' into userTheming

tobiasKaminsky 7 년 전
부모
커밋
5f5430dcf8
100개의 변경된 파일287개의 추가작업 그리고 194개의 파일을 삭제
  1. 1 1
      .drone.yml
  2. 0 0
      .drone.yml.sig
  3. 3 0
      CHANGELOG.md
  4. 0 1
      build.gradle
  5. 21 22
      drawable_resources/ic_list_empty_image.svg
  6. 25 26
      drawable_resources/ic_list_empty_video.svg
  7. 1 1
      scripts/lint/lint-results.txt
  8. 18 0
      scripts/lint/lint-up-wrapper.sh
  9. 2 2
      src/gplay/AndroidManifest.xml
  10. 2 3
      src/main/AndroidManifest.xml
  11. 4 1
      src/main/java/com/owncloud/android/authentication/AccountUtils.java
  12. 69 66
      src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java
  13. 4 3
      src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
  14. 7 7
      src/main/java/com/owncloud/android/files/InstantUploadBroadcastReceiver.java
  15. 2 1
      src/main/java/com/owncloud/android/files/services/IndexedForest.java
  16. 4 0
      src/main/java/com/owncloud/android/media/MediaControlView.java
  17. 0 1
      src/main/java/com/owncloud/android/media/MediaService.java
  18. 1 4
      src/main/java/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java
  19. 7 5
      src/main/java/com/owncloud/android/services/ContactsBackupJob.java
  20. 2 1
      src/main/java/com/owncloud/android/ui/CustomPopup.java
  21. 1 0
      src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
  22. 12 12
      src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
  23. 2 3
      src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java
  24. 2 2
      src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java
  25. 2 2
      src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java
  26. 37 1
      src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java
  27. 44 13
      src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java
  28. 14 16
      src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
  29. BIN
      src/main/res/drawable-hdpi/nav_activity.png
  30. 0 0
      src/main/res/drawable-hdpi/nav_all_files.png
  31. BIN
      src/main/res/drawable-hdpi/nav_contacts.png
  32. 0 0
      src/main/res/drawable-hdpi/nav_favorites.png
  33. 0 0
      src/main/res/drawable-hdpi/nav_folder_sync.png
  34. 0 0
      src/main/res/drawable-hdpi/nav_logout.png
  35. BIN
      src/main/res/drawable-hdpi/nav_notifications.png
  36. 0 0
      src/main/res/drawable-hdpi/nav_on_device.png
  37. 0 0
      src/main/res/drawable-hdpi/nav_participate.png
  38. BIN
      src/main/res/drawable-hdpi/nav_photos.png
  39. 0 0
      src/main/res/drawable-hdpi/nav_recently.png
  40. BIN
      src/main/res/drawable-hdpi/nav_settings.png
  41. 0 0
      src/main/res/drawable-hdpi/nav_shared.png
  42. 0 0
      src/main/res/drawable-hdpi/nav_uploads.png
  43. BIN
      src/main/res/drawable-hdpi/nav_videos.png
  44. BIN
      src/main/res/drawable-mdpi/nav_activity.png
  45. BIN
      src/main/res/drawable-mdpi/nav_all_files.png
  46. BIN
      src/main/res/drawable-mdpi/nav_contacts.png
  47. 0 0
      src/main/res/drawable-mdpi/nav_favorites.png
  48. 0 0
      src/main/res/drawable-mdpi/nav_folder_sync.png
  49. 0 0
      src/main/res/drawable-mdpi/nav_logout.png
  50. BIN
      src/main/res/drawable-mdpi/nav_notifications.png
  51. 0 0
      src/main/res/drawable-mdpi/nav_on_device.png
  52. 0 0
      src/main/res/drawable-mdpi/nav_participate.png
  53. BIN
      src/main/res/drawable-mdpi/nav_photos.png
  54. 0 0
      src/main/res/drawable-mdpi/nav_recently.png
  55. BIN
      src/main/res/drawable-mdpi/nav_settings.png
  56. 0 0
      src/main/res/drawable-mdpi/nav_shared.png
  57. 0 0
      src/main/res/drawable-mdpi/nav_uploads.png
  58. BIN
      src/main/res/drawable-mdpi/nav_videos.png
  59. BIN
      src/main/res/drawable-xhdpi/nav_activity.png
  60. 0 0
      src/main/res/drawable-xhdpi/nav_all_files.png
  61. BIN
      src/main/res/drawable-xhdpi/nav_contacts.png
  62. 0 0
      src/main/res/drawable-xhdpi/nav_favorites.png
  63. 0 0
      src/main/res/drawable-xhdpi/nav_folder_sync.png
  64. 0 0
      src/main/res/drawable-xhdpi/nav_logout.png
  65. BIN
      src/main/res/drawable-xhdpi/nav_notifications.png
  66. 0 0
      src/main/res/drawable-xhdpi/nav_on_device.png
  67. 0 0
      src/main/res/drawable-xhdpi/nav_participate.png
  68. BIN
      src/main/res/drawable-xhdpi/nav_photos.png
  69. 0 0
      src/main/res/drawable-xhdpi/nav_recently.png
  70. BIN
      src/main/res/drawable-xhdpi/nav_settings.png
  71. 0 0
      src/main/res/drawable-xhdpi/nav_shared.png
  72. 0 0
      src/main/res/drawable-xhdpi/nav_uploads.png
  73. BIN
      src/main/res/drawable-xhdpi/nav_videos.png
  74. BIN
      src/main/res/drawable-xxhdpi/nav_activity.png
  75. 0 0
      src/main/res/drawable-xxhdpi/nav_all_files.png
  76. BIN
      src/main/res/drawable-xxhdpi/nav_contacts.png
  77. 0 0
      src/main/res/drawable-xxhdpi/nav_favorites.png
  78. 0 0
      src/main/res/drawable-xxhdpi/nav_folder_sync.png
  79. 0 0
      src/main/res/drawable-xxhdpi/nav_logout.png
  80. BIN
      src/main/res/drawable-xxhdpi/nav_notifications.png
  81. 0 0
      src/main/res/drawable-xxhdpi/nav_on_device.png
  82. 0 0
      src/main/res/drawable-xxhdpi/nav_participate.png
  83. BIN
      src/main/res/drawable-xxhdpi/nav_photos.png
  84. 0 0
      src/main/res/drawable-xxhdpi/nav_recently.png
  85. BIN
      src/main/res/drawable-xxhdpi/nav_settings.png
  86. 0 0
      src/main/res/drawable-xxhdpi/nav_shared.png
  87. 0 0
      src/main/res/drawable-xxhdpi/nav_uploads.png
  88. BIN
      src/main/res/drawable-xxhdpi/nav_videos.png
  89. BIN
      src/main/res/drawable-xxxhdpi/nav_activity.png
  90. 0 0
      src/main/res/drawable-xxxhdpi/nav_favorites.png
  91. 0 0
      src/main/res/drawable-xxxhdpi/nav_folder_sync.png
  92. 0 0
      src/main/res/drawable-xxxhdpi/nav_logout.png
  93. BIN
      src/main/res/drawable-xxxhdpi/nav_notifications.png
  94. 0 0
      src/main/res/drawable-xxxhdpi/nav_on_device.png
  95. 0 0
      src/main/res/drawable-xxxhdpi/nav_participate.png
  96. BIN
      src/main/res/drawable-xxxhdpi/nav_photos.png
  97. 0 0
      src/main/res/drawable-xxxhdpi/nav_recently.png
  98. BIN
      src/main/res/drawable-xxxhdpi/nav_settings.png
  99. 0 0
      src/main/res/drawable-xxxhdpi/nav_shared.png
  100. 0 0
      src/main/res/drawable-xxxhdpi/nav_uploads.png

+ 1 - 1
.drone.yml

@@ -34,7 +34,7 @@ pipeline:
         # needs gplay
         - sed -i '/com.google.*.gms/s/^.*\/\///g' build.gradle
         - export BRANCH=$(scripts/lint/getBranchName.sh ${GIT_USERNAME} ${GIT_TOKEN} ${DRONE_PULL_REQUEST})
-        - ruby scripts/lint/lint-up.rb ${GIT_USERNAME} ${GIT_TOKEN} $BRANCH
+        - scripts/lint/lint-up-wrapper.sh ${GIT_USERNAME} ${GIT_TOKEN} $BRANCH ${LOG_USERNAME} ${LOG_PASSWORD} ${DRONE_BUILD_NUMBER}
       when:
         matrix:
           FLAVOUR: Modified

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
.drone.yml.sig


+ 3 - 0
CHANGELOG.md

@@ -1,3 +1,6 @@
+## 1.4.3 (May 22, 2017)
+- Hotfix: ignore oauth header for now and use basic auth to allow new logins for nc12
+
 ## 1.4.2 (March 14, 2017)
 - Auto Upload for newly taken photos/images (Android 6+)
 - Auto Upload improvements and fixes

+ 0 - 1
build.gradle

@@ -52,7 +52,6 @@ repositories {
 android {
     lintOptions {
         abortOnError false
-        lintConfig file("${project.rootDir}/lint.xml")
         htmlReport true
         htmlOutput file("$project.buildDir/reports/lint/lint.html")
         disable 'MissingTranslation'

+ 21 - 22
drawable_resources/ic_list_empty_image.svg

@@ -1,21 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   height="16"
-   width="16"
-   version="1"
-   id="svg4"
-   sodipodi:docname="ic_list_empty_image.svg"
-   inkscape:version="0.92.1 r15371"
-   inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_image.png"
-   inkscape:export-xdpi="432"
-   inkscape:export-ydpi="432">
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:cc="http://creativecommons.org/ns#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns="http://www.w3.org/2000/svg"
+    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+    height="16"
+    width="16"
+    version="1"
+    id="svg4"
+    sodipodi:docname="ic_list_empty_image.svg"
+    inkscape:version="0.91 r13725"
+    inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_image.png"
+    inkscape:export-xdpi="432"
+    inkscape:export-ydpi="432">
   <metadata
      id="metadata10">
     <rdf:RDF>
@@ -38,19 +37,19 @@
      guidetolerance="10"
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
-     inkscape:window-width="1920"
-     inkscape:window-height="1005"
+     inkscape:window-width="1600"
+     inkscape:window-height="835"
      id="namedview6"
      showgrid="false"
      inkscape:zoom="14.75"
-     inkscape:cx="8"
+     inkscape:cx="17.694915"
      inkscape:cy="8"
-     inkscape:window-x="-9"
-     inkscape:window-y="-9"
+     inkscape:window-x="1600"
+     inkscape:window-y="0"
      inkscape:window-maximized="1"
      inkscape:current-layer="svg4" />
   <path
-     style="block-progression:tb;text-transform:none;text-indent:0;fill:#000000;fill-opacity:1;opacity:0.5"
+     style="block-progression:tb;text-transform:none;text-indent:0;fill:#757575;fill-opacity:1;opacity:1"
      d="M1.344 2A.445.445 0 0 0 1 2.438v11.124c0 .23.212.44.438.44h13.125a.457.457 0 0 0 .437-.44V2.61c0-.337-.264-.61-.515-.61zM2 3h12v5l-1-1-3 4-3-3-4 4H2zm2.5 1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"
      fill="#969696"
      color="#000"

+ 25 - 26
drawable_resources/ic_list_empty_video.svg

@@ -1,21 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   height="16"
-   width="16"
-   version="1"
-   id="svg4"
-   sodipodi:docname="ic_list_empty_video.svg"
-   inkscape:version="0.92.1 r15371"
-   inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_video.png"
-   inkscape:export-xdpi="432"
-   inkscape:export-ydpi="432">
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:cc="http://creativecommons.org/ns#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns="http://www.w3.org/2000/svg"
+    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+    height="16"
+    width="16"
+    version="1"
+    id="svg4"
+    sodipodi:docname="ic_list_empty_video.svg"
+    inkscape:version="0.91 r13725"
+    inkscape:export-filename="C:\DEV\src\Android\Nextcloud\favourites\src\main\res\drawable-mdpi\ic_list_empty_video.png"
+    inkscape:export-xdpi="432"
+    inkscape:export-ydpi="432">
   <metadata
      id="metadata10">
     <rdf:RDF>
@@ -38,21 +37,21 @@
      guidetolerance="10"
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
-     inkscape:window-width="1920"
-     inkscape:window-height="1005"
+     inkscape:window-width="1600"
+     inkscape:window-height="835"
      id="namedview6"
      showgrid="false"
-     inkscape:zoom="14.75"
-     inkscape:cx="8"
-     inkscape:cy="8"
-     inkscape:window-x="-9"
-     inkscape:window-y="-9"
+     inkscape:zoom="20.85965"
+     inkscape:cx="-15.290906"
+     inkscape:cy="9.1100694"
+     inkscape:window-x="1600"
+     inkscape:window-y="0"
      inkscape:window-maximized="1"
      inkscape:current-layer="svg4" />
   <path
-     style="block-progression:tb;text-transform:none;text-indent:0;fill:#000000;fill-opacity:1;opacity:0.5"
+     style="block-progression:tb;text-transform:none;text-indent:0;fill:#757575;fill-opacity:1;opacity:1"
      d="M1.344 2A.445.445 0 0 0 1 2.438v11.124c0 .23.212.44.438.44h13.124a.457.457 0 0 0 .438-.44V2.61c0-.336-.265-.61-.516-.61zM2 3h12v10H2zm3 2v6l6-3z"
+     id="path2"
      fill="#969696"
-     color="#000"
-     id="path2" />
+     color="#000" />
 </svg>

+ 1 - 1
scripts/lint/lint-results.txt

@@ -1,2 +1,2 @@
 DO NOT TOUCH; GENERATED BY DRONE
-      <span class="mdl-layout-title">Lint Report: 75 errors and 852 warnings</span>
+      <span class="mdl-layout-title">Lint Report: 74 errors and 848 warnings</span>

+ 18 - 0
scripts/lint/lint-up-wrapper.sh

@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#1: GIT_USERNAME
+#2: GIT_TOKEN
+#3: BRANCH
+#4: LOG_USERNAME
+#5: LOG_PASSWORD
+#6: DRONE_BUILD_NUMBER
+
+ruby scripts/lint/lint-up.rb $1 $2 $3
+
+if [ $? -eq 0 ]; then
+    echo "New master at: https://nextcloud.kaminsky.me/index.php/s/tXwtChzyqMj6I8v"
+    curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/master.html --upload-file build/reports/lint/lint.html
+else
+    echo "New results at https://nextcloud.kaminsky.me/index.php/s/tXwtChzyqMj6I8v ->" $6.html
+    curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/$6.html --upload-file build/reports/lint/lint.html
+fi

+ 2 - 2
src/gplay/AndroidManifest.xml

@@ -19,8 +19,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:tools="http://schemas.android.com/tools"
           package="com.owncloud.android"
-          android:versionCode="10040299"
-          android:versionName="1.4.2">
+          android:versionCode="10040399"
+          android:versionName="1.4.3">
 
     <application
         android:name=".MainApp"

+ 2 - 3
src/main/AndroidManifest.xml

@@ -19,10 +19,9 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          xmlns:tools="http://schemas.android.com/tools"
           package="com.owncloud.android"
-          android:versionCode="10040299"
-          android:versionName="1.4.2">
+          android:versionCode="10040399"
+          android:versionName="1.4.3">
 
     <uses-sdk
         android:minSdkVersion="14"

+ 4 - 1
src/main/java/com/owncloud/android/authentication/AccountUtils.java

@@ -225,7 +225,10 @@ public class AccountUtils {
             if (currentAccountVersion == null) {
                 Log_OC.i(TAG, "Upgrading accounts to account version #" + ACCOUNT_VERSION);
                 Account[] ocAccounts = accountMgr.getAccountsByType(MainApp.getAccountType());
-                String serverUrl, username, newAccountName, password;
+                String serverUrl;
+                String username;
+                String newAccountName;
+                String password;
                 Account newAccount;
                 for (Account account : ocAccounts) {
                     // build new account name

+ 69 - 66
src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -279,49 +279,18 @@ public class FileDataStorageManager {
         Log_OC.d(TAG,  "Saving folder " + folder.getRemotePath() + " with " + updatedFiles.size()
                 + " children and " + filesToRemove.size() + " files to remove");
 
-        ArrayList<ContentProviderOperation> operations =
-                new ArrayList<ContentProviderOperation>(updatedFiles.size());
+        ArrayList<ContentProviderOperation> operations = new ArrayList<>(updatedFiles.size());
 
         // prepare operations to insert or update files to save in the given folder
         for (OCFile file : updatedFiles) {
-            ContentValues cv = new ContentValues();
-            cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
-            cv.put(
-                    ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
-                    file.getModificationTimestampAtLastSyncForData()
-            );
-            cv.put(ProviderTableMeta.FILE_CREATION, file.getCreationTimestamp());
-            cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, file.getFileLength());
-            cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, file.getMimetype());
-            cv.put(ProviderTableMeta.FILE_NAME, file.getFileName());
-            //cv.put(ProviderTableMeta.FILE_PARENT, file.getParentId());
-            cv.put(ProviderTableMeta.FILE_PARENT, folder.getFileId());
-            cv.put(ProviderTableMeta.FILE_PATH, file.getRemotePath());
-            if (!file.isFolder()) {
-                cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
-            }
-            cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
-            cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
-            cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
-            cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
-            cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
-            cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
-            cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
-            cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
-            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());
-            cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
-            cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
+            ContentValues cv = createContentValueForFile(file, folder);
 
             boolean existsByPath = fileExists(file.getRemotePath());
             if (existsByPath || fileExists(file.getFileId())) {
                 // updating an existing file
-                operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
-                        withValues(cv).
-                        withSelection(ProviderTableMeta._ID + "=?",
-                                new String[]{String.valueOf(file.getFileId())})
+                operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI)
+                        .withValues(cv)
+                        .withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(file.getFileId())})
                         .build());
 
             } else {
@@ -332,17 +301,14 @@ public class FileDataStorageManager {
         }
 
         // prepare operations to remove files in the given folder
-        String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
-                ProviderTableMeta.FILE_PATH + "=?";
+        String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
         String [] whereArgs = null;
         for (OCFile file : filesToRemove) {
             if (file.getParentId() == folder.getFileId()) {
                 whereArgs = new String[]{mAccount.name, file.getRemotePath()};
                 if (file.isFolder()) {
                     operations.add(ContentProviderOperation.newDelete(
-                            ContentUris.withAppendedId(
-                                    ProviderTableMeta.CONTENT_URI_DIR, file.getFileId()
-                            )
+                            ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_DIR, file.getFileId())
                     ).withSelection(where, whereArgs).build());
 
                     File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
@@ -351,8 +317,7 @@ public class FileDataStorageManager {
                     }
                 } else {
                     operations.add(ContentProviderOperation.newDelete(
-                            ContentUris.withAppendedId(
-                                    ProviderTableMeta.CONTENT_URI_FILE, file.getFileId()
+                            ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, file.getFileId()
                             )
                     ).withSelection(where, whereArgs).build());
 
@@ -366,29 +331,7 @@ public class FileDataStorageManager {
         }
 
         // update metadata of folder
-        ContentValues cv = new ContentValues();
-        cv.put(ProviderTableMeta.FILE_MODIFIED, folder.getModificationTimestamp());
-        cv.put(
-                ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
-                folder.getModificationTimestampAtLastSyncForData()
-        );
-        cv.put(ProviderTableMeta.FILE_CREATION, folder.getCreationTimestamp());
-        cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, 0);
-        cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, folder.getMimetype());
-        cv.put(ProviderTableMeta.FILE_NAME, folder.getFileName());
-        cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
-        cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
-        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
-        cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, folder.getLastSyncDateForProperties());
-        cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, folder.getLastSyncDateForData());
-        cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, folder.isAvailableOffline() ? 1 : 0);
-        cv.put(ProviderTableMeta.FILE_ETAG, folder.getEtag());
-        cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, folder.isSharedViaLink() ? 1 : 0);
-        cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, folder.isSharedWithSharee() ? 1 : 0);
-        cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, folder.getPublicLink());
-        cv.put(ProviderTableMeta.FILE_PERMISSIONS, folder.getPermissions());
-        cv.put(ProviderTableMeta.FILE_REMOTE_ID, folder.getRemoteId());
-        cv.put(ProviderTableMeta.FILE_FAVORITE, folder.getIsFavorite());
+        ContentValues cv = createContentValueForFile(folder);
 
         operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
                 withValues(cv).
@@ -431,7 +374,67 @@ public class FileDataStorageManager {
                 }
             }
         }
+    }
 
+    private ContentValues createContentValueForFile(OCFile folder) {
+        ContentValues cv = new ContentValues();
+        cv.put(ProviderTableMeta.FILE_MODIFIED, folder.getModificationTimestamp());
+        cv.put(
+                ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
+                folder.getModificationTimestampAtLastSyncForData()
+        );
+        cv.put(ProviderTableMeta.FILE_CREATION, folder.getCreationTimestamp());
+        cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, 0);
+        cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, folder.getMimetype());
+        cv.put(ProviderTableMeta.FILE_NAME, folder.getFileName());
+        cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
+        cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
+        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
+        cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, folder.getLastSyncDateForProperties());
+        cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, folder.getLastSyncDateForData());
+        cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, folder.isAvailableOffline() ? 1 : 0);
+        cv.put(ProviderTableMeta.FILE_ETAG, folder.getEtag());
+        cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, folder.isSharedViaLink() ? 1 : 0);
+        cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, folder.isSharedWithSharee() ? 1 : 0);
+        cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, folder.getPublicLink());
+        cv.put(ProviderTableMeta.FILE_PERMISSIONS, folder.getPermissions());
+        cv.put(ProviderTableMeta.FILE_REMOTE_ID, folder.getRemoteId());
+        cv.put(ProviderTableMeta.FILE_FAVORITE, folder.getIsFavorite());
+        return cv;
+    }
+
+    private ContentValues createContentValueForFile(OCFile file, OCFile folder) {
+        ContentValues cv = new ContentValues();
+        cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
+        cv.put(
+                ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,
+                file.getModificationTimestampAtLastSyncForData()
+        );
+        cv.put(ProviderTableMeta.FILE_CREATION, file.getCreationTimestamp());
+        cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, file.getFileLength());
+        cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, file.getMimetype());
+        cv.put(ProviderTableMeta.FILE_NAME, file.getFileName());
+        //cv.put(ProviderTableMeta.FILE_PARENT, file.getParentId());
+        cv.put(ProviderTableMeta.FILE_PARENT, folder.getFileId());
+        cv.put(ProviderTableMeta.FILE_PATH, file.getRemotePath());
+        if (!file.isFolder()) {
+            cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
+        }
+        cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
+        cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
+        cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
+        cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
+        cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
+        cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
+        cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
+        cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
+        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());
+        cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
+        cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
+        return cv;
     }
 
 

+ 4 - 3
src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

@@ -425,12 +425,13 @@ public class ThumbnailsCacheManager {
                         thumbnail = doFileInBackground(mFile);
                     }
                 }
+            } // the app should never break due to a problem with thumbnails
+            catch (OutOfMemoryError t) {
+                Log_OC.e(TAG, "Generation of thumbnail for " + mFile.getAbsolutePath() + " failed", t);
+                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.getAbsolutePath() + " failed", t);
-                if (t instanceof OutOfMemoryError) {
-                    System.gc();
-                }
             }
 
             return thumbnail;

+ 7 - 7
src/main/java/com/owncloud/android/files/InstantUploadBroadcastReceiver.java

@@ -56,6 +56,13 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
     // http://developer.android.com/reference/android/hardware/Camera.html#ACTION_NEW_VIDEO
     private static final String NEW_VIDEO_ACTION = "android.hardware.action.NEW_VIDEO";
 
+    /**
+     * Because we support NEW_PHOTO_ACTION and NEW_PHOTO_ACTION_UNOFFICIAL it can happen that
+     * handleNewPictureAction is called twice for the same photo. Use this simple static variable to
+     * remember last uploaded photo to filter duplicates. Must not be null!
+     */
+    static String lastUploadedPhotoPath = "";
+
     @Override
     public void onReceive(Context context, Intent intent) {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
@@ -75,13 +82,6 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
         }
     }
 
-    /**
-     * Because we support NEW_PHOTO_ACTION and NEW_PHOTO_ACTION_UNOFFICIAL it can happen that
-     * handleNewPictureAction is called twice for the same photo. Use this simple static variable to
-     * remember last uploaded photo to filter duplicates. Must not be null!
-     */
-    static String lastUploadedPhotoPath = "";
-
     private void handleNewPictureAction(Context context, Intent intent) {
         Cursor c = null;
         String file_path = null;

+ 2 - 1
src/main/java/com/owncloud/android/files/services/IndexedForest.java

@@ -115,7 +115,8 @@ public class IndexedForest<V> {
             String currentPath = remotePath;
             String parentPath = null;
             String parentKey = null;
-            Node<V> currentNode = valuedNode, parentNode = null;
+            Node<V> currentNode = valuedNode;
+            Node<V> parentNode = null;
             boolean linked = false;
             while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) {
                 parentPath = new File(currentPath).getParent();

+ 4 - 0
src/main/java/com/owncloud/android/media/MediaControlView.java

@@ -197,6 +197,10 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         updatePausePlay();
     }
 
+    public void stopMediaPlayerMessages() {
+        mHandler.removeMessages(SHOW_PROGRESS);
+    }
+
 
     private void initControllerView(View v) {
         mPauseButton = (ImageButton) v.findViewById(R.id.playBtn);

+ 0 - 1
src/main/java/com/owncloud/android/media/MediaService.java

@@ -508,7 +508,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             // nobody is bound
             processStopRequest(true);
         }
-        return;
     }
 
 

+ 1 - 4
src/main/java/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java

@@ -98,11 +98,8 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
         // analyze response  
         if (result.getHttpCode() == HttpStatus.SC_UNAUTHORIZED) {
             String authRequest = ((result.getAuthenticateHeader()).trim()).toLowerCase();
-            if (authRequest.startsWith("basic")) {
+            if (authRequest.startsWith("basic") || authRequest.startsWith("bearer")) {
                 authMethod = AuthenticationMethod.BASIC_HTTP_AUTH;
-                
-            } else if (authRequest.startsWith("bearer")) {
-                authMethod = AuthenticationMethod.BEARER_TOKEN;
             }
             // else - fall back to UNKNOWN
                     

+ 7 - 5
src/main/java/com/owncloud/android/services/ContactsBackupJob.java

@@ -1,20 +1,20 @@
-/**
+/*
  * Nextcloud Android client application
  *
  * @author Tobias Kaminsky
  * Copyright (C) 2017 Tobias Kaminsky
  * Copyright (C) 2017 Nextcloud GmbH.
- * <p>
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * at your option) any later version.
- * <p>
+ *
  * 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 Affero General Public License for more details.
- * <p>
+ *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -173,7 +173,9 @@ public class ContactsBackupJob extends Job {
             cal.add(Calendar.DAY_OF_YEAR, -daysToExpire);
             Long timestampToExpire = cal.getTimeInMillis();
 
-            Log_OC.d(TAG, "expire: " + daysToExpire + " " + backupFolder.getFileName());
+            if (backupFolder != null) {
+                Log_OC.d(TAG, "expire: " + daysToExpire + " " + backupFolder.getFileName());
+            }
 
             Vector<OCFile> backups = storageManager.getFolderContent(backupFolder, false);
 

+ 2 - 1
src/main/java/com/owncloud/android/ui/CustomPopup.java

@@ -136,7 +136,8 @@ public class CustomPopup {
                 LayoutParams.WRAP_CONTENT));
         root.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
 
-        int rootW = root.getWidth(), rootH = root.getHeight();
+        int rootW = root.getWidth();
+        int rootH = root.getHeight();
         int screenW = mWManager.getDefaultDisplay().getWidth();
 
         int xpos = ((screenW - rootW) / 2) + x;

+ 1 - 0
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -509,6 +509,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
             case Menu.NONE:
                 // account clicked
                 accountClicked(menuItem.getTitle().toString());
+                break;
             default:
                 Log_OC.i(TAG, "Unknown drawer menu item clicked: " + menuItem.getTitle());
         }

+ 12 - 12
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -316,7 +316,7 @@ public class FileDisplayActivity extends HookActivity
                             dialog.dismiss();
                         }
                     })
-                    .setIcon(R.drawable.ic_cloud_upload)
+                    .setIcon(R.drawable.nav_folder_sync)
                     .show();
         }
     }
@@ -431,7 +431,12 @@ public class FileDisplayActivity extends HookActivity
 
             /// Second fragment
             OCFile file = getFile();
-            Fragment secondFragment = chooseInitialSecondFragment(file);
+
+            Fragment secondFragment = getSecondFragment();
+            if (secondFragment == null) {
+                secondFragment = chooseInitialSecondFragment(file);
+            }
+
             if (secondFragment != null) {
                 setSecondFragment(secondFragment);
                 updateFragmentsVisibility(true);
@@ -470,13 +475,9 @@ public class FileDisplayActivity extends HookActivity
         Fragment secondFragment = null;
         if (file != null && !file.isFolder()) {
             if (file.isDown() && PreviewMediaFragment.canBePreviewed(file)) {
-                int startPlaybackPosition =
-                        getIntent().getIntExtra(PreviewVideoActivity.EXTRA_START_POSITION, 0);
-                boolean autoplay =
-                        getIntent().getBooleanExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, true);
-                secondFragment = new PreviewMediaFragment(file, getAccount(),
-                        startPlaybackPosition, autoplay);
-
+                int startPlaybackPosition = getIntent().getIntExtra(PreviewVideoActivity.EXTRA_START_POSITION, 0);
+                boolean autoplay = getIntent().getBooleanExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, true);
+                secondFragment = new PreviewMediaFragment(file, getAccount(), startPlaybackPosition, autoplay);
             } else if (file.isDown() && PreviewTextFragment.canBePreviewed(file)) {
                 secondFragment = null;
             } else {
@@ -550,8 +551,7 @@ public class FileDisplayActivity extends HookActivity
     }
 
     public FileFragment getSecondFragment() {
-        Fragment second = getSupportFragmentManager().findFragmentByTag(
-                FileDisplayActivity.TAG_SECOND_FRAGMENT);
+        Fragment second = getSupportFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_SECOND_FRAGMENT);
         if (second != null) {
             return (FileFragment) second;
         }
@@ -757,7 +757,7 @@ public class FileDisplayActivity extends HookActivity
                             R.drawable.ic_view_list));
                     getListOfFilesFragment().setGridAsPreferred();
                 }
-                return true;
+                break;
             }
             default:
                 retval = super.onOptionsItemSelected(item);

+ 2 - 3
src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java

@@ -49,6 +49,8 @@ public class CreateFolderDialogFragment
     
     public static final String CREATE_FOLDER_FRAGMENT = "CREATE_FOLDER_FRAGMENT";
 
+    private OCFile mParentFolder;
+
     /**
      * Public factory method to create new CreateFolderDialogFragment instances.
      *
@@ -63,9 +65,6 @@ public class CreateFolderDialogFragment
         return frag;
         
     }
-
-    private OCFile mParentFolder;
-    
     
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java

@@ -54,6 +54,8 @@ public class RenameFileDialogFragment
 
     private static final String ARG_TARGET_FILE = "TARGET_FILE";
 
+    private OCFile mTargetFile;
+
     /**
      * Public factory method to create new RenameFileDialogFragment instances.
      * 
@@ -69,8 +71,6 @@ public class RenameFileDialogFragment
         
     }
 
-    private OCFile mTargetFile;
-    
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
         mTargetFile = getArguments().getParcelable(ARG_TARGET_FILE);

+ 2 - 2
src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -287,8 +287,8 @@ public class ExtendedListFragment extends Fragment
     }
 
     public boolean onQueryTextChange(final String query) {
-        if (getFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_SECOND_FRAGMENT)
-                instanceof ExtendedListFragment){
+        if (getFragmentManager() != null && getFragmentManager().
+                findFragmentByTag(FileDisplayActivity.TAG_SECOND_FRAGMENT) instanceof ExtendedListFragment) {
             performSearch(query, false);
             return true;
         } else {

+ 37 - 1
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java

@@ -23,9 +23,11 @@ package com.owncloud.android.ui.fragment.contactsbackup;
 
 import android.Manifest;
 import android.accounts.Account;
+import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
@@ -53,6 +55,7 @@ import android.widget.LinearLayout;
 import com.evernote.android.job.JobRequest;
 import com.evernote.android.job.util.support.PersistableBundleCompat;
 import com.owncloud.android.R;
+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.utils.Log_OC;
@@ -104,6 +107,7 @@ public class ContactListFragment extends FileFragment {
     public Button restoreContacts;
 
     private ContactListAdapter contactListAdapter;
+    private Account account;
 
     public static ContactListFragment newInstance(OCFile file, Account account) {
         ContactListFragment frag = new ContactListFragment();
@@ -142,13 +146,19 @@ public class ContactListFragment extends FileFragment {
         try {
             OCFile ocFile = getArguments().getParcelable(FILE_NAME);
             setFile(ocFile);
-            Account account = getArguments().getParcelable(ACCOUNT);
+            account = getArguments().getParcelable(ACCOUNT);
 
             if (!ocFile.isDown()) {
                 Intent i = new Intent(getContext(), FileDownloader.class);
                 i.putExtra(FileDownloader.EXTRA_ACCOUNT, account);
                 i.putExtra(FileDownloader.EXTRA_FILE, ocFile);
                 getContext().startService(i);
+
+                // Listen for download messages
+                IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage());
+                downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage());
+                DownloadFinishReceiver mDownloadFinishReceiver = new DownloadFinishReceiver();
+                getContext().registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
             } else {
                 File file = new File(ocFile.getStoragePath());
                 vCards.addAll(Ezvcard.parse(file).all());
@@ -446,6 +456,27 @@ public class ContactListFragment extends FileFragment {
             return displayName;
         }
     }
+
+    private class DownloadFinishReceiver extends BroadcastReceiver {
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (intent.getAction().equalsIgnoreCase(FileDownloader.getDownloadFinishMessage())){
+                String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
+
+                FileDataStorageManager storageManager = new FileDataStorageManager(account,
+                        getContext().getContentResolver());
+                OCFile ocFile = storageManager.getFileByPath(downloadedRemotePath);
+                File file = new File(ocFile.getStoragePath());
+
+                try {
+                    contactListAdapter.replaceVCards(Ezvcard.parse(file).all());
+                } catch (IOException e) {
+                    Log_OC.e(TAG, "IO Exception: " + file.getAbsolutePath());
+                }
+            }
+        }
+    }
 }
 
 class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.ContactItemViewHolder> {
@@ -475,6 +506,11 @@ class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.Contac
         }
     }
 
+    public void replaceVCards(List<VCard> vCards) {
+        this.vCards = vCards;
+        notifyDataSetChanged();
+    }
+
     public int[] getCheckedIntArray() {
         int[] intArray;
         if (checkedVCards != null && checkedVCards.size() > 0) {

+ 44 - 13
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java

@@ -1,4 +1,4 @@
-/**
+/*
  * Nextcloud Android client application
  *
  * @author Mario Danic
@@ -24,6 +24,7 @@ import android.Manifest;
 import android.accounts.Account;
 import android.app.DatePickerDialog;
 import android.content.DialogInterface;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
@@ -44,7 +45,10 @@ import com.evernote.android.job.JobRequest;
 import com.evernote.android.job.util.support.PersistableBundleCompat;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.ArbitraryDataProvider;
+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.RefreshFolderOperation;
 import com.owncloud.android.services.ContactsBackupJob;
 import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
 import com.owncloud.android.ui.fragment.FileFragment;
@@ -167,21 +171,48 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
             }
         }
 
-        final ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
+        ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
 
-        String backupFolderString = getResources().getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR;
-        OCFile backupFolder = contactsPreferenceActivity.getStorageManager().getFileByPath(backupFolderString);
+        String backupFolderPath = getResources().getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR;
+        refreshBackupFolder(backupFolderPath, contactsPreferenceActivity);
+    }
 
-        Vector<OCFile> backupFiles = contactsPreferenceActivity.getStorageManager().getFolderContent(backupFolder,
-                false);
+    private void refreshBackupFolder(final String backupFolderPath,
+                                     final ContactsPreferenceActivity contactsPreferenceActivity) {
+        AsyncTask<String, Integer, Boolean> task = new AsyncTask<String, Integer, Boolean>() {
+            @Override
+            protected Boolean doInBackground(String... path) {
+                FileDataStorageManager storageManager = new FileDataStorageManager(account,
+                        getActivity().getContentResolver());
 
-        if (backupFiles == null || backupFiles.size() == 0) {
-            contactsRestoreHeader.setVisibility(View.GONE);
-            contactsDatePickerBtn.setVisibility(View.GONE);
-        } else {
-            contactsRestoreHeader.setVisibility(View.VISIBLE);
-            contactsDatePickerBtn.setVisibility(View.VISIBLE);
-        }
+                OCFile folder = storageManager.getFileByPath(path[0]);
+                RefreshFolderOperation operation = new RefreshFolderOperation(folder, System.currentTimeMillis(),
+                        false, false, false, storageManager, account, getContext());
+
+                RemoteOperationResult result = operation.execute(account, getContext());
+                return result.isSuccess();
+            }
+
+            @Override
+            protected void onPostExecute(Boolean result) {
+                if (result) {
+                    OCFile backupFolder = contactsPreferenceActivity.getStorageManager().getFileByPath(backupFolderPath);
+
+                    Vector<OCFile> backupFiles = contactsPreferenceActivity.getStorageManager()
+                            .getFolderContent(backupFolder, false);
+
+                    if (backupFiles == null || backupFiles.size() == 0) {
+                        contactsRestoreHeader.setVisibility(View.GONE);
+                        contactsDatePickerBtn.setVisibility(View.GONE);
+                    } else {
+                        contactsRestoreHeader.setVisibility(View.VISIBLE);
+                        contactsDatePickerBtn.setVisibility(View.VISIBLE);
+                    }
+                }
+            }
+        };
+
+        task.execute(backupFolderPath);
     }
 
 

+ 14 - 16
src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java

@@ -106,6 +106,7 @@ public class PreviewMediaFragment extends FileFragment implements
     private MediaServiceConnection mMediaServiceConnection = null;
     private VideoHelper mVideoHelper;
     private boolean mAutoplay;
+    private static boolean mOnResume = false;
     public boolean mPrepared;
 
     private static final String TAG = PreviewMediaFragment.class.getSimpleName();
@@ -220,6 +221,7 @@ public class PreviewMediaFragment extends FileFragment implements
      */
     @Override
     public void onActivityCreated(Bundle savedInstanceState) {
+        mOnResume = true;
         super.onActivityCreated(savedInstanceState);
         Log_OC.v(TAG, "onActivityCreated");
 
@@ -234,14 +236,11 @@ public class PreviewMediaFragment extends FileFragment implements
             if (!file.isDown()) {
                 throw new IllegalStateException("There is no local file to preview");
             }
-
-        }
-        else {
-            file = (OCFile) savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE);
+        } else {
+            file = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE);
             setFile(file);
             mAccount = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_ACCOUNT);
-            mSavedPlaybackPosition =
-                    savedInstanceState.getInt(PreviewMediaFragment.EXTRA_PLAY_POSITION);
+            mSavedPlaybackPosition = savedInstanceState.getInt(PreviewMediaFragment.EXTRA_PLAY_POSITION);
             mAutoplay = savedInstanceState.getBoolean(PreviewMediaFragment.EXTRA_PLAYING);
 
         }
@@ -251,15 +250,12 @@ public class PreviewMediaFragment extends FileFragment implements
                 mVideoPreview.setVisibility(View.VISIBLE);
                 mImagePreview.setVisibility(View.GONE);
                 prepareVideo();
-
-            }
-            else {
+            } else {
                 mVideoPreview.setVisibility(View.GONE);
                 mImagePreview.setVisibility(View.VISIBLE);
                 extractAndSetCoverArt(file);
             }
         }
-
     }
 
     /**
@@ -307,11 +303,8 @@ public class PreviewMediaFragment extends FileFragment implements
         }
         else {
             if (mMediaServiceBinder != null) {
-                outState.putInt(
-                        PreviewMediaFragment.EXTRA_PLAY_POSITION,
-                        mMediaServiceBinder.getCurrentPosition());
-                outState.putBoolean(
-                        PreviewMediaFragment.EXTRA_PLAYING, mMediaServiceBinder.isPlaying());
+                outState.putInt(PreviewMediaFragment.EXTRA_PLAY_POSITION, mMediaServiceBinder.getCurrentPosition());
+                outState.putBoolean(PreviewMediaFragment.EXTRA_PLAYING, mMediaServiceBinder.isPlaying());
             }
         }
     }
@@ -565,6 +558,8 @@ public class PreviewMediaFragment extends FileFragment implements
     @Override
     public void onResume() {
         super.onResume();
+        mOnResume = !mOnResume;
+
         if (getActivity() != null) {
             AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
@@ -585,6 +580,7 @@ public class PreviewMediaFragment extends FileFragment implements
         if (mMediaServiceConnection != null) {
             Log_OC.d(TAG, "Unbinding from MediaService ...");
             if (mMediaServiceBinder != null && mMediaController != null) {
+                mMediaController.stopMediaPlayerMessages();
                 mMediaServiceBinder.unregisterMediaController(mMediaController);
             }
             getActivity().unbindService(mMediaServiceConnection);
@@ -638,7 +634,7 @@ public class PreviewMediaFragment extends FileFragment implements
 
     private void playAudio() {
         OCFile file = getFile();
-        if (!mMediaServiceBinder.isPlaying(file)) {
+        if (!mMediaServiceBinder.isPlaying(file) && !mOnResume) {
             Log_OC.d(TAG, "starting playback of " + file.getStoragePath());
             mMediaServiceBinder.start(mAccount, file, mAutoplay, mSavedPlaybackPosition);
 
@@ -649,6 +645,8 @@ public class PreviewMediaFragment extends FileFragment implements
                 mMediaController.updatePausePlay();
             }
         }
+
+        mOnResume = false;
     }
 
 

BIN
src/main/res/drawable-hdpi/nav_activity.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_folder_open.png → src/main/res/drawable-hdpi/nav_all_files.png


BIN
src/main/res/drawable-hdpi/nav_contacts.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_star.png → src/main/res/drawable-hdpi/nav_favorites.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_cloud_upload.png → src/main/res/drawable-hdpi/nav_folder_sync.png


+ 0 - 0
src/main/res/drawable-hdpi/logout.png → src/main/res/drawable-hdpi/nav_logout.png


BIN
src/main/res/drawable-hdpi/nav_notifications.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_action_available_offline.png → src/main/res/drawable-hdpi/nav_on_device.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_participate.png → src/main/res/drawable-hdpi/nav_participate.png


BIN
src/main/res/drawable-hdpi/nav_photos.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_recent.png → src/main/res/drawable-hdpi/nav_recently.png


BIN
src/main/res/drawable-hdpi/nav_settings.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_shared.png → src/main/res/drawable-hdpi/nav_shared.png


+ 0 - 0
src/main/res/drawable-hdpi/ic_uploads.png → src/main/res/drawable-hdpi/nav_uploads.png


BIN
src/main/res/drawable-hdpi/nav_videos.png


BIN
src/main/res/drawable-mdpi/nav_activity.png


BIN
src/main/res/drawable-mdpi/nav_all_files.png


BIN
src/main/res/drawable-mdpi/nav_contacts.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_star.png → src/main/res/drawable-mdpi/nav_favorites.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_cloud_upload.png → src/main/res/drawable-mdpi/nav_folder_sync.png


+ 0 - 0
src/main/res/drawable-mdpi/logout.png → src/main/res/drawable-mdpi/nav_logout.png


BIN
src/main/res/drawable-mdpi/nav_notifications.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_action_available_offline.png → src/main/res/drawable-mdpi/nav_on_device.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_participate.png → src/main/res/drawable-mdpi/nav_participate.png


BIN
src/main/res/drawable-mdpi/nav_photos.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_recent.png → src/main/res/drawable-mdpi/nav_recently.png


BIN
src/main/res/drawable-mdpi/nav_settings.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_shared.png → src/main/res/drawable-mdpi/nav_shared.png


+ 0 - 0
src/main/res/drawable-mdpi/ic_uploads.png → src/main/res/drawable-mdpi/nav_uploads.png


BIN
src/main/res/drawable-mdpi/nav_videos.png


BIN
src/main/res/drawable-xhdpi/nav_activity.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_folder_open.png → src/main/res/drawable-xhdpi/nav_all_files.png


BIN
src/main/res/drawable-xhdpi/nav_contacts.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_star.png → src/main/res/drawable-xhdpi/nav_favorites.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_cloud_upload.png → src/main/res/drawable-xhdpi/nav_folder_sync.png


+ 0 - 0
src/main/res/drawable-xhdpi/logout.png → src/main/res/drawable-xhdpi/nav_logout.png


BIN
src/main/res/drawable-xhdpi/nav_notifications.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_action_available_offline.png → src/main/res/drawable-xhdpi/nav_on_device.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_participate.png → src/main/res/drawable-xhdpi/nav_participate.png


BIN
src/main/res/drawable-xhdpi/nav_photos.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_recent.png → src/main/res/drawable-xhdpi/nav_recently.png


BIN
src/main/res/drawable-xhdpi/nav_settings.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_shared.png → src/main/res/drawable-xhdpi/nav_shared.png


+ 0 - 0
src/main/res/drawable-xhdpi/ic_uploads.png → src/main/res/drawable-xhdpi/nav_uploads.png


BIN
src/main/res/drawable-xhdpi/nav_videos.png


BIN
src/main/res/drawable-xxhdpi/nav_activity.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_folder_open.png → src/main/res/drawable-xxhdpi/nav_all_files.png


BIN
src/main/res/drawable-xxhdpi/nav_contacts.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_star.png → src/main/res/drawable-xxhdpi/nav_favorites.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_cloud_upload.png → src/main/res/drawable-xxhdpi/nav_folder_sync.png


+ 0 - 0
src/main/res/drawable-xxhdpi/logout.png → src/main/res/drawable-xxhdpi/nav_logout.png


BIN
src/main/res/drawable-xxhdpi/nav_notifications.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_action_available_offline.png → src/main/res/drawable-xxhdpi/nav_on_device.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_participate.png → src/main/res/drawable-xxhdpi/nav_participate.png


BIN
src/main/res/drawable-xxhdpi/nav_photos.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_recent.png → src/main/res/drawable-xxhdpi/nav_recently.png


BIN
src/main/res/drawable-xxhdpi/nav_settings.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_shared.png → src/main/res/drawable-xxhdpi/nav_shared.png


+ 0 - 0
src/main/res/drawable-xxhdpi/ic_uploads.png → src/main/res/drawable-xxhdpi/nav_uploads.png


BIN
src/main/res/drawable-xxhdpi/nav_videos.png


BIN
src/main/res/drawable-xxxhdpi/nav_activity.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_star.png → src/main/res/drawable-xxxhdpi/nav_favorites.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_cloud_upload.png → src/main/res/drawable-xxxhdpi/nav_folder_sync.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/logout.png → src/main/res/drawable-xxxhdpi/nav_logout.png


BIN
src/main/res/drawable-xxxhdpi/nav_notifications.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_action_available_offline.png → src/main/res/drawable-xxxhdpi/nav_on_device.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_participate.png → src/main/res/drawable-xxxhdpi/nav_participate.png


BIN
src/main/res/drawable-xxxhdpi/nav_photos.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_recent.png → src/main/res/drawable-xxxhdpi/nav_recently.png


BIN
src/main/res/drawable-xxxhdpi/nav_settings.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_shared.png → src/main/res/drawable-xxxhdpi/nav_shared.png


+ 0 - 0
src/main/res/drawable-xxxhdpi/ic_uploads.png → src/main/res/drawable-xxxhdpi/nav_uploads.png


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.