- mNotification = new Notification(DisplayUtils.getSeasonalIconId(), getString(R.string.downloader_download_in_progress_ticker), System.currentTimeMillis());
- mNotification.flags |= Notification.FLAG_ONGOING_EVENT;
- mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout);
- mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, download.getSize() < 0);
- mNotification.contentView.setTextViewText(R.id.status_text, String.format(getString(R.string.downloader_download_in_progress_content), 0, new File(download.getSavePath()).getName()));
- mNotification.contentView.setImageViewResource(R.id.status_icon, DisplayUtils.getSeasonalIconId());
-
+ mNotificationBuilder =
+ NotificationBuilderWithProgressBar.newNotificationBuilderWithProgressBar(this);
+ mNotificationBuilder
+ .setSmallIcon(R.drawable.notification_icon)
+ .setTicker(getString(R.string.downloader_download_in_progress_ticker))
+ .setContentTitle(getString(R.string.downloader_download_in_progress_ticker))
+ .setOngoing(true)
+ .setProgress(100, 0, download.getSize() < 0)
+ .setContentText(
+ String.format(getString(R.string.downloader_download_in_progress_content), 0,
+ new File(download.getSavePath()).getName())
+ );
+