Merge pull request #912 from owncloud/review_license
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileActivity.java
index 54efc6f..e92474b 100644 (file)
@@ -1,6 +1,9 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2012-2015 ownCloud Inc.
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -23,7 +26,6 @@ import android.accounts.AccountManager;
 import android.accounts.AccountManagerCallback;
 import android.accounts.AccountManagerFuture;
 import android.accounts.AuthenticatorException;
-import android.accounts.OnAccountsUpdateListener;
 import android.accounts.OperationCanceledException;
 import android.content.ComponentName;
 import android.content.Context;
@@ -57,7 +59,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CreateShareOperation;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
-
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
 import com.owncloud.android.ui.dialog.LoadingDialog;
@@ -66,11 +67,9 @@ import com.owncloud.android.utils.ErrorMessageAdapter;
 
 /**
  * Activity with common behaviour for activities handling {@link OCFile}s in ownCloud {@link Account}s .
- * 
- * @author David A. Velasco
  */
 public class FileActivity extends SherlockFragmentActivity
-        implements OnRemoteOperationListener, ComponentsGetter, OnAccountsUpdateListener {
+        implements OnRemoteOperationListener, ComponentsGetter {
 
     public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
     public static final String EXTRA_ACCOUNT = "com.owncloud.android.ui.activity.ACCOUNT";
@@ -160,10 +159,6 @@ public class FileActivity extends SherlockFragmentActivity
             bindService(new Intent(this, FileUploader.class), mUploadServiceConnection, Context.BIND_AUTO_CREATE);
         }
 
-        // add AccountsUpdatedListener
-        AccountManager am = AccountManager.get(getApplicationContext());
-        am.addOnAccountsUpdatedListener(this, null, false);
-        
     }
 
     
@@ -227,10 +222,6 @@ public class FileActivity extends SherlockFragmentActivity
             mUploadServiceConnection = null;
         }
 
-        // remove AccountsUpdatedListener
-        AccountManager am = AccountManager.get(getApplicationContext());
-        am.removeOnAccountsUpdatedListener(this);
-
         super.onDestroy();
     }
     
@@ -297,7 +288,6 @@ public class FileActivity extends SherlockFragmentActivity
                         this, 
                         new AccountCreationCallback(),                        
                         null);
-        am.addOnAccountsUpdatedListener(this, null, true);
     }
 
     
@@ -366,26 +356,11 @@ public class FileActivity extends SherlockFragmentActivity
         return null;
     }
 
-    @Override
-    public void onAccountsUpdated(Account[] accounts) {
-        // detect a change in the list of accounts
-        Log_OC.d(TAG, "onAccountsUpdated");
-        if (mDownloaderBinder != null) {
-            mDownloaderBinder.checkAccountOfCurrentDownload();
-        }
-        if (mUploaderBinder != null) {
-            mUploaderBinder.checkAccountOfCurrentUpload();
-        }
-    }
-
-
     /**
      * Helper class handling a callback from the {@link AccountManager} after the creation of
      * a new ownCloud {@link Account} finished, successfully or not.
      * 
      * At this moment, only called after the creation of the first account.
-     * 
-     * @author David A. Velasco
      */
     public class AccountCreationCallback implements AccountManagerCallback<Bundle> {