- notification.flags |= Notification.FLAG_ONGOING_EVENT;
- notification.contentView = new RemoteViews(getApplicationContext()
- .getPackageName(), R.layout.progressbar_layout);
- notification.contentView.setProgressBar(R.id.status_progress,
- mLocalPaths.length - 1, 0, false);
- notification.contentView.setImageViewResource(R.id.status_icon,
- R.drawable.icon);
-
- mNotificationManager.notify(42, notification);
-
- WebdavClient wc = new WebdavClient(ocUri);
- wc.setCredentials(username, password);
+ 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, false);
+ mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);
+ // dvelasco ; contentIntent MUST be assigned to avoid app crashes in versions previous to Android 4.x ;
+ // BUT an empty Intent is not a very elegant solution; something smart should happen when a user 'clicks' on an upload in the notification bar
+ mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);
+
+ mNotificationManager.notify(42, mNotification);
+
+ WebdavClient wc = new WebdavClient(mAccount, getApplicationContext());
+ wc.setDataTransferProgressListener(this);