+ \r
+ /**\r
+ * Notifies the user about local copies of files out of the ownCloud local directory that were 'forgotten' because \r
+ * copying them inside the ownCloud local directory was not possible.\r
+ * \r
+ * We don't want links to files out of the ownCloud local directory (foreign files) anymore. It's easy to have \r
+ * synchronization problems if a local file is linked to more than one remote file.\r
+ * \r
+ * We won't consider a synchronization as failed when foreign files can not be copied to the ownCloud local directory.\r
+ */\r
+ private void notifyForgottenLocalFiles() {\r
+ Notification notification = new Notification(R.drawable.icon, getContext().getString(R.string.sync_foreign_files_forgotten_ticker), System.currentTimeMillis());\r
+ notification.flags |= Notification.FLAG_AUTO_CANCEL;\r
+\r
+ /// includes a pending intent in the notification showing a more detailed explanation\r
+ Intent explanationIntent = new Intent(getContext(), ErrorsWhileCopyingHandlerActivity.class);\r
+ explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_ACCOUNT, getAccount());\r
+ ArrayList<String> remotePaths = new ArrayList<String>();\r
+ ArrayList<String> localPaths = new ArrayList<String>();\r
+ remotePaths.addAll(mForgottenLocalFiles.keySet());\r
+ localPaths.addAll(mForgottenLocalFiles.values());\r
+ explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_LOCAL_PATHS, localPaths);\r
+ explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_REMOTE_PATHS, remotePaths); \r
+ explanationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r
+ \r
+ notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), explanationIntent, 0);\r
+ notification.setLatestEventInfo(getContext().getApplicationContext(), \r
+ getContext().getString(R.string.sync_foreign_files_forgotten_ticker), \r
+ String.format(getContext().getString(R.string.sync_foreign_files_forgotten_content), mForgottenLocalFiles.size(), getContext().getString(R.string.app_name)), \r
+ notification.contentIntent);\r
+ ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_foreign_files_forgotten_ticker, notification);\r
+ \r
+ }\r
+ \r
+ \r