+ \r
+ /**\r
+ * Once the file upload has finished -> update view\r
+ * \r
+ * Being notified about the finish of an upload is necessary for the next sequence:\r
+ * 1. Upload a big file.\r
+ * 2. Force a synchronization; if it finished before the upload, the file in transfer will be included in the local database and in the file list\r
+ * of its containing folder; the the server includes it in the PROPFIND requests although it's not fully upload. \r
+ * 3. Click the file in the list to see its details.\r
+ * 4. Wait for the upload finishes; at this moment, the details view must be refreshed to enable the action buttons.\r
+ */\r
+ private class UploadFinishReceiver extends BroadcastReceiver {\r
+ @Override\r
+ public void onReceive(Context context, Intent intent) {\r
+ String accountName = intent.getStringExtra(FileUploader.ACCOUNT_NAME);\r
+\r
+ if (!isEmpty() && accountName.equals(mAccount.name)) {\r
+ boolean uploadWasFine = intent.getBooleanExtra(FileUploader.EXTRA_UPLOAD_RESULT, false);\r
+ String uploadRemotePath = intent.getStringExtra(FileUploader.EXTRA_REMOTE_PATH);\r
+ if (mFile.getRemotePath().equals(uploadRemotePath)) {\r
+ if (uploadWasFine) {\r
+ FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver());\r
+ mFile = fdsm.getFileByPath(mFile.getRemotePath());\r
+ }\r
+ updateFileDetails(); // it updates the buttons; must be called although !uploadWasFine; interrupted uploads still leave an incomplete file in the server\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+\r