Browse Source

Modify DetectAuthenticationMethodOperation so that , when returning its result through the callback, there is no crash if AuthenticatorActivity is not ready (rotating)

masensio 11 years ago
parent
commit
2628eceb6b

+ 21 - 0
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -537,6 +537,27 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         }
     }
 
+
+    @Override 
+    protected void onStart() {
+        if (mOperationsServiceBinder != null) {
+            mOperationsServiceBinder.addOperationListener(AuthenticatorActivity.this, mHandler);
+        }
+        
+        super.onStart();
+    }
+    
+    
+    @Override 
+    protected void onStop() {
+        if (mOperationsServiceBinder != null) {
+            mOperationsServiceBinder.removeOperationListener(this);
+        }
+        super.onStop();
+    }
+    
+
+
     /**
      * The redirection triggered by the OAuth authentication server as response to the GET AUTHORIZATION, and 
      * deferred in {@link #onNewIntent(Intent)}, is processed here.

+ 6 - 2
src/com/owncloud/android/ui/activity/FileActivity.java

@@ -150,22 +150,26 @@ public class FileActivity extends SherlockFragmentActivity implements OnRemoteOp
     
     @Override 
     protected void onStart() {
-        super.onStart();
+
         if (mAccountWasSet) {
             onAccountSet(mAccountWasRestored);
         }
         if (mOperationsServiceBinder != null) {
             mOperationsServiceBinder.addOperationListener(FileActivity.this, mHandler);
         }
+        
+        super.onStart();
     }
     
     
     @Override 
     protected void onStop() {
-        super.onStop();
+
         if (mOperationsServiceBinder != null) {
             mOperationsServiceBinder.removeOperationListener(this);
         }
+        
+        super.onStop();
     }