X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/3ef64834e94d4f2f21e3fceafec0987e67e5c893..e9f13d77ce3d9a7a94c2338b560659bfe2b1ad0f:/src/com/owncloud/android/syncadapter/FileSyncAdapter.java diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 2d88646e..46c088b4 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -35,8 +35,11 @@ import com.owncloud.android.operations.RemoteOperationResult; import com.owncloud.android.operations.SynchronizeFolderOperation; import com.owncloud.android.operations.UpdateOCVersionOperation; import com.owncloud.android.operations.RemoteOperationResult.ResultCode; -import com.owncloud.android.ui.activity.GenericExplanationActivity; +import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity; import android.accounts.Account; +import android.accounts.AccountsException; +import android.accounts.AuthenticatorException; +import android.accounts.OperationCanceledException; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -102,7 +105,12 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { this.setStorageManager(new FileDataStorageManager(account, getContentProvider())); try { this.initClientForCurrentAccount(); - } catch (UnknownHostException e) { + } catch (IOException e) { + /// the account is unknown for the Synchronization Manager, or unreachable for this context; don't try this again + mSyncResult.tooManyRetries = true; + notifyFailedSynchronization(); + return; + } catch (AccountsException e) { /// the account is unknown for the Synchronization Manager, or unreachable for this context; don't try this again mSyncResult.tooManyRetries = true; notifyFailedSynchronization(); @@ -346,23 +354,20 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { notification.flags |= Notification.FLAG_AUTO_CANCEL; /// includes a pending intent in the notification showing a more detailed explanation - Intent explanationIntent = new Intent(getContext(), GenericExplanationActivity.class); - String message = String.format(getContext().getString(R.string.sync_foreign_files_forgotten_explanation), getContext().getString(R.string.app_name), getAccount().name); - explanationIntent.putExtra(GenericExplanationActivity.MESSAGE, message); + Intent explanationIntent = new Intent(getContext(), ErrorsWhileCopyingHandlerActivity.class); + explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_ACCOUNT, getAccount()); ArrayList remotePaths = new ArrayList(); ArrayList localPaths = new ArrayList(); - for (String remote : mForgottenLocalFiles.keySet()) { - remotePaths.add(getContext().getString(R.string.sync_foreign_files_forgotten_remote_prefix) + remote); - localPaths.add(getContext().getString(R.string.sync_foreign_files_forgotten_local_prefix) + mForgottenLocalFiles.get(remote)); - } - explanationIntent.putExtra(GenericExplanationActivity.EXTRA_LIST, localPaths); - explanationIntent.putExtra(GenericExplanationActivity.EXTRA_LIST_2, remotePaths); + remotePaths.addAll(mForgottenLocalFiles.keySet()); + localPaths.addAll(mForgottenLocalFiles.values()); + explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_LOCAL_PATHS, localPaths); + explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_REMOTE_PATHS, remotePaths); explanationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), explanationIntent, 0); notification.setLatestEventInfo(getContext().getApplicationContext(), getContext().getString(R.string.sync_foreign_files_forgotten_ticker), - String.format(getContext().getString(R.string.sync_foreign_files_forgotten_content), mForgottenLocalFiles.size()), + String.format(getContext().getString(R.string.sync_foreign_files_forgotten_content), mForgottenLocalFiles.size(), getContext().getString(R.string.app_name)), notification.contentIntent); ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_foreign_files_forgotten_ticker, notification);