+\r
+ /**\r
+ * Updates the OC File after a successful download.\r
+ */\r
+ private void saveDownloadedFile() {\r
+ OCFile file = mCurrentDownload.getFile();\r
+ long syncDate = System.currentTimeMillis();\r
+ file.setLastSyncDateForProperties(syncDate);\r
+ file.setLastSyncDateForData(syncDate);\r
+ file.setModificationTimestamp(mCurrentDownload.getModificationTimestamp());\r
+ // file.setEtag(mCurrentDownload.getEtag()); // TODO Etag, where available\r
+ file.setMimetype(mCurrentDownload.getMimeType());\r
+ file.setStoragePath(mCurrentDownload.getSavePath());\r
+ file.setFileLength((new File(mCurrentDownload.getSavePath()).length()));\r
+ mStorageManager.saveFile(file);\r
+ }\r
+\r
+\r
+ /**\r
+ * Creates a status notification to show the download progress\r
+ * \r
+ * @param download Download operation starting.\r
+ */\r
+ private void notifyDownloadStart(DownloadFileOperation download) {\r
+ /// create status notification with a progress bar\r
+ mLastPercent = 0;\r
+ mNotification = new Notification(R.drawable.icon, getString(R.string.downloader_download_in_progress_ticker), System.currentTimeMillis());\r
+ mNotification.flags |= Notification.FLAG_ONGOING_EVENT;\r
+ mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout);\r
+ mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, download.getSize() < 0);\r
+ mNotification.contentView.setTextViewText(R.id.status_text, String.format(getString(R.string.downloader_download_in_progress_content), 0, new File(download.getSavePath()).getName()));\r
+ mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);\r