+ * 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
+ \r
+ /// includes a pending intent in the notification showing the details view of the file\r
+ Intent showDetailsIntent = new Intent(this, FileDetailActivity.class);\r
+ showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, download.getFile());\r
+ showDetailsIntent.putExtra(FileDetailFragment.EXTRA_ACCOUNT, download.getAccount());\r
+ showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r
+ mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), showDetailsIntent, 0);\r
+ \r
+ mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification);\r
+ }\r
+\r
+ \r
+ /**\r