+ mUploadsInProgress.remove(buildRemoteName(mAccount.name, mRemotePaths[i]));
+
+ /// notify upload of EACH file to activities interested
+ Intent end = new Intent(UPLOAD_FINISH_MESSAGE);
+ end.putExtra(EXTRA_PARENT_DIR_ID, parentDirId);
+ end.putExtra(ACCOUNT_NAME, mAccount.name);
+ sendBroadcast(end);
+ }
+
+ /// notify final result
+ if (mSuccessCounter == mLocalPaths.length) { // success
+ //Notification finalNotification = new Notification(R.drawable.icon, getString(R.string.uploader_upload_succeeded_ticker), System.currentTimeMillis());
+ mNotification.flags ^= Notification.FLAG_ONGOING_EVENT; // remove the ongoing flag
+ mNotification.flags |= Notification.FLAG_AUTO_CANCEL;
+ mNotification.contentView = oldContentView;
+ // TODO put something smart in the contentIntent below
+ mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);
+ if (mLocalPaths.length == 1) {
+ mNotification.setLatestEventInfo( getApplicationContext(),
+ getString(R.string.uploader_upload_succeeded_ticker),
+ String.format(getString(R.string.uploader_upload_succeeded_content_single), localFiles[0].getName()),
+ mNotification.contentIntent);
+ } else {
+ mNotification.setLatestEventInfo( getApplicationContext(),
+ getString(R.string.uploader_upload_succeeded_ticker),
+ String.format(getString(R.string.uploader_upload_succeeded_content_multiple), mSuccessCounter),
+ mNotification.contentIntent);
+ }
+ mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotification); // NOT AN ERROR; uploader_upload_in_progress_ticker is the target, not a new notification